[Marble-devel] Review Request 114761: Add support for ListStyle::ItemIcon::href

Dennis Nienhüser earthwings at gentoo.org
Wed Jan 1 12:14:41 UTC 2014



> On Jan. 1, 2014, 8:10 a.m., Dennis Nienhüser wrote:
> > src/lib/marble/GeoDataTreeModel.cpp, line 324
> > <https://git.reviewboard.kde.org/r/114761/diff/1/?file=228507#file228507line324>
> >
> >     Shouldn't this iterate over all styles and select the one which has a suitable state?
> >
> 
> Levente Kurusa wrote:
>     Yes, it should, but we can't find out the requested item's state yet...

We don't know the item state in the model, but we know that it is a folder and not a network link. Therefore we can limit the choice of suitable templates to "open" and "closed" and ignore the fetching ones (network link only). In code:

@@ -310,11 +311,20 @@ QVariant GeoDataTreeModel::data( const QModelIndex &index, int role ) const
     else if ( role == Qt::DecorationRole
               && index.column() == 0 ) {
         if ( object->nodeType() == GeoDataTypes::GeoDataPlacemarkType
-             || object->nodeType() == GeoDataTypes::GeoDataFolderType
              || object->nodeType() == GeoDataTypes::GeoDataDocumentType
              || object->nodeType() == GeoDataTypes::GeoDataTourType ) {
             GeoDataFeature *feature = static_cast<GeoDataFeature*>( object );
             return QVariant(feature->style()->iconStyle().icon());
+        } else if ( object->nodeType() == GeoDataTypes::GeoDataFolderType ) {
+            GeoDataFolder *folder = static_cast<GeoDataFolder*>( object );
+            // @TODO: Subclass QTreeView, and overwrite icon rendering and pass a specific @role,
+            // so as to be able to determine the state of the folder.
+            foreach( GeoDataItemIcon* icon, folder->style()->listStyle().itemIconList() ) {
+                if ( icon->state() == GeoDataItemIcon::Open ) {
+                    return icon->icon();
+                }
+            }
+            return folder->style()->iconStyle().icon();
         }
     } else if ( role == Qt::ToolTipRole
               && index.column() == 0 ) {


- Dennis


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/114761/#review46525
-----------------------------------------------------------


On Dec. 31, 2013, 3:35 p.m., Levente Kurusa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/114761/
> -----------------------------------------------------------
> 
> (Updated Dec. 31, 2013, 3:35 p.m.)
> 
> 
> Review request for Marble, Dennis Nienhüser and Torsten Rahn.
> 
> 
> Repository: marble
> 
> 
> Description
> -------
> 
> GCI task: http://www.google-melange.com/gci/task/view/google/gci2013/6070288135487488
> 
> 
> Diffs
> -----
> 
>   src/lib/marble/GeoDataTreeModel.cpp 9f9cc0a 
>   src/lib/marble/geodata/data/GeoDataItemIcon.cpp d731a11 
>   src/lib/marble/geodata/data/GeoDataStyle.cpp 8771787 
> 
> Diff: https://git.reviewboard.kde.org/r/114761/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Levente Kurusa
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20140101/e80344a6/attachment.html>


More information about the Marble-devel mailing list