From: stv Date: Thu, 21 Jul 2005 07:44:38 +0000 (+0000) Subject: Preferences improvements. Empty categories not shown. X-Git-Tag: V3_0_1~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cde24ab6ca94b8be7b308d118ae252c124100032;p=modules%2Fgui.git Preferences improvements. Empty categories not shown. --- diff --git a/src/Qtx/QtxListResourceEdit.cxx b/src/Qtx/QtxListResourceEdit.cxx index de13a8e59..d2d99355a 100644 --- a/src/Qtx/QtxListResourceEdit.cxx +++ b/src/Qtx/QtxListResourceEdit.cxx @@ -56,13 +56,51 @@ QtxListResourceEdit::~QtxListResourceEdit() { } +void QtxListResourceEdit::setItemProperty( const int id, const QString& prop, const QVariant& val ) +{ + Item* i = item( id ); + if ( !i ) + return; + + bool prev = i->isEmpty(); + + QtxResourceEdit::setItemProperty( id, prop, val ); + + bool next = i->isEmpty(); + + if ( prev != next ) + updateVisible(); +} + void QtxListResourceEdit::onSelectionChanged() { - int idx = myList->index( myList->selectedItem() ); - if ( idx < 0 ) + QString title = myList->text( myList->index( myList->selectedItem() ) ); + if ( title.isEmpty() ) return; - myStack->raiseWidget( idx ); + Item* i = 0; + QPtrList lst; + childItems( lst ); + for ( QPtrListIterator it( lst ); it.current() && !i; ++it ) + { + if ( it.current()->title() == title ) + i = it.current(); + } + + if ( i ) + myStack->raiseWidget( i->id() ); +} + +void QtxListResourceEdit::itemAdded( QtxResourceEdit::Item* i ) +{ + if ( !i ) + return; + + QPtrList items; + childItems( items ); + + if ( items.contains( i ) || items.contains( i->parentItem() ) ) + updateVisible(); } QtxResourceEdit::Item* QtxListResourceEdit::createItem( const QString& title, const int ) @@ -72,9 +110,9 @@ QtxResourceEdit::Item* QtxListResourceEdit::createItem( const QString& title, co return i; Category* category = new Category( this, myStack ); - myList->insertItem( title ); - int id = myList->count() - 1; - myStack->addWidget( category, id ); + myStack->addWidget( category, category->id() ); + + updateVisible(); if ( !myList->selectedItem() ) myList->setSelected( 0, true ); @@ -103,12 +141,40 @@ void QtxListResourceEdit::changedResources( const QMap& map ) void QtxListResourceEdit::updateState() { - if ( myStack->visibleWidget() ) + if ( myList->selectedItem() && myStack->visibleWidget() ) myStack->show(); else myStack->hide(); } +void QtxListResourceEdit::updateVisible() +{ + QPtrList items; + childItems( items ); + + QString name = myList->text( myList->index( myList->selectedItem() ) ); + + myList->clear(); + for ( QPtrListIterator it( items ); it.current(); ++it ) + { + if ( it.current()->isEmpty() ) + continue; + + myList->insertItem( it.current()->title() ); + } + + int idx = -1; + for ( int i = 0; i < (int)myList->count() && idx == -1; i++ ) + { + if ( myList->text( i ) == name ) + idx = i; + } + + myList->setSelected( QMAX( idx, 0 ), true ); + + updateState(); +} + /* Class: QtxListResourceEdit::Category Descr: GUI implementation of preferences category. @@ -138,6 +204,11 @@ QtxListResourceEdit::Category::~Category() { } +bool QtxListResourceEdit::Category::isEmpty() const +{ + return Item::isEmpty() && myInfo->text().isEmpty(); +} + int QtxListResourceEdit::Category::type() const { return -1; @@ -309,6 +380,10 @@ QVariant QtxListResourceEdit::Group::property( const QString& prop ) const QVariant var; if ( prop == "columns" ) var = QVariant( columns() ); + else if ( prop == "orientation" ) + var = QVariant( orientation() ); + else if ( prop == "frame" ) + var = QVariant( frameStyle() != QFrame::NoFrame ); return var; } @@ -318,8 +393,20 @@ void QtxListResourceEdit::Group::setProperty( const QString& name, const QVarian if ( !prop.cast( QVariant::Int ) ) return; - if ( name == QString( "columns" ) && prop.toInt() > 0 ) + if ( name == QString( "columns" ) && prop.cast( QVariant::Int ) && prop.toInt() > 0 ) setColumns( prop.toInt() ); + else if ( name == QString( "orientation" ) && prop.cast( QVariant::Int ) ) + { + int o = prop.toInt(); + if ( o == Qt::Horizontal || o == Qt::Vertical ) + setOrientation( (Orientation)o ); + } + else if ( name == "frame" && prop.cast( QVariant::Bool ) ) + { + setInsideMargin( prop.toBool() ? 5 : 0 ); + QGroupBox::setTitle( prop.toBool() ? Item::title() : QString::null ); + setFrameStyle( prop.toBool() ? QFrame::Box | QFrame::Sunken : QFrame::NoFrame ); + } } void QtxListResourceEdit::Group::setTitle( const QString& title ) @@ -344,7 +431,7 @@ QtxResourceEdit::Item* QtxListResourceEdit::Group::createItem( const QString& ti item = new StringItem( title, resourceEdit(), this, this ); break; case Selector: - item = new ListItem( title, resourceEdit(), this, this ); + item = new SelectItem( title, resourceEdit(), this, this ); break; case DblSpin: item = new DoubleSpinItem( title, resourceEdit(), this, this ); @@ -361,6 +448,9 @@ QtxResourceEdit::Item* QtxListResourceEdit::Group::createItem( const QString& ti case Space: item = new Spacer( resourceEdit(), this, this ); break; + case GroupBox: + item = new Group( title, resourceEdit(), this, this ); + break; case Font: item = new FontItem( title, resourceEdit(), this, this ); break; @@ -420,12 +510,12 @@ void QtxListResourceEdit::Spacer::retrieve() } /* - Class: QtxListResourceEdit::ListItem + Class: QtxListResourceEdit::SelectItem Descr: GUI implementation of resources list item. */ -QtxListResourceEdit::ListItem::ListItem( const QString& title, QtxResourceEdit* edit, - Item* pItem, QWidget* parent ) +QtxListResourceEdit::SelectItem::SelectItem( const QString& title, QtxResourceEdit* edit, + Item* pItem, QWidget* parent ) : PrefItem( Selector, edit, pItem, parent ) { new QLabel( title, this ); @@ -433,18 +523,18 @@ QtxListResourceEdit::ListItem::ListItem( const QString& title, QtxResourceEdit* myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); } -QtxListResourceEdit::ListItem::~ListItem() +QtxListResourceEdit::SelectItem::~SelectItem() { } -void QtxListResourceEdit::ListItem::store() +void QtxListResourceEdit::SelectItem::store() { int idx = myList->currentItem(); if ( myIndex.contains( idx ) ) setInteger( myIndex[idx] ); } -void QtxListResourceEdit::ListItem::retrieve() +void QtxListResourceEdit::SelectItem::retrieve() { int id = getInteger( -1 ); @@ -458,7 +548,7 @@ void QtxListResourceEdit::ListItem::retrieve() myList->setCurrentItem( idx ); } -QVariant QtxListResourceEdit::ListItem::property( const QString& name ) const +QVariant QtxListResourceEdit::SelectItem::property( const QString& name ) const { QVariant val; if ( name == QString( "strings" ) ) @@ -478,7 +568,7 @@ QVariant QtxListResourceEdit::ListItem::property( const QString& name ) const return val; } -void QtxListResourceEdit::ListItem::setProperty( const QString& name, const QVariant& val ) +void QtxListResourceEdit::SelectItem::setProperty( const QString& name, const QVariant& val ) { if ( name == QString( "strings" ) ) setStrings( val ); @@ -486,7 +576,7 @@ void QtxListResourceEdit::ListItem::setProperty( const QString& name, const QVar setIndexes( val ); } -void QtxListResourceEdit::ListItem::setStrings( const QVariant& var ) +void QtxListResourceEdit::SelectItem::setStrings( const QVariant& var ) { if ( var.type() != QVariant::StringList ) return; @@ -494,7 +584,7 @@ void QtxListResourceEdit::ListItem::setStrings( const QVariant& var ) setStrings( var.toStringList() ); } -void QtxListResourceEdit::ListItem::setIndexes( const QVariant& var ) +void QtxListResourceEdit::SelectItem::setIndexes( const QVariant& var ) { if ( var.type() != QVariant::List ) return; @@ -509,13 +599,13 @@ void QtxListResourceEdit::ListItem::setIndexes( const QVariant& var ) setIndexes( lst ); } -void QtxListResourceEdit::ListItem::setStrings( const QStringList& lst ) +void QtxListResourceEdit::SelectItem::setStrings( const QStringList& lst ) { myList->clear(); myList->insertStringList( lst ); } -void QtxListResourceEdit::ListItem::setIndexes( const QValueList& lst ) +void QtxListResourceEdit::SelectItem::setIndexes( const QValueList& lst ) { myIndex.clear(); @@ -643,22 +733,31 @@ QVariant QtxListResourceEdit::IntegerSpinItem::property( const QString& name ) c var = QVariant( myInteger->maxValue() ); else if ( name == QString( "step" ) ) var = QVariant( myInteger->lineStep() ); + else if ( name == QString( "special" ) ) + var = QVariant( myInteger->specialValueText() ); + else if ( name == QString( "prefix" ) ) + var = QVariant( myInteger->prefix() ); + else if ( name == QString( "suffix" ) ) + var = QVariant( myInteger->suffix() ); return var; } void QtxListResourceEdit::IntegerSpinItem::setProperty( const QString& name, const QVariant& var ) { QVariant prop = var; - if ( !prop.cast( QVariant::Int ) ) - return; - int val = prop.toInt(); - if ( name == QString( "minimum" ) || name == QString( "min" ) ) - myInteger->setMinValue( val ); - else if ( name == QString( "maximum" ) || name == QString( "max" ) ) - myInteger->setMaxValue( val ); - else if ( name == QString( "step" ) && val > 0 ) - myInteger->setLineStep( val ); + if ( ( name == QString( "minimum" ) || name == QString( "min" ) ) && prop.cast( QVariant::Int ) ) + myInteger->setMinValue( prop.toInt() ); + else if ( ( name == QString( "maximum" ) || name == QString( "max" ) ) && prop.cast( QVariant::Int ) ) + myInteger->setMaxValue( prop.toInt() ); + else if ( name == QString( "step" ) && prop.cast( QVariant::Int ) && prop.toInt() > 0 ) + myInteger->setLineStep( prop.toInt() ); + else if ( name == QString( "special" ) && prop.cast( QVariant::String ) ) + myInteger->setSpecialValueText( prop.toString() ); + else if ( name == QString( "prefix" ) && prop.cast( QVariant::String ) ) + myInteger->setPrefix( prop.toString() ); + else if ( name == QString( "suffix" ) && prop.cast( QVariant::String ) ) + myInteger->setSuffix( prop.toString() ); } /* @@ -729,28 +828,33 @@ QVariant QtxListResourceEdit::DoubleSpinItem::property( const QString& name ) co var = QVariant( myDouble->precision() ); else if ( name == QString( "step" ) ) var = QVariant( myDouble->lineStep() ); + else if ( name == QString( "special" ) ) + var = QVariant( myDouble->specialValueText() ); + else if ( name == QString( "prefix" ) ) + var = QVariant( myDouble->prefix() ); + else if ( name == QString( "suffix" ) ) + var = QVariant( myDouble->suffix() ); return var; } void QtxListResourceEdit::DoubleSpinItem::setProperty( const QString& name, const QVariant& var ) { QVariant prop = var; - if ( prop.cast( QVariant::Double ) ) - { - double val = prop.toDouble(); - if ( name == QString( "minimum" ) || name == QString( "min" ) ) - myDouble->setMinValue( val ); - else if ( name == QString( "maximum" ) || name == QString( "max" ) ) - myDouble->setMaxValue( val ); - else if ( name == QString( "step" ) && val > 0 ) - myDouble->setLineStep( val ); - } - else - { - QVariant prop = var; - if ( prop.cast( QVariant::Int ) && name == QString( "precision" ) && prop.toInt() > 0 ) - myDouble->setPrecision( prop.toInt() ); - } + + if ( ( name == QString( "minimum" ) || name == QString( "min" ) ) && prop.cast( QVariant::Double ) ) + myDouble->setMinValue( prop.toDouble() ); + else if ( ( name == QString( "maximum" ) || name == QString( "max" ) ) && prop.cast( QVariant::Double ) ) + myDouble->setMaxValue( prop.toDouble() ); + else if ( name == QString( "step" ) && prop.cast( QVariant::Double ) && prop.toDouble() > 0 ) + myDouble->setLineStep( prop.toDouble() ); + else if ( name == QString( "precision" ) && prop.cast( QVariant::Int ) && prop.toInt() > 0 ) + myDouble->setPrecision( prop.toInt() ); + else if ( name == QString( "special" ) && prop.cast( QVariant::String ) ) + myDouble->setSpecialValueText( prop.toString() ); + else if ( name == QString( "prefix" ) && prop.cast( QVariant::String ) ) + myDouble->setPrefix( prop.toString() ); + else if ( name == QString( "suffix" ) && prop.cast( QVariant::String ) ) + myDouble->setSuffix( prop.toString() ); } /* diff --git a/src/Qtx/QtxListResourceEdit.h b/src/Qtx/QtxListResourceEdit.h index 13afe8187..3dfe65f74 100644 --- a/src/Qtx/QtxListResourceEdit.h +++ b/src/Qtx/QtxListResourceEdit.h @@ -38,9 +38,9 @@ public: class PrefItem; class Spacer; - class ListItem; class ColorItem; class StateItem; + class SelectItem; class StringItem; class DoubleSpinItem; class DoubleEditItem; @@ -48,12 +48,14 @@ public: class IntegerEditItem; class FontItem; - enum { Space, Bool, Color, String, Selector, DblSpin, IntSpin, Double, Integer, Font, User }; + enum { Space, Bool, Color, String, Selector, DblSpin, IntSpin, Double, Integer, GroupBox, Font, User }; public: QtxListResourceEdit( QtxResourceMgr*, QWidget* = 0 ); virtual ~QtxListResourceEdit(); + virtual void setItemProperty( const int, const QString&, const QVariant& ); + signals: void resourceChanged( int ); void resourceChanged( QString&, QString& ); @@ -63,11 +65,13 @@ private slots: void onSelectionChanged(); protected: + virtual void itemAdded( Item* ); virtual Item* createItem( const QString&, const int ); virtual void changedResources( const QMap& ); private: void updateState(); + void updateVisible(); private: QListBox* myList; @@ -85,6 +89,8 @@ public: Category( QtxListResourceEdit*, QWidget* = 0 ); virtual ~Category(); + virtual bool isEmpty() const; + virtual int type() const; virtual void store(); virtual void retrieve(); @@ -191,15 +197,15 @@ public: }; /* - Class: QtxListResourceEdit::ListItem - Descr: GUI implementation of resources list item. + Class: QtxListResourceEdit::SelectItem + Descr: GUI implementation of resources selector item. */ -class QtxListResourceEdit::ListItem : public PrefItem +class QtxListResourceEdit::SelectItem : public PrefItem { public: - ListItem( const QString&, QtxResourceEdit*, Item*, QWidget* = 0 ); - virtual ~ListItem(); + SelectItem( const QString&, QtxResourceEdit*, Item*, QWidget* = 0 ); + virtual ~SelectItem(); virtual void store(); virtual void retrieve(); diff --git a/src/Qtx/QtxResourceEdit.cxx b/src/Qtx/QtxResourceEdit.cxx index f9c9a4a6c..d64edee3a 100644 --- a/src/Qtx/QtxResourceEdit.cxx +++ b/src/Qtx/QtxResourceEdit.cxx @@ -33,15 +33,23 @@ int QtxResourceEdit::addItem( const QString& label, const int pId, const int typ if ( !i ) return -1; - myItems.insert( i->id(), i ); + if ( !myItems.contains( i->id() ) ) + { + myItems.insert( i->id(), i ); + + i->setTitle( label ); + i->setResource( section, param ); - i->setTitle( label ); - i->setResource( section, param ); + if ( !i->parentItem() && !myChildren.contains( i ) ) + myChildren.append( i ); + + itemAdded( i ); + } return i->id(); } -QVariant QtxResourceEdit::property( const int id, const QString& propName ) const +QVariant QtxResourceEdit::itemProperty( const int id, const QString& propName ) const { QVariant propValue; Item* i = item( id ); @@ -50,7 +58,7 @@ QVariant QtxResourceEdit::property( const int id, const QString& propName ) cons return propValue; } -void QtxResourceEdit::setProperty( const int id, const QString& propName, const QVariant& propValue ) +void QtxResourceEdit::setItemProperty( const int id, const QString& propName, const QVariant& propValue ) { Item* i = item( id ); if ( i ) @@ -153,7 +161,10 @@ QtxResourceEdit::Item* QtxResourceEdit::createItem( const QString& label, const { Item* pItem = item( pId ); if ( pItem ) + { i = pItem->createItem( label, type ); + pItem->insertChild( i ); + } } return i; @@ -164,7 +175,17 @@ void QtxResourceEdit::removeItem( Item* item ) if ( !item ) return; + myChildren.remove( item ); myItems.remove( item->id() ); + + itemRemoved( item ); +} + +void QtxResourceEdit::childItems( QPtrList& lst ) const +{ + lst.clear(); + for ( QPtrListIterator it( myChildren ); it.current(); ++it ) + lst.append( it.current() ); } void QtxResourceEdit::resourceValues( QMap& map ) const @@ -228,6 +249,14 @@ void QtxResourceEdit::changedResources( const QMap& ) { } +void QtxResourceEdit::itemAdded( Item* ) +{ +} + +void QtxResourceEdit::itemRemoved( Item* ) +{ +} + /* Class: QtxResourceEdit::Item Descr: Class for incapsulation of one preference item @@ -235,9 +264,12 @@ void QtxResourceEdit::changedResources( const QMap& ) QtxResourceEdit::Item::Item( QtxResourceEdit* edit, Item* parent ) : myEdit( edit ), -myParent( parent ) +myParent( 0 ) { myId = generateId(); + + if ( parent ) + parent->insertChild( this ); } QtxResourceEdit::Item::~Item() @@ -256,12 +288,38 @@ QtxResourceEdit::Item* QtxResourceEdit::Item::parentItem() const return myParent; } +void QtxResourceEdit::Item::insertChild( Item* item ) +{ + if ( !item || myChildren.contains( item ) ) + return; + + if ( item->parentItem() && item->parentItem() != this ) + item->parentItem()->removeChild( item ); + + item->myParent = this; + myChildren.append( item ); +} + +void QtxResourceEdit::Item::removeChild( Item* item ) +{ + if ( !item || !myChildren.contains( item ) ) + return; + + myChildren.remove( item ); + item->myParent = 0; +} + void QtxResourceEdit::Item::childItems( QPtrList& lst ) const { for ( ItemListIterator it( myChildren ); it.current(); ++it ) lst.append( it.current() ); } +bool QtxResourceEdit::Item::isEmpty() const +{ + return myChildren.isEmpty(); +} + QString QtxResourceEdit::Item::title() const { return myTitle; diff --git a/src/Qtx/QtxResourceEdit.h b/src/Qtx/QtxResourceEdit.h index fe5444989..3aaca30d6 100644 --- a/src/Qtx/QtxResourceEdit.h +++ b/src/Qtx/QtxResourceEdit.h @@ -32,8 +32,8 @@ public: const QString& section = QString::null, const QString& param = QString::null ); - QVariant property( const int, const QString& ) const; - virtual void setProperty( const int, const QString&, const QVariant& ); + QVariant itemProperty( const int, const QString& ) const; + virtual void setItemProperty( const int, const QString&, const QVariant& ); void resource( const int, QString&, QString& ) const; @@ -65,6 +65,11 @@ protected: virtual void changedResources( const QMap& ); + virtual void itemAdded( Item* ); + virtual void itemRemoved( Item* ); + + void childItems( QPtrList& ) const; + private: void removeItem( Item* ); Item* createItem( const QString&, const int, const int ); @@ -76,6 +81,7 @@ private: ItemMap myItems; QtxResourceMgr* myResMgr; QMap myBackup; + QPtrList myChildren; friend class QtxResourceEdit::Item; }; @@ -97,6 +103,8 @@ public: Item* parentItem() const; void childItems( QPtrList& ) const; + virtual bool isEmpty() const; + QString title() const; void resource( QString&, QString& ) const; @@ -116,6 +124,9 @@ public: QString resourceValue() const; void setResourceValue( const QString& ); + virtual void insertChild( Item* ); + virtual void removeChild( Item* ); + protected: QtxResourceMgr* resourceMgr() const; QtxResourceEdit* resourceEdit() const; diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index fb93e82da..df8311669 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1251,7 +1251,7 @@ SalomeApp_Preferences* SalomeApp_Application::preferences( const bool crt ) cons for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it ) { int id = _prefs_->addPreference( *it ); - _prefs_->setProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ).arg( *it ) ); + _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ).arg( *it ) ); } ModuleList modList; @@ -1263,7 +1263,11 @@ SalomeApp_Preferences* SalomeApp_Application::preferences( const bool crt ) cons mod = (SalomeApp_Module*)itr.current(); if ( mod && !_prefs_->hasModule( mod->moduleName() ) ) + { + int modCat = _prefs_->addPreference( mod->moduleName() ); + _prefs_->setItemProperty( modCat, "info", QString::null ); mod->createPreferences(); + } } } @@ -1281,8 +1285,12 @@ void SalomeApp_Application::moduleAdded( CAM_Module* mod ) if ( mod && mod->inherits( "SalomeApp_Module" ) ) salomeMod = (SalomeApp_Module*)mod; - if ( myPrefs && salomeMod && !myPrefs->hasModule( salomeMod->moduleName() )) + if ( myPrefs && salomeMod && !myPrefs->hasModule( salomeMod->moduleName() ) ) + { + int modCat = myPrefs->addPreference( mod->moduleName() ); + myPrefs->setItemProperty( modCat, "info", QString::null ); salomeMod->createPreferences(); + } } void SalomeApp_Application::createPreferences( SalomeApp_Preferences* pref ) @@ -1300,42 +1308,42 @@ void SalomeApp_Application::createPreferences( SalomeApp_Preferences* pref ) pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), obGroup, SalomeApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) ); } - pref->setProperty( obGroup, "columns", 1 ); + pref->setItemProperty( obGroup, "columns", 1 ); int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat ); int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab ); int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab ); - pref->setProperty( occGroup, "columns", 1 ); - pref->setProperty( vtkGroup, "columns", 1 ); + pref->setItemProperty( occGroup, "columns", 1 ); + pref->setItemProperty( vtkGroup, "columns", 1 ); int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup, SalomeApp_Preferences::IntSpin, "OCCViewer", "trihedron_size" ); pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup, SalomeApp_Preferences::Color, "OCCViewer", "background" ); - pref->setProperty( occTS, "min", 1 ); - pref->setProperty( occTS, "max", 150 ); + pref->setItemProperty( occTS, "min", 1 ); + pref->setItemProperty( occTS, "max", 150 ); int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup, SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" ); int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup, SalomeApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" ); - pref->setProperty( isoU, "min", 0 ); - pref->setProperty( isoU, "max", 100000 ); + pref->setItemProperty( isoU, "min", 0 ); + pref->setItemProperty( isoU, "max", 100000 ); - pref->setProperty( isoV, "min", 0 ); - pref->setProperty( isoV, "max", 100000 ); + pref->setItemProperty( isoV, "min", 0 ); + pref->setItemProperty( isoV, "max", 100000 ); int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup, SalomeApp_Preferences::IntSpin, "VTKViewer", "trihedron_size" ); pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, SalomeApp_Preferences::Color, "VTKViewer", "background" ); - pref->setProperty( vtkTS, "min", 1 ); - pref->setProperty( vtkTS, "max", 150 ); + pref->setItemProperty( vtkTS, "min", 1 ); + pref->setItemProperty( vtkTS, "max", 150 ); } void SalomeApp_Application::preferencesChanged( const QString& sec, const QString& param ) diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index 75e3a8491..3b09d2ddd 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -164,7 +164,7 @@ QVariant SalomeApp_Module::preferenceProperty( const int id, const QString& prop QVariant var; SalomeApp_Preferences* pref = preferences(); if ( pref ) - var = pref->property( id, prop ); + var = pref->itemProperty( id, prop ); return var; } @@ -172,5 +172,5 @@ void SalomeApp_Module::setPreferenceProperty( const int id, const QString& prop, { SalomeApp_Preferences* pref = preferences(); if ( pref ) - pref->setProperty( id, prop, var ); + pref->setItemProperty( id, prop, var ); } diff --git a/src/SalomeApp/SalomeApp_Preferences.cxx b/src/SalomeApp/SalomeApp_Preferences.cxx index 8175f3bda..e6c59a030 100755 --- a/src/SalomeApp/SalomeApp_Preferences.cxx +++ b/src/SalomeApp/SalomeApp_Preferences.cxx @@ -31,16 +31,6 @@ int SalomeApp_Preferences::addPreference( const QString& mod, const QString& lab return id; } -QVariant SalomeApp_Preferences::property( const int id, const QString& param ) const -{ - return QtxResourceEdit::property( id, param ); -} - -void SalomeApp_Preferences::setProperty( const int id, const QString& param, const QVariant& prop ) -{ - QtxResourceEdit::setProperty( id, param, prop ); -} - bool SalomeApp_Preferences::hasModule( const QString& mod ) const { bool res = false; diff --git a/src/SalomeApp/SalomeApp_Preferences.h b/src/SalomeApp/SalomeApp_Preferences.h index 9d76a908e..2319772c8 100755 --- a/src/SalomeApp/SalomeApp_Preferences.h +++ b/src/SalomeApp/SalomeApp_Preferences.h @@ -17,9 +17,6 @@ class SALOMEAPP_EXPORT SalomeApp_Preferences : public QtxListResourceEdit { Q_OBJECT -public: - enum { Space = QtxListResourceEdit::Space, Bool, Color, String, Selector, DblSpin, IntSpin, Double, Integer }; - public: SalomeApp_Preferences( QtxResourceMgr*, QWidget* = 0 ); virtual ~SalomeApp_Preferences(); @@ -29,9 +26,6 @@ public: int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = -1, const QString& section = QString::null, const QString& param = QString::null ); - QVariant property( const int, const QString& ) const; - virtual void setProperty( const int, const QString&, const QVariant& ); - bool hasModule( const QString& ) const; signals: