这是我的代码:
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:
我正试图在这张地图上画画!!
这是我的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
谢谢你的帮助!和你的时间