From: vsr Date: Sun, 8 Nov 2009 11:40:42 +0000 (+0000) Subject: 0020012: EDF 831 GEOM : API for points representation in 3D viewer X-Git-Tag: V5_1_3rc2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d5b47fe16ea2b56455e4f279e54f959158229679;p=modules%2Fgui.git 0020012: EDF 831 GEOM : API for points representation in 3D viewer --- diff --git a/src/Qtx/QtxPagePrefMgr.cxx b/src/Qtx/QtxPagePrefMgr.cxx index 780e83e07..35c84807d 100644 --- a/src/Qtx/QtxPagePrefMgr.cxx +++ b/src/Qtx/QtxPagePrefMgr.cxx @@ -2298,7 +2298,7 @@ void QtxPagePrefSelectItem::setInputType( const int type ) /*! \brief Get the list of the values from the selection widget. \return list of values - \sa numbers(), setStrings() + \sa numbers(), icons(), setStrings() */ QStringList QtxPagePrefSelectItem::strings() const { @@ -2311,7 +2311,7 @@ QStringList QtxPagePrefSelectItem::strings() const /*! \brief Get the list of the values identifiers from the selection widget. \return list of values IDs - \sa strings(), setNumbers() + \sa strings(), icons(), setNumbers() */ QList QtxPagePrefSelectItem::numbers() const { @@ -2325,25 +2325,22 @@ QList QtxPagePrefSelectItem::numbers() const } /*! - \brief Get the list of the graphic identifiers from the selection widget. - \return list of pixmaps - \sa icons(), setIcons() + \brief Get the list of the icons associated with the selection widget.items + \return list of icons + \sa strings(), numbers(), setIcons() */ QList QtxPagePrefSelectItem::icons() const { QList res; for ( uint i = 0; i < mySelector->count(); i++ ) - { - if ( mySelector->hasId( i ) ) - res.append( mySelector->itemIcon ( i ) ); - } + res.append( mySelector->itemIcon( i ) ); return res; } /*! \brief Set the list of the values to the selection widget. \param lst new list of values - \sa strings(), setNumbers() + \sa strings(), setNumbers(), setIcons() */ void QtxPagePrefSelectItem::setStrings( const QStringList& lst ) { @@ -2352,9 +2349,9 @@ void QtxPagePrefSelectItem::setStrings( const QStringList& lst ) } /*! - \brief Set the list of the values identifiers to the selection widget. + \brief Set the list of the values identifiers to the selection widget \param ids new list of values IDs - \sa numbers(), setStrings() + \sa numbers(), setStrings(), setIcons() */ void QtxPagePrefSelectItem::setNumbers( const QList& ids ) { @@ -2368,14 +2365,17 @@ void QtxPagePrefSelectItem::setNumbers( const QList& ids ) } /*! - \brief Set the list of the graphic identifiers to the selection widget. - \param pix new list of Icons - \sa icons(), setIcons() + \brief Set the list of the icons to the selection widget items + + Important: call this method after setStrings() or setNumbers() + + \param icns new list of icons + \sa icons(), setStrings(), setNumbers() */ -void QtxPagePrefSelectItem::setIcons( const QList& icons ) +void QtxPagePrefSelectItem::setIcons( const QList& icns ) { uint i = 0; - for ( QList::const_iterator it = icons.begin(); it != icons.end() && i < mySelector->count(); ++it, i++ ) + for ( QList::const_iterator it = icns.begin(); it != icns.end() && i < mySelector->count(); ++it, i++ ) mySelector->setItemIcon( i, *it ); } @@ -2455,12 +2455,12 @@ QVariant QtxPagePrefSelectItem::optionValue( const QString& name ) const for ( QList::const_iterator it = nums.begin(); it != nums.end(); ++it ) lst.append( *it ); return lst; - } else if ( name == "icons" ) + } + else if ( name == "icons" || name == "pixmaps" ) { QList lst; - QList ico; - ico = icons(); - for ( QList::const_iterator it = ico.begin(); it != ico.end(); ++it ) + QList ics = icons(); + for ( QList::const_iterator it = ics.begin(); it != ics.end(); ++it ) lst.append( *it ); return lst; } @@ -2485,7 +2485,7 @@ void QtxPagePrefSelectItem::setOptionValue( const QString& name, const QVariant& setStrings( val ); else if ( name == "numbers" || name == "ids" || name == "indexes" ) setNumbers( val ); - else if ( name == "icons" ) + else if ( name == "icons" || name == "pixmaps" ) setIcons( val ); else QtxPageNamedPrefItem::setOptionValue( name, val ); @@ -2525,7 +2525,7 @@ void QtxPagePrefSelectItem::setNumbers( const QVariant& var ) } /*! - \brief Set the list of the graphic identifiers from the resource manager. + \brief Set the list of the icons from the resource manager. \param var new icons list \internal */ @@ -2536,18 +2536,14 @@ void QtxPagePrefSelectItem::setIcons( const QVariant& var ) QList lst; QList varList = var.toList(); - int index=1; for ( QList::const_iterator it = varList.begin(); it != varList.end(); ++it ) { - index++; - if ( (*it).canConvert() ) { - QIcon icon = (*it).value(); - lst.append( icon ); - } else if ( (*it).canConvert() ) { - QPixmap pix = (*it).value(); - QIcon icon (pix); - lst.append( icon ); - } + if ( (*it).canConvert() ) + lst.append( (*it).value() ); + else if ( (*it).canConvert() ) + lst.append( (*it).value() ); + else + lst.append( QIcon() ); } setIcons( lst ); } diff --git a/src/Qtx/QtxPagePrefMgr.h b/src/Qtx/QtxPagePrefMgr.h index 8fd99e324..f853ba6ac 100644 --- a/src/Qtx/QtxPagePrefMgr.h +++ b/src/Qtx/QtxPagePrefMgr.h @@ -33,6 +33,7 @@ #include #include #include +#include class QtxGridBox; class QtxFontEdit; @@ -434,7 +435,7 @@ public: QStringList strings() const; QList numbers() const; - QList icons() const; + QList icons() const; void setStrings( const QStringList& ); void setNumbers( const QList& );