Qt / C ++ QPainter :: pen: Painter не активен (QPainter :: begin: устройство рисования вернуло движок == 0, тип: 1)

Это мой код:

    QPaintDevice *paintDevice = this;
QImage image;
if (!isEnabled())
{
// If the globe covers fully the screen then we can use the faster
// RGB32 as there are no translucent areas involved.
QImage::Format imageFormat = ( ui->MarbleWidget_plan->viewport()->mapCoversViewport() )
? QImage::Format_RGB32
: QImage::Format_ARGB32_Premultiplied;
// Paint to an intermediate image
image = QImage( rect().size(), imageFormat );
image.fill( Qt::transparent );
paintDevice = ℑ
}

gp = new GeoPainter ( paintDevice, ui->MarbleWidget_plan->viewport(), ui->MarbleWidget_plan->mapQuality() );
drawMission();

Я использую Marble Widget:

http://edu.kde.org/marble/

и я пытаюсь нарисовать эту карту !!

И это мой drawMission ():

void video::drawMission(){

GeoDataCoordinates France( 2.2, 48.52, 0.0, GeoDataCoordinates::Degree );
gp->setPen( QColor( 0, 0, 0 ) );
gp->drawText( France, "France" );

GeoDataCoordinates Canada( -77.02, 48.52, 0.0, GeoDataCoordinates::Degree );
gp->setPen( QColor( 0, 0, 0 ) );
gp->drawText( Canada, "Canada" );

//A line from France to Canada without tessellation

GeoDataLineString shapeNoTessellation( NoTessellation );
shapeNoTessellation << France << Canada;

gp->setPen( oxygenSkyBlue4 );
gp->drawPolyline( shapeNoTessellation );

//The same line, but with tessellation

GeoDataLineString shapeTessellate( Tessellate );
shapeTessellate << France << Canada;

gp->setPen( oxygenBrickRed4 );
gp->drawPolyline( shapeTessellate );

//Now following the latitude circles

GeoDataLineString shapeLatitudeCircle( RespectLatitudeCircle | Tessellate );
shapeLatitudeCircle << France << Canada;

gp->setPen( oxygenForestGreen4 );
gp->drawPolyline( shapeLatitudeCircle );
}

И это то, что я получаю

QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::pen: Painter not active
QPainter::setPen: Painter not active
QPainter::fontMetrics: Painter not active
QPainter::fontMetrics: Painter not active
QPainter::setPen: Painter not active
QPainter::fontMetrics: Painter not active
QPainter::fontMetrics: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active

Спасибо за помощь ! и за ваше время

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]