diff d2/qt/core/QModelIndex.d @ 397:590dcfc85873

Quick const-correctness fix for QModelIndex. This probably deserves a more in-depth look later.
author David Nadlinger <code@klickverbot.at>
date Mon, 03 Jan 2011 08:30:59 +0100
parents d37abad3def9
children
line wrap: on
line diff
--- a/d2/qt/core/QModelIndex.d	Mon Jan 03 08:06:13 2011 +0100
+++ b/d2/qt/core/QModelIndex.d	Mon Jan 03 08:30:59 2011 +0100
@@ -18,67 +18,65 @@
          return mi;
     }
 
-    public final QModelIndex child(int row, int column) {
-        return __qtd_QModelIndex_child_int_int(&this, row, column);
+    public final QModelIndex child(int row, int column) const {
+        return __qtd_QModelIndex_child_int_int(cast(void*)&this, row, column);
     }
 
     public final int column() const {
         return __qtd_QModelIndex_column(cast(void*)&this);
     }
 
-    public final QVariant data(int role = 0) {
-        void* __qt_return_value = __qtd_QModelIndex_data_int(&this, role);
+    public final QVariant data(int role = 0) const {
+        void* __qt_return_value = __qtd_QModelIndex_data_int(cast(void*)&this, role);
         return new QVariant(__qt_return_value);
     }
 
-    public final int flags() {
-        return __qtd_QModelIndex_flags(&this);
+    public final int flags() const {
+        return __qtd_QModelIndex_flags(cast(void*)&this);
     }
 
-    public final long internalId() {
-        return __qtd_QModelIndex_internalId(&this);
+    public final long internalId() const {
+        return __qtd_QModelIndex_internalId(cast(void*)&this);
     }
 
-    public final void* internalPointer() const {
-        //return __qtd_QModelIndex_internalPointer(&this);
-        return cast(void*)p;
+    public final const(void*) internalPointer() const {
+        return p;
     }
 
-    public final Object object() const {
-        return cast(Object) p;
+    public final const(Object) object() const {
+        return cast(const(Object)) p;
     }
 
     public final bool isValid() const {
         return __qtd_QModelIndex_isValid(cast(void*)&this);
     }
 
-    public final QAbstractItemModel model() {
-//        void* __qt_return_value = __qtd_QModelIndex_model(&this);
-        void* __qt_return_value = m;
-        if (__qt_return_value is null)
+    public final const(QAbstractItemModel) model() const {
+        void* __qt_return_value = cast(void*)m;
+        if (m is null)
             return null;
-        void* d_obj = qtd_get_d_qobject(__qt_return_value);
+        void* d_obj = qtd_get_d_qobject(cast(void*)m);
         return cast(QAbstractItemModel) d_obj;
     }
 
-    private final bool operator_less(QModelIndex other) {
-        return __qtd_QModelIndex_operator_less_QModelIndex(&this, other);
+    private final bool operator_less(QModelIndex other) const {
+        return __qtd_QModelIndex_operator_less_QModelIndex(cast(void*)&this, other);
     }
 
-    private final bool operator_equal(QModelIndex other) {
-        return __qtd_QModelIndex_operator_equal_QModelIndex(&this, other);
+    private final bool operator_equal(QModelIndex other) const {
+        return __qtd_QModelIndex_operator_equal_QModelIndex(cast(void*)&this, other);
     }
 
-    public final QModelIndex parent() {
-        return __qtd_QModelIndex_parent(&this);
+    public final QModelIndex parent() const {
+        return __qtd_QModelIndex_parent(cast(void*)&this);
     }
 
     public final int row() const {
         return __qtd_QModelIndex_row(cast(void*)&this);
     }
 
-    public final QModelIndex sibling(int row, int column) {
-        return __qtd_QModelIndex_sibling_int_int(&this, row, column);
+    public final QModelIndex sibling(int row, int column) const {
+        return __qtd_QModelIndex_sibling_int_int(cast(void*)&this, row, column);
     }
 
     public alias void __isNativeValueType;