From 6d2329422773c08042fe05aa48162b99cbc88c61 Mon Sep 17 00:00:00 2001 From: stv Date: Mon, 28 May 2007 12:19:10 +0000 Subject: [PATCH] no message --- src/Qtx/QtxPopupMgr.cxx | 147 ++++++++++++---------------------------- 1 file changed, 45 insertions(+), 102 deletions(-) diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 9f85263e4..33813d4ae 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -22,6 +22,49 @@ #include +/*! + \return true if 'v1'<'v2' + This function can work with many types of values +*/ +bool operator<( const QVariant& v1, const QVariant& v2 ) +{ + QVariant::Type t1 = v1.type(), t2 = v2.type(); + if ( t1 == t2 ) + { + switch( t1 ) + { + case QVariant::Int: + return v1.toInt() < v2.toInt(); + break; + case QVariant::Double: + return v1.toDouble() < v2.toDouble(); + break; + case QVariant::String: + return v1.toString() < v2.toString(); + break; + case QVariant::StringList: + case QVariant::List: + { + const QList& aList1 = v1.toList(), aList2 = v2.toList(); + QList::const_iterator anIt1 = aList1.begin(), aLast1 = aList1.end(), + anIt2 = aList2.begin(), aLast2 = aList2.end(); + for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) + { + if ( (*anIt1) != (*anIt2) ) + return (*anIt1)<(*anIt2); + } + return anIt1 == aLast1 && anIt2 != aLast2; + break; + } + default: + return v1.toString() < v2.toString(); + break; + } + } + else + return t1 < t2; +} + /*! \class QtxPopupMgr::PopupCreator */ @@ -335,49 +378,6 @@ void QtxPopupMgr::setParameters( QtxEvalParser* p, QStringList& specific ) const } } -/*! - \return true if 'v1'<'v2' - This function can work with many types of values -*/ -bool operator<( const QVariant& v1, const QVariant& v2 ) -{ - QVariant::Type t1 = v1.type(), t2 = v2.type(); - if ( t1 == t2 ) - { - switch( t1 ) - { - case QVariant::Int: - return v1.toInt() < v2.toInt(); - break; - case QVariant::Double: - return v1.toDouble() < v2.toDouble(); - break; - case QVariant::String: - return v1.toString() < v2.toString(); - break; - case QVariant::StringList: - case QVariant::List: - { - const QList& aList1 = v1.toList(), aList2 = v2.toList(); - QList::const_iterator anIt1 = aList1.begin(), aLast1 = aList1.end(), - anIt2 = aList2.begin(), aLast2 = aList2.end(); - for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) - { - if ( (*anIt1) != (*anIt2) ) - return (*anIt1)<(*anIt2); - } - return anIt1 == aLast1 && anIt2 != aLast2; - break; - } - default: - return v1.toString() < v2.toString(); - break; - } - } - else - return t1 < t2; -} - /*! \return true if rule of action is satisfied on current selection \param act - action @@ -460,6 +460,8 @@ void QtxPopupMgr::internalUpdate() } QtxActionMenuMgr::internalUpdate(); + + myCache.clear(); } /*! @@ -531,65 +533,6 @@ QVariant QtxPopupMgr::parameter( const QString& name, const int idx ) const return val; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*! \class QtxPopupSelection */ -- 2.39.2