From: vsr Date: Mon, 14 May 2007 12:34:41 +0000 (+0000) Subject: Porting to Qt4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=347e9ed1b15fe34398f71c7aef39f52826d51d63;p=modules%2Fgui.git Porting to Qt4 --- diff --git a/src/SUIT/SUIT_DataObjectIterator.cxx b/src/SUIT/SUIT_DataObjectIterator.cxx index c5f66be5c..c1a16892d 100644 --- a/src/SUIT/SUIT_DataObjectIterator.cxx +++ b/src/SUIT/SUIT_DataObjectIterator.cxx @@ -74,11 +74,11 @@ void SUIT_DataObjectIterator::operator++() } else { - aParent->myChildren.find( myCurrent ); + int idx = aParent->myChildren.indexOf( myCurrent ); if ( myDetourType == DepthLeft ) - myCurrent = aParent->myChildren.next(); + myCurrent = idx < aParent->myChildren.count() - 1 ? aParent->myChildren[idx + 1] : 0; else - myCurrent = aParent->myChildren.prev(); + myCurrent = idx > 0 ? aParent->myChildren[idx - 1] : 0; if ( !myCurrent ) { myCurrent = aParent; @@ -146,9 +146,9 @@ SUIT_DataObject* SUIT_DataObjectIterator::globalSibling( SUIT_DataObject* obj, b if ( obj && ( par = parent( obj ) ) ) { - par->myChildren.find( obj ); - if ( par->myChildren.next() ) - return par->myChildren.current(); + int idx = par->myChildren.indexOf( obj ); + if ( idx < par->myChildren.count() - 1 ) + return par->myChildren[idx + 1]; else { for ( ; par; par = globalSibling( par, next ) ) @@ -170,9 +170,9 @@ SUIT_DataObject* SUIT_DataObjectIterator::globalSibling( SUIT_DataObject* obj, b SUIT_DataObject* SUIT_DataObjectIterator::extreme( DataObjectList& aList, bool FromLeft ) const { if ( FromLeft ) - return aList.getFirst(); + return aList.first(); else - return aList.getLast(); + return aList.last(); } /*! diff --git a/src/SUIT/SUIT_DataObjectKey.cxx b/src/SUIT/SUIT_DataObjectKey.cxx index 01a91404a..d209c9320 100755 --- a/src/SUIT/SUIT_DataObjectKey.cxx +++ b/src/SUIT/SUIT_DataObjectKey.cxx @@ -18,9 +18,9 @@ // #include "SUIT_DataObjectKey.h" -#include +#include -#ifndef WNT +#ifndef WIN32 #include #define _typeinfo std::type_info #else diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index a0aa525c4..dd4431d73 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -16,10 +16,9 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // - #include "SUIT_DataOwner.h" -#ifndef WNT +#ifndef WIN32 #include #define _typeinfo std::type_info #else @@ -45,9 +44,7 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) return p1.isNull() && p2.isNull(); } -// *** jfa: The below function has been put here 14.02.2007 from branch BR_Dev_For_4_0 -// *** and also improved for better comparison of DataOwners with DataSubOwners. -// *** This comment is to be removed after merging with BR_Dev_For_4_0. + /*! Operator < allows to order suit data owners for map */ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) { @@ -60,7 +57,6 @@ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) return (p1->keyString() < p2->keyString()); } -// *** end /*! \class SUIT_DataOwnerPtrList @@ -72,8 +68,8 @@ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) Constructor (default) */ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList() - : QValueList(), - mySkipEqual( true ) +: QList(), +mySkipEqual( true ) { } @@ -81,8 +77,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList() Constructor (default) */ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual ) - : QValueList(), - mySkipEqual( skipAllEqual ) +: QList(), +mySkipEqual( skipAllEqual ) { } @@ -90,8 +86,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual ) Constructor (copy) */ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ) - : QValueList( l ), - mySkipEqual( true ) +: QList( l ), +mySkipEqual( true ) { } @@ -99,8 +95,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ) Constructor (copy) */ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual ) - : QValueList(), - mySkipEqual( skipAllEqual ) +: QList(), +mySkipEqual( skipAllEqual ) { if ( skipAllEqual == l.mySkipEqual ) operator =( l ); @@ -108,51 +104,23 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, co { SUIT_DataOwnerPtrList::const_iterator beginIt = l.begin(); SUIT_DataOwnerPtrList::const_iterator endIt = l.end(); - for( ; beginIt != endIt; ++beginIt ) + for ( ; beginIt != endIt; ++beginIt ) append( *beginIt ); } } -#ifndef QT_NO_STL -/*! - Constructor (from stl) -*/ -SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l ) - : QValueList( l ), - mySkipEqual( true ) -{ -} -#endif - -#ifndef QT_NO_STL -/*! - Constructor (from stl) -*/ -SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqual ) - : QValueList(), - mySkipEqual( skipAllEqual ) -{ - std::list::const_iterator beginIt = l.begin(); - std::list::const_iterator endIt = l.begin(); - for( ; beginIt != endIt; ++beginIt ) - append( *beginIt ); -} -#endif - /*! Appends an item to the list */ -SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) +void SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) { if ( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== - return myMap[ x ]; - - iterator it = QValueList::append( x ); + return; - if ( mySkipEqual ) - myMap.insert( x, it ); + QList::append( x ); - return it; + if ( mySkipEqual ) + myMap.insert( x, 0 ); } /*! @@ -160,9 +128,10 @@ SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOw */ void SUIT_DataOwnerPtrList::clear() { - if( mySkipEqual ) + if ( mySkipEqual ) myMap.clear(); - QValueList::clear(); + + QList::clear(); } /*! @@ -170,7 +139,8 @@ void SUIT_DataOwnerPtrList::clear() */ uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x ) { - if( mySkipEqual && myMap.contains(x) ) - myMap.remove(x); - return QValueList::remove( x ); + if ( mySkipEqual && myMap.contains(x) ) + myMap.remove( x ); + + return QList::removeAll( x ); } diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index 7e88c58ff..976e5b45f 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -21,8 +21,9 @@ #include "SUIT_SmartPtr.h" -#include -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -40,8 +41,6 @@ class SUIT_EXPORT SUIT_DataOwner : public RefCount public: SUIT_DataOwner();//!< constructor virtual ~SUIT_DataOwner();//!< destructor - // *** jfa: The below line has been put here 14.02.2007. - // *** It cancels modifications from branch BR_Dev_For_4_0 virtual QString keyString() const = 0;//!< used for comparison }; @@ -60,21 +59,17 @@ bool operator==( const SUIT_DataOwnerPtr&, const SUIT_DataOwnerPtr& ); /*! \class SUIT_DataOwnerPtrList * \brief Manage list of SUIT_DataOwnerPtr. */ -class SUIT_EXPORT SUIT_DataOwnerPtrList : public QValueList +class SUIT_EXPORT SUIT_DataOwnerPtrList : public QList { public: SUIT_DataOwnerPtrList(); //!< constructor SUIT_DataOwnerPtrList( const bool skipAllEqual );//!< constructor SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ); //!< copy constructor SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual );//!< copy constructor -#ifndef QT_NO_STL - SUIT_DataOwnerPtrList( const std::list& l ); //!< copy constructor for STL list - SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqual );//!< copy constructor for STL list -#endif - iterator append ( const SUIT_DataOwnerPtr& x );//!< append function + void append ( const SUIT_DataOwnerPtr& x );//!< append function void clear (); - uint remove (const SUIT_DataOwnerPtr& x ); + uint remove ( const SUIT_DataOwnerPtr& x ); private: // hide this methods: only append() should be used to add items to the list @@ -84,8 +79,8 @@ private: void push_back ( const SUIT_DataOwnerPtr& x );//!< hide method private: - bool mySkipEqual; - QMap myMap; + QMap myMap; + bool mySkipEqual; }; #ifdef WIN32