[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src/lib
From:       Dennis Nienhüser <earthwings () gentoo ! org>
Date:       2011-02-19 21:45:31
Message-ID: 20110219214531.2DCBFAC8BF () svn ! kde ! org
[Download RAW message or body]

SVN commit 1221644 by nienhueser:

Extend drawAnnotation() to calculate and use the optimal text height when an invalid \
height is passed. Use it for painting driving instructions in the map. Fixes long \
instructions being cut off. Reduce the rounded corner radius for a better text/bubble \
                ratio.
BUG: 265926
REVIEW: 6525

 M  +6 -0      GeoPainter.cpp  
 M  +2 -0      GeoPainter.h  
 M  +2 -2      routing/RoutingLayer.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/GeoPainter.cpp #1221643:1221644
@@ -219,6 +219,12 @@
     bool globeHidesPoint;
     AbstractProjection *projection = d->m_viewport->currentProjection();
 
+    if ( bubbleSize.height() <= 0 ) {
+        QRectF rect = QRectF( QPointF( 0.0, 0.0 ), bubbleSize - QSizeF( 2 * xRnd, \
0.0 ) ); +        qreal idealTextHeight = boundingRect( rect, Qt::TextWordWrap, text \
).height(); +        bubbleSize.setHeight( 2 * yRnd + idealTextHeight );
+    }
+
     bool visible = projection->screenCoordinates( position, d->m_viewport, d->m_x, \
y, pointRepeatNum, globeHidesPoint );  
     if ( visible ) {
--- trunk/KDE/kdeedu/marble/src/lib/GeoPainter.h #1221643:1221644
@@ -156,6 +156,8 @@
     \param position The geodesic position
     \param text The text contained by the bubble
     \param bubbleSize The size of the bubble that holds the annotation text.
+                      A height of 0 can be used to have the height calculated
+                      automatically to fit the needed text height.
     \param bubbleOffsetX The x-axis offset between the annotated position and
                          the "root" of the speech bubble's "arrow".
     \param bubbleOffsetY The y-axis offset between the annotated position and
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1221643:1221644
@@ -321,7 +321,7 @@
             if ( m_selectionModel->selection().contains( proxyIndex ) ) {
                 painter->setPen( QColor( Qt::black ) );
                 painter->setBrush( QBrush( oxygenSunYellow6 ) );
-                painter->drawAnnotation( pos, index.data().toString(), QSize( 120, \
60 ), 10, 30, 15, 15 ); +                painter->drawAnnotation( pos, \
index.data().toString(), QSize( 120, 0 ), 10, 30, 5, 5 );  
                 GeoDataLineString currentRoutePoints = \
qVariantValue<GeoDataLineString>( index.data( RoutingModel::InstructionWayPointRole ) \
);  
@@ -346,7 +346,7 @@
         } else if ( !m_routeDirty && type == RoutingModel::Error ) {
             painter->setPen( QColor( Qt::white ) );
             painter->setBrush( QBrush( alphaAdjusted( oxygenBrickRed4, 200 ) ) );
-            painter->drawAnnotation( pos, index.data().toString(), QSize( 180, 80 ), \
10, 30, 15, 15 ); +            painter->drawAnnotation( pos, index.data().toString(), \
QSize( 180, 0 ), 10, 30, 5, 5 );  }
 
         if( !m_routingModel->deviatedFromRoute() ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic