[Tux4kids-commits] r1312 - in tux4kids-admin/trunk/tux4kids-admin: . src

Michał Świtakowski swistakers-guest at alioth.debian.org
Fri Jul 31 20:30:06 UTC 2009


Author: swistakers-guest
Date: 2009-07-31 20:30:06 +0000 (Fri, 31 Jul 2009)
New Revision: 1312

Added:
   tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.h
Removed:
   tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.cpp
   tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.h
Modified:
   tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt
   tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.ui
   tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui
   tux4kids-admin/trunk/tux4kids-admin/src/src.pro
Log:
corrected class proxy model

Deleted: tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.cpp	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.cpp	2009-07-31 20:30:06 UTC (rev 1312)
@@ -1,25 +0,0 @@
-#include "classTableProxyModel.h"
-#include "classTableModel.h"
-
-ClassTableProxyModel::ClassTableProxyModel(QObject *parent )
-		: QSortFilterProxyModel(parent)
-{
-}
-
-bool ClassTableProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
-{
-	QVariant leftData = sourceModel()->data(left);
-	QVariant rightData = sourceModel()->data(right);
-
-	switch(left.column()) {
-	case ClassTableModel::ClassSelected:
-		if (leftData.toBool() && !rightData.toBool()) {
-			return true;
-		} else {
-			return false;
-		};
-	case ClassTableModel::ClassName:
-		return QString::localeAwareCompare(leftData.toString(),
-					   rightData.toString()) < 0;
-	}
-}

Deleted: tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.h	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.h	2009-07-31 20:30:06 UTC (rev 1312)
@@ -1,15 +0,0 @@
-#ifndef CLASSTABLEPROXYMODEL_H
-#define CLASSTABLEPROXYMODEL_H
-
-#include <QSortFilterProxyModel>
-
-class ClassTableProxyModel : public QSortFilterProxyModel
-{
-	Q_OBJECT
-public:
-	ClassTableProxyModel(QObject *parent = 0);
-
-	bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
-};
-
-#endif // CLASSTABLEPROXYMODEL_H

Modified: tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/src/CMakeLists.txt	2009-07-31 20:30:06 UTC (rev 1312)
@@ -18,7 +18,7 @@
 	manageClassDialog.cpp
 	manageTeachersWidget.cpp 
 	teacherTableModel.cpp 
-	../classTableProxyModel.cpp )
+	classTableProxyModel.cpp )
 
 SET(TUX4KIDS-ADMIN_MOC_HEADERS 
 	mainWindow.h
@@ -34,7 +34,7 @@
 	manageClassDialog.h 
 	manageTeachersWidget.h
 	teacherTableModel.h 
-	../classTableProxyModel.h )
+	classTableProxyModel.h )
 
 SET(TUX4KIDS-ADMIN_UIS 
 	mainWindow.ui 

Copied: tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.cpp (from rev 1310, tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.cpp)
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.cpp	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.cpp	2009-07-31 20:30:06 UTC (rev 1312)
@@ -0,0 +1,28 @@
+#include "classTableProxyModel.h"
+#include "classTableModel.h"
+
+#include <QBitArray>
+
+ClassTableProxyModel::ClassTableProxyModel(QObject *parent )
+		: QSortFilterProxyModel(parent)
+{
+}
+
+bool ClassTableProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+	switch(left.column()) {
+	case ClassTableModel::ClassSelected:
+		if ((sourceModel()->data(left, Qt::CheckStateRole).toInt() == Qt::Checked) && (sourceModel()->data(right, Qt::CheckStateRole).toInt() == Qt::Unchecked)) {
+			return true;
+		} else {
+			return false;
+		};
+	case ClassTableModel::ClassName: {
+		QVariant leftData = sourceModel()->data(left);
+		QVariant rightData = sourceModel()->data(right);
+		return QString::localeAwareCompare(leftData.toString(),
+					   rightData.toString()) < 0;
+		}
+	}
+	return false;
+}

Copied: tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.h (from rev 1310, tux4kids-admin/trunk/tux4kids-admin/classTableProxyModel.h)
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.h	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/classTableProxyModel.h	2009-07-31 20:30:06 UTC (rev 1312)
@@ -0,0 +1,15 @@
+#ifndef CLASSTABLEPROXYMODEL_H
+#define CLASSTABLEPROXYMODEL_H
+
+#include <QSortFilterProxyModel>
+
+class ClassTableProxyModel : public QSortFilterProxyModel
+{
+	Q_OBJECT
+public:
+	ClassTableProxyModel(QObject *parent = 0);
+
+	bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+};
+
+#endif // CLASSTABLEPROXYMODEL_H

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.ui	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageClassesWidget.ui	2009-07-31 20:30:06 UTC (rev 1312)
@@ -28,6 +28,9 @@
      <property name="horizontalScrollMode">
       <enum>QAbstractItemView::ScrollPerPixel</enum>
      </property>
+     <property name="sortingEnabled">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
    <item>

Modified: tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/src/manageTeachersWidget.ui	2009-07-31 20:30:06 UTC (rev 1312)
@@ -28,6 +28,9 @@
      <property name="horizontalScrollMode">
       <enum>QAbstractItemView::ScrollPerPixel</enum>
      </property>
+     <property name="sortingEnabled">
+      <bool>true</bool>
+     </property>
     </widget>
    </item>
   </layout>

Modified: tux4kids-admin/trunk/tux4kids-admin/src/src.pro
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/src.pro	2009-07-31 20:25:31 UTC (rev 1311)
+++ tux4kids-admin/trunk/tux4kids-admin/src/src.pro	2009-07-31 20:30:06 UTC (rev 1312)
@@ -19,7 +19,7 @@
     manageClassDialog.cpp \
     manageTeachersWidget.cpp \
     teacherTableModel.cpp \
-    ../classTableProxyModel.cpp
+    classTableProxyModel.cpp
 HEADERS += mainWindow.h \
     mainController.h \
     pluginManager.h \
@@ -35,7 +35,7 @@
     manageClassDialog.h \
     manageTeachersWidget.h \
     teacherTableModel.h \
-    ../classTableProxyModel.h
+    classTableProxyModel.h
 FORMS += mainWindow.ui \
     pluginManagerDialog.ui \
     manageStudentsWidget.ui \




More information about the Tux4kids-commits mailing list