changeset 202:57c3714ed282

interview fixes, using override keyword
author eldar
date Mon, 13 Jul 2009 13:47:15 +0000
parents aa3811034056
children d3383b16f1d7
files demos/interview/model.d demos/interview/model_d2.d
diffstat 2 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/demos/interview/model.d	Mon Jul 13 12:12:11 2009 +0000
+++ b/demos/interview/model.d	Mon Jul 13 13:47:15 2009 +0000
@@ -81,7 +81,7 @@
     }
 
 
-    QModelIndex index(int row, int column, QModelIndex parent)
+    override QModelIndex index(int row, int column, QModelIndex parent)
     {
         if (row < rc && row >= 0 && column < cc && column >= 0) {
             Node p = cast(Node) parent.internalPointer();
@@ -92,7 +92,7 @@
         return QModelIndex();
     }
 
-    QModelIndex parent(QModelIndex child)
+    override QModelIndex parent(QModelIndex child)
     {
         if (child.isValid()) {
             Node n = cast(Node) child.internalPointer();
@@ -103,17 +103,17 @@
         return QModelIndex();
     }
 
-    int rowCount(QModelIndex parent)
+    override int rowCount(QModelIndex parent)
     {
         return (parent.isValid() && parent.column() != 0) ? 0 : rc;
     }
 
-    int columnCount(QModelIndex parent)
+    override int columnCount(QModelIndex parent)
     {
         return cc;
     }
     
-    QVariant data(QModelIndex index, int role)
+    override QVariant data(QModelIndex index, int role)
     {
         if (!index.isValid)
             return new QVariant;
@@ -128,7 +128,7 @@
         return new QVariant;
     }
     
-    QVariant headerData(int section, Qt.Orientation orientation, int role)
+    override QVariant headerData(int section, Qt.Orientation orientation, int role)
     {
         if (role == Qt.DisplayRole)
             return new QVariant(Integer.toString(section));
@@ -137,14 +137,14 @@
         return QAbstractItemModel.headerData(section, orientation, role);
     }
 
-    bool hasChildren(QModelIndex parent)
+    override bool hasChildren(QModelIndex parent)
     {
         if (parent.isValid && parent.column != 0)
             return false;
         return rc > 0 && cc > 0;
     }
     
-    int flags(QModelIndex index)
+    override int flags(QModelIndex index)
     {
         if (!index.isValid)
             return 0;
--- a/demos/interview/model_d2.d	Mon Jul 13 12:12:11 2009 +0000
+++ b/demos/interview/model_d2.d	Mon Jul 13 13:47:15 2009 +0000
@@ -89,18 +89,18 @@
     }
 
 
-    QModelIndex index(int row, int column, const QModelIndex parent)
+    override QModelIndex index(int row, int column, const QModelIndex parent)
     {
         if (row < rc && row >= 0 && column < cc && column >= 0) {
             Node p = cast(Node) parent.internalPointer();
             Node n = getNode(row, p);
-        if (n !is null)
-            return createIndex(row, column, cast(void*)n);
+            if (n !is null)
+                return createIndex(row, column, cast(void*)n);
         }
         return QModelIndex();
     }
 
-    QModelIndex parent(const QModelIndex child)
+    override QModelIndex parent(const QModelIndex child)
     {
         if (child.isValid()) {
             Node n = cast(Node) child.internalPointer();
@@ -111,17 +111,17 @@
         return QModelIndex();
     }
 
-    int rowCount(const QModelIndex parent)
+    override int rowCount(const QModelIndex parent)
     {
         return (parent.isValid() && parent.column() != 0) ? 0 : rc;
     }
 
-    int columnCount(const QModelIndex parent)
+    override int columnCount(const QModelIndex parent)
     {
         return cc;
     }
     
-    QVariant data(const QModelIndex index, int role)
+    override QVariant data(const QModelIndex index, int role)
     {
         if (!index.isValid)
             return new QVariant;
@@ -136,7 +136,7 @@
         return new QVariant;
     }
     
-    QVariant headerData(int section, Qt.Orientation orientation, int role)
+    override QVariant headerData(int section, Qt.Orientation orientation, int role)
     {
         if (role == Qt.DisplayRole)
             return new QVariant(to!string(section));
@@ -145,14 +145,14 @@
         return QAbstractItemModel.headerData(section, orientation, role);
     }
 
-    bool hasChildren(const QModelIndex parent)
+    override bool hasChildren(const QModelIndex parent)
     {
         if (parent.isValid && parent.column != 0)
             return false;
         return rc > 0 && cc > 0;
     }
     
-    int flags(const QModelIndex index)
+    override int flags(const QModelIndex index)
     {
         if (!index.isValid)
             return 0;