[yast-commit] r57356 - in /branches/tmp/tgoettlicher/yast2cc_rewrite/src: kcategorizedsortfilterproxymodel.cpp yqmodulesmodel.cpp

Author: kmachalkova Date: Thu May 28 19:25:36 2009 New Revision: 57356 URL: http://svn.opensuse.org/viewcvs/yast?rev=57356&view=rev Log: Arrange right-panel categories so that they match sort order of left-panel groups Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewri... ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/kcategorizedsortfilterproxymodel.cpp Thu May 28 19:25:36 2009 @@ -243,14 +243,34 @@ QVariant l = (left.model() ? left.model()->data(left, CategorySortRole) : QVariant()); QVariant r = (right.model() ? right.model()->data(right, CategorySortRole) : QVariant()); + QVariant s1 = (left.model() ? left.model()->data( left, CategoryDisplayRole ) : QVariant()); + QVariant s2 = (right.model() ? right.model()->data( right, CategoryDisplayRole ) : QVariant()); + Q_ASSERT(l.isValid()); Q_ASSERT(r.isValid()); + Q_ASSERT(s1.isValid()); + Q_ASSERT(s2.isValid()); Q_ASSERT(l.type() == r.type()); + Q_ASSERT(s1.type() == s2.type()); + + qlonglong lint = l.toLongLong(); + qlonglong rint = r.toLongLong(); + + if (lint < rint) + { + return -1; + } + + if (lint > rint) + { + return 1; + } - if (l.type() == QVariant::String) + if (lint == rint) { - QString lstr = l.toString(); - QString rstr = r.toString(); + + QString lstr = s1.toString(); + QString rstr = s2.toString(); if (d->sortCategoriesByNaturalComparison) { @@ -272,18 +292,5 @@ } } - qlonglong lint = l.toLongLong(); - qlonglong rint = r.toLongLong(); - - if (lint < rint) - { - return -1; - } - - if (lint > rint) - { - return 1; - } - return 0; } Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewri... ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqmodulesmodel.cpp Thu May 28 19:25:36 2009 @@ -103,7 +103,10 @@ } else if ( role == KCategorizedSortFilterProxyModel::CategorySortRole ) { - return groupsModel()->data( groupForModule(index) ); + QModelIndex grp_idx = groupForModule( index ); + QModelIndex idx = createIndex( grp_idx.row(), YQDesktopFilesModel::SortKey ); + + return groupsModel()->data( idx, Qt::UserRole); } else if ( role == Qt::ToolTipRole ) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org