2012-05-16 68 views
0

我在QT中編寫了一個應用程序,它將在widget中顯示地圖。並且,如果我只是想要從輔助點繪製從開始點到結束點的路線撤消繪製的路線(我的意思是擦除)。follwing代碼片段將我如何繪製。如何在圖形屏幕上清除繪圖

QGeoMapRouteObject *route = new QGeoMapRouteObject(reply->routes().at(0)); 
    QColor routeColor(Qt::blue); 
    routeColor.setAlpha(127); 
    QPen pen(routeColor); 
    pen.setWidth(3); 
    pen.setCapStyle(Qt::MPenCapStyle); 
    route->setPen(pen); 

下面這個類「QGeoMapRouteObject」可是沒有,除了setPen.Please其他的選擇讓我知道怎樣繪製和擦除使用這個類「QGeoMapRouteObject」的路線。

回答

0

QGeoMapRouteObject無法撤銷進程。因爲它是被調用的對象。只調用對象(在你的情況下,圖形視圖)可以撤消效果。 Just like Pixmap being an object and painter the parent object, Pixmap itself can't draw a Line in it.

+0

感謝您對spyke的迴應。即使我也這麼想。感謝您的建議:-) – bhaskar