Browse Source

Only leaf nodes require metadata

Donald Carr 8 years ago
parent
commit
35590cfbf6
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/picturemodel.cpp

+ 7 - 4
src/picturemodel.cpp

@@ -33,9 +33,12 @@ struct FSNode {
 
   const QString name;
   const FSNode *parent;
+};
 
-  QSize size;
-  qreal ratio;
+struct FSLeafNode : public FSNode {
+    using FSNode::FSNode;
+    QSize size;
+    qreal ratio;
 };
 
 FSNode::FSNode(const QString& rname, const FSNode *pparent)
@@ -66,7 +69,7 @@ public:
     void setModelRoot(const QString& rootDir) { this->rootDir = rootDir; }
 
     int fileCount() const { return files.length(); }
-    QList<FSNode*> files;
+    QList<FSLeafNode*> files;
 public slots:
     void populate();
 signals:
@@ -107,7 +110,7 @@ void FSNodeTree::addModelNode(const FSNode* parentNode)
         if (!extensions.contains(extension))
             continue;
 
-        FSNode *file = new FSNode(currentFile, parentNode);
+        FSLeafNode *file = new FSLeafNode(currentFile, parentNode);
         const QString fullPath = FSNode::qualifyNode(file);
 
         QSize size = QImageReader(fullPath).size();