[Marble-commits] KDE/kdeedu/marble/src/lib

Thibaut Gridel tgridel at free.fr
Sun Dec 12 12:28:39 CET 2010


SVN commit 1205741 by tgridel:

PlacemarkLayout: simplify maxLabelHeight

 M  +5 -6      PlacemarkLayout.cpp  
 M  +1 -2      PlacemarkLayout.h  


--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkLayout.cpp #1205740:1205741
@@ -147,14 +147,13 @@
     return ret;
 }
 
-int PlacemarkLayout::maxLabelHeight( const QAbstractItemModel* model,
-                                     const QItemSelectionModel* selectionModel ) const
+int PlacemarkLayout::maxLabelHeight() const
 {
     mDebug() << "Detecting maxLabelHeight ...";
 
     int maxLabelHeight = 0;
 
-    const QModelIndexList selectedIndexes = selectionModel->selection().indexes();
+    const QModelIndexList selectedIndexes = m_selectionModel->selection().indexes();
 
     for ( int i = 0; i < selectedIndexes.count(); ++i ) {
         const QModelIndex index = selectedIndexes.at( i );
@@ -166,8 +165,8 @@
             maxLabelHeight = textHeight; 
     }
 
-    for ( int i = 0; i < model->rowCount(); ++i ) {
-        QModelIndex index = model->index( i, 0 );
+    for ( int i = 0; i < m_placemarkModel->rowCount(); ++i ) {
+        QModelIndex index = m_placemarkModel->index( i, 0 );
         GeoDataPlacemark *placemark = dynamic_cast<GeoDataPlacemark*>(qvariant_cast<GeoDataObject*>(index.data( MarblePlacemarkModel::ObjectPointerRole ) ));
         GeoDataStyle* style = placemark->style();
         QFont labelFont = style->labelStyle().font();
@@ -193,7 +192,7 @@
         m_styleResetRequested = false;
         styleReset();
 
-        m_maxLabelHeight = maxLabelHeight( m_placemarkModel, m_selectionModel );
+        m_maxLabelHeight = maxLabelHeight();
     }
     const int   secnumber         = imgheight / m_maxLabelHeight + 1;
 
--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkLayout.h #1205740:1205741
@@ -76,8 +76,7 @@
      * just traverse all existing styles. 
      */
 
-    int maxLabelHeight( const QAbstractItemModel* model,
-                        const QItemSelectionModel* selectionModel ) const;
+    int maxLabelHeight() const;
 
     /**
      * Returns a list of model indexes that are at position @p pos.


More information about the Marble-commits mailing list