From c6db0ee61ce9a5c091651f060dfb341b5f4c1492 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 10 Aug 2007 12:45:24 +0000 Subject: [PATCH] *** empty log message *** --- src/LightApp/LightApp_Application.cxx | 2 +- src/LightApp/LightApp_DataObject.cxx | 71 +++++++++++++++++ src/LightApp/LightApp_DataObject.h | 4 + src/LightApp/LightApp_Dialog.cxx | 6 +- src/LightApp/LightApp_Module.h | 4 +- src/LightApp/LightApp_NameDlg.h | 2 +- src/LightApp/LightApp_OCCSelector.cxx | 2 +- src/LightApp/LightApp_Selection.cxx | 8 +- src/LightApp/LightApp_SelectionMgr.h | 4 +- src/LogWindow/LogWindow.cxx | 4 +- src/ObjBrowser/OB_Browser.cxx | 13 ++- src/Plot2d/Plot2d_Curve.cxx | 4 +- src/Plot2d/Plot2d_ViewFrame.cxx | 8 +- src/QDS/QDS.cxx | 4 +- src/QDS/QDS.h | 6 +- src/QDS/QDS_CheckBox.h | 2 +- src/QDS/QDS_ComboBox.h | 2 +- src/QDS/QDS_Datum.cxx | 10 +-- src/QDS/QDS_Datum.h | 6 +- src/QDS/QDS_LineEdit.h | 2 +- src/QDS/QDS_RadioBox.h | 2 +- src/QDS/QDS_SpinBox.h | 2 +- src/QDS/QDS_SpinBoxDbl.h | 2 +- src/QDS/QDS_TextEdit.h | 2 +- src/ResExporter/ResourceExporter.cxx | 4 +- .../SALOME_PYQT_GUI/SALOME_PYQT_Module.h | 4 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 12 +-- src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 8 +- src/SOCC/SOCC_Prs.cxx | 8 ++ src/SOCC/SOCC_Prs.h | 3 + src/SalomeApp/SalomeApp_Application.cxx | 4 +- src/SalomeApp/SalomeApp_DataObject.cxx | 42 +--------- src/Session/SALOME_Session_Server.cxx | 79 +++++-------------- 33 files changed, 176 insertions(+), 160 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index b604a7b82..68446a9e8 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -2366,7 +2366,7 @@ void LightApp_Application::moduleIconNames( QMap& iconMap ) co { QString modName = *it; QString modIntr = moduleName( modName ); - QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null ); + QString modIcon = resMgr->stringValue( modIntr, "icon", QString() ); if ( modIcon.isEmpty() ) continue; diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx index 75b250e74..1f746533d 100644 --- a/src/LightApp/LightApp_DataObject.cxx +++ b/src/LightApp/LightApp_DataObject.cxx @@ -27,6 +27,8 @@ #include #include +#include + /*! \class LightApp_DataObject::Key \brief Represents unique data object key for the LightApp_DataObject @@ -225,6 +227,75 @@ QString LightApp_DataObject::componentDataType() const return myCompDataType; } +/*! + \brief Check if the specified column supports custom sorting. + \param index column index + \return \c true if column sorting should be customized + \sa compare() +*/ +bool LightApp_DataObject::customSorting( const int index ) const +{ + // perform custom sorting for the "Entry" column + return index == EntryIdx ? true + : CAM_DataObject::customSorting( index ); +} + +/*! + \brief Compares data from two items for sorting purposes. + + This method is called only for those columns for which customSorting() + method returns \c true. + + \param left first data to compare + \param right second data to compare + \param index column index + \return result of the comparison + \sa customSorting() +*/ +bool LightApp_DataObject::compare( const QVariant& left, const QVariant& right, + const int index ) const +{ + if ( index == EntryIdx ) { + // perform custom sorting for the "Entry" column + QString leftStr = left.toString(); + QString rightStr = right.toString(); + QStringList idsLeft = leftStr.split( ":", QString::SkipEmptyParts ); + QStringList idsRight = rightStr.split( ":", QString::SkipEmptyParts ); + if ( idsLeft.count() > 1 || idsRight.count() > 1 ) { + bool result = true; + bool calculated = false; + for ( int i = 0; i < idsLeft.count() || i < idsRight.count(); i++ ) { + bool okLeft = true, okRight = true; + int lid = 0, rid = 0; + if ( i < idsLeft.count() ) + lid = idsLeft[i].toInt( &okLeft ); + if ( i < idsRight.count() ) + rid = idsRight[i].toInt( &okRight ); + if ( okLeft && okRight ) { + // both seem to be correct integer ID + return lid < rid; + } + else if ( okLeft || okRight ) { + // objects with correct (int) ID have higher priority + return okLeft; + } + else { + // both not integer ID + int r = QString::localeAwareCompare( idsLeft[i], idsRight[i] ); + if ( !calculated && r != 0 ) { + result = r < 0; + calculated = true; + } + } + } + // we should reach this if the entries are exactly equal + return result; + } + return QString::localeAwareCompare( leftStr, rightStr ) < 0; + } + return CAM_DataObject::compare( left, right, index ); +} + /*! \class LightApp_ModuleObject \brief Used for optimized access to the data model from the data objects. diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h index 0d6ade400..77f3b7861 100644 --- a/src/LightApp/LightApp_DataObject.h +++ b/src/LightApp/LightApp_DataObject.h @@ -55,6 +55,10 @@ public: virtual SUIT_DataObject* componentObject() const; virtual QString componentDataType() const; + virtual bool customSorting( const int = NameIdx ) const; + virtual bool compare( const QVariant&, const QVariant&, + const int = NameIdx ) const; + protected: QString myCompDataType; SUIT_DataObject* myCompObject; diff --git a/src/LightApp/LightApp_Dialog.cxx b/src/LightApp/LightApp_Dialog.cxx index 7d62a461a..efa50e54d 100644 --- a/src/LightApp/LightApp_Dialog.cxx +++ b/src/LightApp/LightApp_Dialog.cxx @@ -236,7 +236,7 @@ void LightApp_Dialog::clearSelection( const int id ) myObjects[ id ].myTypes.clear(); myObjects[ id ].myNames.clear(); - myObjects[ id ].myEdit->setText( QString::null ); + myObjects[ id ].myEdit->setText( QString() ); emit selectionChanged( id ); } } @@ -716,7 +716,7 @@ QString LightApp_Dialog::selectionDescription( const QStringList& names, const T return "LightApp_Dialog::selectionDescription(): Error!!!"; if( names.isEmpty() ) - return QString::null; + return QString(); switch( ni ) { @@ -739,7 +739,7 @@ QString LightApp_Dialog::selectionDescription( const QStringList& names, const T return countOfTypes( types ); break; }; - return QString::null; + return QString(); } /*! diff --git a/src/LightApp/LightApp_Module.h b/src/LightApp/LightApp_Module.h index 0883d2120..58dec54ac 100644 --- a/src/LightApp/LightApp_Module.h +++ b/src/LightApp/LightApp_Module.h @@ -115,8 +115,8 @@ protected: int addPreference( const QString& label ); int addPreference( const QString& label, const int pId, const int = LightApp_Preferences::Auto, - const QString& section = QString::null, - const QString& param = QString::null ); + const QString& section = QString(), + const QString& param = QString() ); QVariant preferenceProperty( const int, const QString& ) const; void setPreferenceProperty( const int, const QString&, const QVariant& ); diff --git a/src/LightApp/LightApp_NameDlg.h b/src/LightApp/LightApp_NameDlg.h index 59c9a27a3..8a261dc9b 100644 --- a/src/LightApp/LightApp_NameDlg.h +++ b/src/LightApp/LightApp_NameDlg.h @@ -44,7 +44,7 @@ public: void setName( const QString& name ); QString name(); - static QString getName( QWidget* parent = 0, const QString& oldName = QString::null ); + static QString getName( QWidget* parent = 0, const QString& oldName = QString() ); protected slots: void accept(); diff --git a/src/LightApp/LightApp_OCCSelector.cxx b/src/LightApp/LightApp_OCCSelector.cxx index 534cad26e..b40650399 100644 --- a/src/LightApp/LightApp_OCCSelector.cxx +++ b/src/LightApp/LightApp_OCCSelector.cxx @@ -133,7 +133,7 @@ void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) QString LightApp_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS ) const { if ( anAIS.IsNull() || !anAIS->HasOwner() ) - return QString::null; + return QString(); QString res; diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx index 4cc124bcb..29913715d 100644 --- a/src/LightApp/LightApp_Selection.cxx +++ b/src/LightApp/LightApp_Selection.cxx @@ -181,7 +181,7 @@ QVariant LightApp_Selection::parameter( const QString& p ) const else if ( p == "activeModule" ) { LightApp_Application* app = dynamic_cast( myStudy->application() ); - QString mod_name = app ? QString( app->activeModule()->name() ) : QString::null; + QString mod_name = app ? QString( app->activeModule()->name() ) : QString(); //cout << "activeModule : " << mod_name.latin1() << endl; if( !mod_name.isEmpty() ) return mod_name; @@ -190,11 +190,7 @@ QVariant LightApp_Selection::parameter( const QString& p ) const } else if ( p == "isActiveView" ) return QVariant( (bool)activeVW() ); else if ( p == "activeView" ) return QVariant( activeViewType() ); -#ifndef WIN32 else return QtxPopupSelection::parameter( p ); -#else - else return QtxPopupSelection::parameter( p ); //Selection::parameter( p ); //? -#endif } /*! @@ -236,7 +232,7 @@ QString LightApp_Selection::activeViewType() const if ( vm ) return vm->getType(); } - return QString::null; + return QString(); } /*! diff --git a/src/LightApp/LightApp_SelectionMgr.h b/src/LightApp/LightApp_SelectionMgr.h index ccc0c3eca..26934b6d8 100644 --- a/src/LightApp/LightApp_SelectionMgr.h +++ b/src/LightApp/LightApp_SelectionMgr.h @@ -56,7 +56,7 @@ public: typedef NCollection_DataMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger; typedef NCollection_DataMap< TCollection_AsciiString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger; - void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const; + void selectedObjects( SALOME_ListIO&, const QString& = QString(), const bool = true ) const; void setSelectedObjects( const SALOME_ListIO&, const bool = false ); void GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, @@ -74,7 +74,7 @@ public: void selectedSubOwners( MapEntryOfMapOfInteger& theMap ); #else - void selectedObjects( QStringList&, const QString& = QString::null, const bool = true ) const; + void selectedObjects( QStringList&, const QString& = QString(), const bool = true ) const; #endif signals: diff --git a/src/LogWindow/LogWindow.cxx b/src/LogWindow/LogWindow.cxx index 1b1a96319..ab0a237d9 100755 --- a/src/LogWindow/LogWindow.cxx +++ b/src/LogWindow/LogWindow.cxx @@ -92,7 +92,7 @@ LogWindow::LogWindow( QWidget* parent ) { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QString fntSet = resMgr ? resMgr->stringValue( "Log Window", "font", QString::null ) : QString::null; + QString fntSet = resMgr ? resMgr->stringValue( "Log Window", "font", QString() ) : QString(); setFont( SUIT_Tools::stringToFont( fntSet ) ); @@ -354,7 +354,7 @@ void LogWindow::onSaveToFile() return; // call application-specific "Save file" dialog box - QString aName = app->getFileName( false, QString::null, QString( "*.log" ), QString::null, 0 ); + QString aName = app->getFileName( false, QString(), QString( "*.log" ), QString(), 0 ); if ( aName.isNull() ) return; diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index 0f944c308..d30b7b6a2 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -358,6 +358,8 @@ void OB_Browser::select( const QModelIndex& index, const bool on, const bool kee \brief Select/deselect specified model indices. \param indexes model indices to be selected/deselected \param on if \c true, the indices will be selected, otherwise - deselected + \param keepSelection if \c true (default) the previous selection is kept, + otherwise it is first cleared */ void OB_Browser::select( const QModelIndexList& indexes, const bool on, const bool keepSelection ) { @@ -367,9 +369,14 @@ void OB_Browser::select( const QModelIndexList& indexes, const bool on, const bo QModelIndex idx; bool first = true; - foreach( idx, indexes ) { - select( idx, on, first ? keepSelection : true ); - first = false; + if ( !indexes.isEmpty() ) { + foreach( idx, indexes ) { + select( idx, on, first ? keepSelection : true ); + first = false; + } + } + else if ( !keepSelection ) { + myView->clearSelection(); } myView->blockSignals( blocked ); diff --git a/src/Plot2d/Plot2d_Curve.cxx b/src/Plot2d/Plot2d_Curve.cxx index abbc13bd3..7224d857f 100755 --- a/src/Plot2d/Plot2d_Curve.cxx +++ b/src/Plot2d/Plot2d_Curve.cxx @@ -219,7 +219,7 @@ void Plot2d_Curve::setData( const double* hData, const double* vData, long size, clearAllPoints(); QStringList::const_iterator anIt = lst.begin(), aLast = lst.end(); for( long i = 0; i < size; i++, anIt++ ) - addPoint( hData[i], vData[i], anIt==aLast ? QString::null : *anIt ); + addPoint( hData[i], vData[i], anIt==aLast ? QString() : *anIt ); } /*! @@ -412,7 +412,7 @@ void Plot2d_Curve::setText( const int ind, const QString& txt ) QString Plot2d_Curve::text( const int ind ) const { if( ind<0 || ind>=myPoints.count() ) - return QString::null; + return QString(); else return myPoints[ind].text; } diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 390659ac1..5afc21af0 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -1199,22 +1199,22 @@ void Plot2d_ViewFrame::setTitle( bool enabled, const QString& title, case MainTitle: myTitleEnabled = enabled; myTitle = title; - myPlot->setTitle( myTitleEnabled ? myTitle : QString::null ); + myPlot->setTitle( myTitleEnabled ? myTitle : QString() ); break; case XTitle: myXTitleEnabled = enabled; myXTitle = title; - myPlot->setAxisTitle( QwtPlot::xBottom, myXTitleEnabled ? myXTitle : QString::null ); + myPlot->setAxisTitle( QwtPlot::xBottom, myXTitleEnabled ? myXTitle : QString() ); break; case YTitle: myYTitleEnabled = enabled; myYTitle = title; - myPlot->setAxisTitle( QwtPlot::yLeft, myYTitleEnabled ? myYTitle : QString::null ); + myPlot->setAxisTitle( QwtPlot::yLeft, myYTitleEnabled ? myYTitle : QString() ); break; case Y2Title: myY2TitleEnabled = enabled; myY2Title = title; - myPlot->setAxisTitle( QwtPlot::yRight, myY2TitleEnabled ? myY2Title : QString::null ); + myPlot->setAxisTitle( QwtPlot::yRight, myY2TitleEnabled ? myY2Title : QString() ); break; } if ( update ) diff --git a/src/QDS/QDS.cxx b/src/QDS/QDS.cxx index 8bd4cf307..60c746452 100644 --- a/src/QDS/QDS.cxx +++ b/src/QDS/QDS.cxx @@ -71,7 +71,7 @@ QString QDS::toQString( const TCollection_ExtendedString& src ) QString QDS::toQString( const Handle(TCollection_HAsciiString)& src ) { if ( src.IsNull() ) - return QString::null; + return QString(); else return toQString( src->String() ); } @@ -84,7 +84,7 @@ QString QDS::toQString( const Handle(TCollection_HAsciiString)& src ) QString QDS::toQString( const Handle(TCollection_HExtendedString)& src ) { if ( src.IsNull() ) - return QString::null; + return QString(); else return toQString( src->String() ); } diff --git a/src/QDS/QDS.h b/src/QDS/QDS.h index c214bac1a..59edb25d4 100644 --- a/src/QDS/QDS.h +++ b/src/QDS/QDS.h @@ -63,10 +63,10 @@ public: static bool load( const QString& ); static QString unitSystemLabel( const QString&, - const QString& = QString::null ); - static QString activeUnitSystem( const QString& = QString::null ); + const QString& = QString() ); + static QString activeUnitSystem( const QString& = QString() ); static void setActiveUnitSystem( const QString&, - const QString& = QString::null ); + const QString& = QString() ); static QString toQString( const TCollection_AsciiString& ); static QString toQString( const TCollection_ExtendedString& ); diff --git a/src/QDS/QDS_CheckBox.h b/src/QDS/QDS_CheckBox.h index 9be0dde19..f64c1f368 100644 --- a/src/QDS/QDS_CheckBox.h +++ b/src/QDS/QDS_CheckBox.h @@ -28,7 +28,7 @@ class QDS_EXPORT QDS_CheckBox : public QDS_Datum Q_OBJECT public: - QDS_CheckBox( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_CheckBox( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_CheckBox(); bool isChecked() const; diff --git a/src/QDS/QDS_ComboBox.h b/src/QDS/QDS_ComboBox.h index 25f4c423d..f08910ce7 100644 --- a/src/QDS/QDS_ComboBox.h +++ b/src/QDS/QDS_ComboBox.h @@ -38,7 +38,7 @@ class QDS_EXPORT QDS_ComboBox : public QDS_Datum Q_OBJECT public: - QDS_ComboBox( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_ComboBox( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_ComboBox(); bool editable() const; diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index 04b3ca1d7..81e944e91 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -1339,7 +1339,7 @@ void QDS_Datum::unitSystemChanged( const QString& unitSystem ) labText = unitText; else if ( !unitText.isEmpty() ) labText = QString( "%1 (%2)" ).arg( labText ).arg( unitText ); - unitText = QString::null; + unitText = QString(); } if ( labelWidget() ) @@ -1683,7 +1683,7 @@ QString QDS_Datum::canonicalFormat( const QString& fmt ) QString QDS_Datum::canonicalFormat( const QString& fmt, QString& flags ) { QString newFmt = fmt; - flags = QString::null; + flags = QString(); QRegExp rx( "^(%[0-9]*.?[0-9]*)([a-z,A-Z]+)[g|c|d|i|o|u|x|e|f|n|p|s|X|E|G]$" ); if ( rx.indexIn( newFmt ) >= 0 ) @@ -1720,7 +1720,7 @@ QString QDS_Datum::units( const QString& id ) */ QString QDS_Datum::prefix() const { - return QString::null; + return QString(); } /*! @@ -1729,7 +1729,7 @@ QString QDS_Datum::prefix() const */ QString QDS_Datum::suffix() const { - return QString::null; + return QString(); } /*! @@ -1777,7 +1777,7 @@ QString QDS_Datum::maxValue() const */ void QDS_Datum::invalidateCache() { - myTargetValue = QString::null; + myTargetValue = QString(); } /*! diff --git a/src/QDS/QDS_Datum.h b/src/QDS/QDS_Datum.h index f0748f3e9..c42e92241 100644 --- a/src/QDS/QDS_Datum.h +++ b/src/QDS/QDS_Datum.h @@ -41,7 +41,7 @@ class QDS_EXPORT QDS_Datum : public QObject, public QDS class Wrapper; public: - QDS_Datum( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_Datum( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_Datum(); QString id() const; @@ -93,8 +93,8 @@ public: void setFocus(); virtual bool isValid( const bool = true, - const QString& = QString::null, - const QString& = QString::null ) const; + const QString& = QString(), + const QString& = QString() ) const; virtual QValidator* validator( const bool = false ) const; void addTo( QVBoxLayout* ); diff --git a/src/QDS/QDS_LineEdit.h b/src/QDS/QDS_LineEdit.h index 293e57eed..8b13d6a39 100644 --- a/src/QDS/QDS_LineEdit.h +++ b/src/QDS/QDS_LineEdit.h @@ -33,7 +33,7 @@ protected: class Editor; public: - QDS_LineEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_LineEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_LineEdit(); virtual void deselect(); diff --git a/src/QDS/QDS_RadioBox.h b/src/QDS/QDS_RadioBox.h index 32d0f6f93..3863e905e 100644 --- a/src/QDS/QDS_RadioBox.h +++ b/src/QDS/QDS_RadioBox.h @@ -39,7 +39,7 @@ class QDS_EXPORT QDS_RadioBox : public QDS_Datum Q_OBJECT public: - QDS_RadioBox( const QString&, QWidget* = 0, const int = Control, const QString& = QString::null ); + QDS_RadioBox( const QString&, QWidget* = 0, const int = Control, const QString& = QString() ); virtual ~QDS_RadioBox(); int count( bool = false ) const; diff --git a/src/QDS/QDS_SpinBox.h b/src/QDS/QDS_SpinBox.h index f0456900e..672c4c70f 100644 --- a/src/QDS/QDS_SpinBox.h +++ b/src/QDS/QDS_SpinBox.h @@ -28,7 +28,7 @@ class QDS_EXPORT QDS_SpinBox : public QDS_Datum Q_OBJECT public: - QDS_SpinBox( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_SpinBox( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_SpinBox(); int step() const; diff --git a/src/QDS/QDS_SpinBoxDbl.h b/src/QDS/QDS_SpinBoxDbl.h index e801d6c5b..5181940e3 100644 --- a/src/QDS/QDS_SpinBoxDbl.h +++ b/src/QDS/QDS_SpinBoxDbl.h @@ -28,7 +28,7 @@ class QDS_EXPORT QDS_SpinBoxDbl : public QDS_Datum Q_OBJECT public: - QDS_SpinBoxDbl( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_SpinBoxDbl( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_SpinBoxDbl(); double step() const; diff --git a/src/QDS/QDS_TextEdit.h b/src/QDS/QDS_TextEdit.h index 469fbaa36..9589b135c 100644 --- a/src/QDS/QDS_TextEdit.h +++ b/src/QDS/QDS_TextEdit.h @@ -28,7 +28,7 @@ class QDS_EXPORT QDS_TextEdit : public QDS_Datum Q_OBJECT public: - QDS_TextEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString::null ); + QDS_TextEdit( const QString&, QWidget* = 0, const int = All, const QString& = QString() ); virtual ~QDS_TextEdit(); signals: diff --git a/src/ResExporter/ResourceExporter.cxx b/src/ResExporter/ResourceExporter.cxx index 8a086bf1d..bdb5a157a 100644 --- a/src/ResExporter/ResourceExporter.cxx +++ b/src/ResExporter/ResourceExporter.cxx @@ -59,13 +59,13 @@ static QString salomeVersion() QFile vf( path ); if ( !vf.open( QIODevice::ReadOnly ) ) - return QString::null; + return QString(); QString line( vf.readLine( 1024 ) ); vf.close(); if ( line.isEmpty() ) - return QString::null; + return QString(); while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) line.remove( line.length() - 1, 1 ); diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h index ff9f9076b..20fd58317 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h @@ -113,8 +113,8 @@ public: int addGlobalPreference( const QString& ); int addPreference( const QString& ); int addPreference( const QString&, const int, const int = -1, - const QString& = QString::null, - const QString& = QString::null ); + const QString& = QString(), + const QString& = QString() ); QVariant preferenceProperty( const int, const QString& ) const; void setPreferenceProperty( const int, const QString&, const QVariant& ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index cef6a1a88..043363eb4 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -125,11 +125,11 @@ public: static int createMenu( const QString&, const int = -1, const int = -1, const int = -1, const int = -1 ); - static int createMenu( const QString&, const QString& = QString::null, + static int createMenu( const QString&, const QString& = QString(), const int = -1, const int = -1, const int = -1 ); static int createMenu( const int, const int = -1, const int = -1, const int = -1 ); - static int createMenu( const int, const QString& = QString::null, + static int createMenu( const int, const QString& = QString(), const int = -1, const int = -1 ); static int createMenu( QtxAction*, const int, const int = -1, const int = -1, const int = -1 ); @@ -139,8 +139,8 @@ public: static QtxAction* createSeparator(); static QtxAction* createAction( const int, const QString&, - const QString& = QString::null, const QString& = QString::null, - const QString& = QString::null, const int = 0, const bool = false ); + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const int = 0, const bool = false ); static QtxAction* action( const int ); static int actionId( const QtxAction* ); @@ -169,8 +169,8 @@ public: static int addPreference( const QString& ); static int addPreference( const QString&, const int, const int = -1, - const QString& = QString::null, - const QString& = QString::null ); + const QString& = QString(), + const QString& = QString() ); static QVariant preferenceProperty( const int, const QString& ); static void setPreferenceProperty( const int, const QString&, diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index ddc290a9f..81d76a9f1 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -135,8 +135,8 @@ public: static QtxAction* createSeparator() /ReleaseGIL/ ; static QtxAction* createAction( const int, const QString&, - const QString& = QString::null, const QString& = QString::null, - const QString& = QString::null, const int = 0, const bool = false ) /ReleaseGIL/ ; + const QString& = QString(), const QString& = QString(), + const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ; static QtxAction* action( const int ) /ReleaseGIL/ ; static int actionId( const QtxAction* ) /ReleaseGIL/ ; @@ -166,8 +166,8 @@ public: static int addPreference( const QString& ) /ReleaseGIL/ ; static int addPreference( const QString&, const int, const int = -1, - const QString& = QString::null, - const QString& = QString::null ) /ReleaseGIL/ ; + const QString& = QString(), + const QString& = QString() ) /ReleaseGIL/ ; static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ; static void setPreferenceProperty( const int, const QString&, diff --git a/src/SOCC/SOCC_Prs.cxx b/src/SOCC/SOCC_Prs.cxx index ad6f3154d..850c52a3b 100644 --- a/src/SOCC/SOCC_Prs.cxx +++ b/src/SOCC/SOCC_Prs.cxx @@ -72,6 +72,14 @@ void SOCC_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj ) myObjects.Append( obj ); } +/*! + Remove all interactive objects +*/ +void SOCC_Prs::Clear() +{ + myObjects.Clear(); +} + /*! \return 0 if list of the interactive objects is empty [ Reimplemented from SALOME_Prs ] */ diff --git a/src/SOCC/SOCC_Prs.h b/src/SOCC/SOCC_Prs.h index 60dca4b3b..36435ae33 100644 --- a/src/SOCC/SOCC_Prs.h +++ b/src/SOCC/SOCC_Prs.h @@ -52,6 +52,9 @@ public: void AddObject( const Handle(AIS_InteractiveObject)& obj ); // Add interactive object + void Clear(); + // Remove all interactive objects + bool IsNull() const; // Reimplemented from SALOME_Prs diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index be51cafa0..234a2932e 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -586,7 +586,7 @@ void SalomeApp_Application::onDeleteInvalidReferences() { SALOME_ListIO aList; LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects( aList, QString::null, false ); + mgr->selectedObjects( aList, QString(), false ); if( aList.IsEmpty() ) return; @@ -1057,7 +1057,7 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QMenu* thePop // Get selected objects SALOME_ListIO aList; LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects( aList, QString::null, false ); + mgr->selectedObjects( aList, QString(), false ); // add GUI state commands: restore, rename if ( aList.Extent() == 1 && aList.First()->hasEntry() && diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index 8bdc3502f..1c2926425 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -374,45 +374,9 @@ bool SalomeApp_DataObject::customSorting( const int index ) const bool SalomeApp_DataObject::compare( const QVariant& left, const QVariant& right, const int index ) const { - if ( index == EntryIdx || index == RefEntryIdx ) { - // perform custom sorting for the "Entry" and "Reference Entry" columns - QString leftStr = left.toString(); - QString rightStr = right.toString(); - QStringList idsLeft = leftStr.split( ":", QString::SkipEmptyParts ); - QStringList idsRight = rightStr.split( ":", QString::SkipEmptyParts ); - if ( idsLeft.count() > 1 || idsRight.count() > 1 ) { - bool result = true; - bool calculated = false; - for ( int i = 0; i < idsLeft.count() || i < idsRight.count(); i++ ) { - bool okLeft = true, okRight = true; - int lid = 0, rid = 0; - if ( i < idsLeft.count() ) - lid = idsLeft[i].toInt( &okLeft ); - if ( i < idsRight.count() ) - rid = idsRight[i].toInt( &okRight ); - if ( okLeft && okRight ) { - // both seem to be correct integer ID - return lid < rid; - } - else if ( okLeft || okRight ) { - // objects with correct (int) ID have higher priority - return okLeft; - } - else { - // both not integer ID - int r = QString::localeAwareCompare( idsLeft[i], idsRight[i] ); - if ( !calculated && r != 0 ) { - result = r < 0; - calculated = true; - } - } - } - // we should reach this if the entries are exactly equal - return result; - } - return QString::localeAwareCompare( leftStr, rightStr ) < 0; - } - return LightApp_DataObject::compare( left, right, index ); + // use the same custom sorting for the "Reference Entry" column as for the + // "Entry" column (call base implementation) + return LightApp_DataObject::compare( left, right, index == RefEntryIdx ? EntryIdx : index ); } /*! diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 111284dae..18a313b96 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -127,14 +127,14 @@ QString salomeVersion() QFile vf( path ); if ( !vf.open( QIODevice::ReadOnly ) ) - return QString::null; + return QString(); QString line( vf.readLine( 1024 ) ); vf.close(); if ( line.isEmpty() ) - return QString::null; + return QString(); while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) line.remove( line.length() - 1, 1 ); @@ -219,8 +219,8 @@ public: static QString myExtAppVersion; }; -QString SALOME_ResourceMgr::myExtAppName = QString::null; -QString SALOME_ResourceMgr::myExtAppVersion = QString::null; +QString SALOME_ResourceMgr::myExtAppName = QString(); +QString SALOME_ResourceMgr::myExtAppVersion = QString(); class SALOME_Session : public SUIT_Session { @@ -321,57 +321,20 @@ int main( int argc, char **argv ) SUIT_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) ); resMgr.setCurrentFormat( "xml" ); resMgr.loadLanguage( "LightApp", "en" ); - // ...get splash preferences - QString splashIcon, splashInfo, splashTextColors, splashProgressColors; - resMgr.value( "splash", "image", splashIcon ); - resMgr.value( "splash", "info", splashInfo, false ); - resMgr.value( "splash", "text_colors", splashTextColors ); - resMgr.value( "splash", "progress_colors", splashProgressColors ); - QPixmap px( splashIcon ); - if ( px.isNull() ) // try to get splash pixmap from resources - px = resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) ); - if ( !px.isNull() ) { - // ...set splash pixmap - splash = QtxSplash::splash( px ); - // ...set splash text colors - if ( !splashTextColors.isEmpty() ) { - QStringList colors = splashTextColors.split( "|", QString::SkipEmptyParts ); - QColor c1, c2; - if ( colors.count() > 0 ) c1 = QColor( colors[0] ); - if ( colors.count() > 1 ) c2 = QColor( colors[1] ); - splash->setTextColors( c1, c2 ); - } - else { - splash->setTextColors( Qt::white, Qt::black ); - } - // ...set splash progress colors - if ( !splashProgressColors.isEmpty() ) { - QStringList colors = splashProgressColors.split( "|", QString::SkipEmptyParts ); - QColor c1, c2; - QtxSplash::GradientType gradType = QtxSplash::Vertical; - if ( colors.count() > 0 ) c1 = QColor( colors[0] ); - if ( colors.count() > 1 ) c2 = QColor( colors[1] ); - if ( colors.count() > 2 ) gradType = QtxSplash::GradientType( colors[2].toInt() ); - splash->setProgressColors( c1, c2, gradType ); - } - // ...set splash text font - QFont f = splash->font(); - f.setBold( true ); - splash->setFont( f ); - // ...show splash initial status - if ( !splashInfo.isEmpty() ) { - splashInfo.replace( QRegExp( "%A" ), QObject::tr( "APP_NAME" ) ); - splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( salomeVersion() ) ); - splashInfo.replace( QRegExp( "%L" ), QObject::tr( "ABOUT_LICENSE" ) ); - splashInfo.replace( QRegExp( "%C" ), QObject::tr( "ABOUT_COPYRIGHT" ) ); - splashInfo.replace( QRegExp( "\\\\n" ), "\n" ); - splash->setConstantInfo( splashInfo ); - } - // ...set 'hide on click' flag -#ifdef _DEBUG_ - splash->setHideOnClick( true ); -#endif - // ...show splash + // + splash = QtxSplash::splash( QPixmap() ); + splash->readSettings( &resMgr ); + if ( splash->pixmap().isNull() ) + splash->setPixmap( resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) ) ); + if ( splash->pixmap().isNull() ) { + delete splash; + splash = 0; + } + else { + splash->setOption( "%A", QObject::tr( "APP_NAME" ) ); + splash->setOption( "%V", QObject::tr( "ABOUT_VERSION" ).arg( salomeVersion() ) ); + splash->setOption( "%L", QObject::tr( "ABOUT_LICENSE" ) ); + splash->setOption( "%C", QObject::tr( "ABOUT_COPYRIGHT" ) ); splash->show(); QApplication::instance()->processEvents(); } @@ -500,7 +463,8 @@ int main( int argc, char **argv ) if ( !result ) { // Launch GUI activator if ( isGUI ) { - splash->setStatus( QApplication::translate( "", "Activating desktop..." ) ); + if ( splash ) + splash->setStatus( QApplication::translate( "", "Activating desktop..." ) ); // ...retrieve Session interface reference CORBA::Object_var obj = _NS->Resolve( "/Kernel/Session" ); SALOME::Session_var session = SALOME::Session::_narrow( obj ) ; @@ -545,8 +509,7 @@ int main( int argc, char **argv ) result = _qappl.exec(); - if ( splash ) - delete splash; + delete splash; splash = 0; if ( result == SUIT_Session::FROM_GUI ) // desktop is closed by user from GUI -- 2.39.2