*/
void GLViewer_ViewFrame::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[DumpId] );
SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
aScaleBtn->AddAction(myActionsMap[FitAllId]);
aPanBtn->AddAction(myActionsMap[PanId]);
aPanBtn->AddAction(myActionsMap[GlobalPanId]);
- myActionsMap[ResetId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ResetId] );
}
/*!
}
connect( myModuleAction, SIGNAL( moduleActivated( const QString& ) ), this, SLOT( onModuleActivation( const QString& ) ) );
+ modTBar->addAction( myModuleAction );
}
// New window
QStringList modNameList;
app->modules( modNameList, false );
+ for ( QStringList::const_iterator it = modNameList.begin();
+ it != modNameList.end(); ++it )
+ _prefs_->addPreference( *it );
ModuleList modList;
app->modules( modList );
if ( mod && !_prefs_->hasModule( mod->moduleName() ) )
{
- int modCat = _prefs_->addPreference( mod->moduleName() );
- _prefs_->setItemProperty( modCat, "info", QString() );
+ _prefs_->addPreference( mod->moduleName() );
if( toCreate )
mod->createPreferences();
}
}
- int id = _prefs_->addPreference( "Root" );
- _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ) );
}
+ _prefs_->setItemProperty( "info", tr( "PREFERENCES_NOT_LOADED" ) );
connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ),
this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) );
if ( myPrefs && lightMod && !myPrefs->hasModule( lightMod->moduleName() ))
{
int modCat = myPrefs->addPreference( mod->moduleName() );
- myPrefs->setItemProperty( modCat, "info", QString() );
lightMod->createPreferences();
+ QtxPreferenceItem* item = myPrefs->findItem( modCat );
+ if ( item && item->isEmpty() )
+ delete item;
}
}
int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat );
int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab );
- pref->setItemProperty( studyGroup, "columns", 1 );
+
+ //pref->setItemProperty( "columns", 1, studyGroup );
pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" );
pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
- pref->setItemProperty( extgroup, "columns", 1 );
+ //pref->setItemProperty( "columns", 1, extgroup );
QString platform;
#ifdef WIN32
platform = "winapplication";
platform = "application";
#endif
int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", platform );
- pref->setItemProperty( apppref, "existing", true );
- pref->setItemProperty( apppref, "flags", QFile::ExeUser );
- pref->setItemProperty( apppref, "readOnly", false );
+ pref->setItemProperty( "mode", QtxPagePrefPathItem::OpenFile, apppref );
pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" );
int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab );
- pref->setItemProperty( pythonConsoleGroup, "columns", 1 );
+ //pref->setItemProperty( "columns", 1, pythonConsoleGroup );
pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, LightApp_Preferences::Font, "PyConsole", "font" );
int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat );
int supervGroup = pref->addPreference( tr( "PREF_GROUP_SUPERV" ), viewTab );
- pref->setItemProperty( occGroup, "columns", 1 );
- pref->setItemProperty( vtkGroup, "columns", 1 );
- pref->setItemProperty( plot2dGroup, "columns", 1 );
+ //pref->setItemProperty( "columns", 1, occGroup );
+ //pref->setItemProperty( "columns", 1, vtkGroup );
+ //pref->setItemProperty( "columns", 1, plot2dGroup );
int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
LightApp_Preferences::Color, "OCCViewer", "background" );
- pref->setItemProperty( occTS, "min", 1.0E-06 );
- pref->setItemProperty( occTS, "max", 1000 );
+ pref->setItemProperty( "min", 1.0E-06, occTS );
+ pref->setItemProperty( "max", 1000, occTS );
int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
- pref->setItemProperty( isoU, "min", 0 );
- pref->setItemProperty( isoU, "max", 100000 );
+ pref->setItemProperty( "min", 0, isoU );
+ pref->setItemProperty( "max", 100000, isoU );
- pref->setItemProperty( isoV, "min", 0 );
- pref->setItemProperty( isoV, "max", 100000 );
+ pref->setItemProperty( "min", 0, isoV );
+ pref->setItemProperty( "max", 100000, isoV );
int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup,
LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup,
LightApp_Preferences::Color, "VTKViewer", "background" );
- pref->setItemProperty( vtkTS, "min", 1.0E-06 );
- pref->setItemProperty( vtkTS, "max", 150 );
+ pref->setItemProperty( "min", 1.0E-06, vtkTS );
+ pref->setItemProperty( "max", 150, vtkTS );
pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
LightApp_Preferences::Bool, "Plot2d", "ShowLegend" );
anIndexesList.append(2);
anIndexesList.append(3);
- pref->setItemProperty( legendPosition, "strings", aLegendPosList );
- pref->setItemProperty( legendPosition, "indexes", anIndexesList );
+ pref->setItemProperty( "strings", aLegendPosList, legendPosition );
+ pref->setItemProperty( "indexes", anIndexesList, legendPosition );
int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
LightApp_Preferences::Selector, "Plot2d", "CurveType" );
anIndexesList.append(1);
anIndexesList.append(2);
- pref->setItemProperty( curveType, "strings", aCurveTypesList );
- pref->setItemProperty( curveType, "indexes", anIndexesList );
+ pref->setItemProperty( "strings", aCurveTypesList, curveType );
+ pref->setItemProperty( "indexes", anIndexesList, curveType );
int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
- pref->setItemProperty( markerSize, "min", 0 );
- pref->setItemProperty( markerSize, "max", 100 );
+ pref->setItemProperty( "min", 0, markerSize );
+ pref->setItemProperty( "max", 100, markerSize );
QStringList aScaleModesList;
aScaleModesList.append( tr("PREF_LINEAR") );
int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
- pref->setItemProperty( horScale, "strings", aScaleModesList );
- pref->setItemProperty( horScale, "indexes", anIndexesList );
+ pref->setItemProperty( "strings", aScaleModesList, horScale );
+ pref->setItemProperty( "indexes", anIndexesList, horScale );
int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
- pref->setItemProperty( verScale, "strings", aScaleModesList );
- pref->setItemProperty( verScale, "indexes", anIndexesList );
+ pref->setItemProperty( "strings", aScaleModesList, verScale );
+ pref->setItemProperty( "indexes", anIndexesList, verScale );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
LightApp_Preferences::Color, "Plot2d", "Background" );
int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
- pref->setItemProperty( dirGroup, "columns", 1 );
+ //pref->setItemProperty( dirGroup, "columns", 1 );
pref->addPreference( tr( "" ), dirGroup,
LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
QVariant var;
LightApp_Preferences* pref = preferences();
if ( pref )
- var = pref->itemProperty( id, prop );
+ var = pref->itemProperty( prop, id );
return var;
}
{
LightApp_Preferences* pref = preferences();
if ( pref )
- pref->setItemProperty( id, prop, var );
+ pref->setItemProperty( prop, var, id );
}
/*!
}
/*!
- \brief Add action to the widget.
- \param w widget (menu or toolbar)
- \return \c true if the action is added successfully and \c false otherwise.
- \sa removeFrom()
+ \brief Called when the action is added to the widget.
+ \param w widget (not used)
*/
-bool LightApp_ModuleAction::addTo( QWidget* w )
+void LightApp_ModuleAction::addedTo( QWidget* w )
{
- bool ok = QtxAction::addTo( w );
+ w->insertAction( mySet, this );
if ( w->inherits( "QToolBar" ) )
- ok = ok && myCombo->addTo( w );
- return ok && mySet->addTo( w );
+ w->insertAction( myCombo, this );
+ update();
}
/*!
\return \c true if the action is removed successfully and \c false otherwise.
\sa addTo()
*/
-bool LightApp_ModuleAction::removeFrom( QWidget* w )
+void LightApp_ModuleAction::removedFrom( QWidget* w )
{
- bool ok = mySet->removeFrom( w );
if ( w->inherits( "QToolBar" ) )
- ok = ok && myCombo->removeFrom( w );
- return ok && QtxAction::removeFrom( w );
-}
-
-/*!
- \brief Called when the action is added to the widget.
- \param w widget (not used)
-*/
-void LightApp_ModuleAction::addedTo( QWidget* /*w*/ )
-{
- update();
+ w->removeAction( myCombo );
+ w->removeAction( mySet );
}
/*!
void setMode( const int );
int mode() const;
- virtual bool addTo( QWidget* );
- virtual bool removeFrom( QWidget* );
-
protected:
virtual void addedTo( QWidget* );
+ virtual void removedFrom( QWidget* );
signals:
void moduleActivated( const QString& );
LightApp_Preferences( QtxResourceMgr*, QWidget* = 0 );
virtual ~LightApp_Preferences();
- int addPreference( const QString& label, const int pId = -1, const int = -1,
- const QString& section = QString::null, const QString& param = QString::null );
- 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 );
+ int addPreference( const QString& label,const int pId = -1, const int = Auto,
+ const QString& section = QString(), const QString& param = QString() );
+ int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = Auto,
+ const QString& section = QString(), const QString& param = QString() );
bool hasModule( const QString& ) const;
setFocusProxy( myPrefs );
myPrefs->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ myPrefs->show();
setButtonPosition( Right, Close );
*/
void OCCViewer_ViewWindow::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[DumpId] );
if ( myModel->trihedronActivated() )
- myActionsMap[TrihedronShowId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[TrihedronShowId] );
SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar, "scale");
aScaleBtn->AddAction(myActionsMap[FitAllId]);
aPanningBtn->AddAction(myActionsMap[PanId]);
aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
- myActionsMap[ChangeRotationPointId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ChangeRotationPointId] );
- myActionsMap[RotationId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[RotationId] );
SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar, "projection");
aViewsBtn->AddAction(myActionsMap[FrontId]);
aViewsBtn->AddAction(myActionsMap[LeftId]);
aViewsBtn->AddAction(myActionsMap[RightId]);
- myActionsMap[ResetId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ResetId] );
SUIT_ToolButton* aMemBtn = new SUIT_ToolButton(myToolBar, "view");
aMemBtn->AddAction(myActionsMap[MemId]);
aMemBtn->AddAction(myActionsMap[RestoreId]);
myToolBar->addSeparator();
- myActionsMap[CloneId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[CloneId] );
myToolBar->addSeparator();
- myActionsMap[ClippingId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ClippingId] );
}
/*!
// scaling
QMenu* scalingPopup = new QMenu( thePopup );
scalingPopup->addAction( myActionsMap[ PModeXLinearId ] );
- myActionsMap[ PModeXLinearId ]->addTo( scalingPopup );
- myActionsMap[ PModeXLogarithmicId ]->addTo( scalingPopup );
+ scalingPopup->addAction( myActionsMap[ PModeXLogarithmicId ] );
onChangeHorMode();
scalingPopup->addSeparator();
- myActionsMap[ PModeYLinearId ]->addTo( scalingPopup );
- myActionsMap[ PModeYLogarithmicId ]->addTo( scalingPopup );
+ scalingPopup->addAction( myActionsMap[ PModeYLinearId ] );
+ scalingPopup->addAction( myActionsMap[ PModeYLogarithmicId ] );
scalingPopup->setTitle( tr( "SCALING_POPUP" ) );
thePopup->addMenu( scalingPopup );
onChangeVerMode();
thePopup->addAction(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData()));
// curve type
QMenu* curTypePopup = new QMenu( thePopup );
- myActionsMap[ CurvPointsId ]->addTo( curTypePopup );
- myActionsMap[ CurvLinesId ]->addTo( curTypePopup );
- myActionsMap[ CurvSplinesId ]->addTo( curTypePopup );
+ scalingPopup->addAction( myActionsMap[ CurvPointsId ] );
+ scalingPopup->addAction( myActionsMap[ CurvLinesId ] );
+ scalingPopup->addAction( myActionsMap[ CurvSplinesId ] );
curTypePopup->setTitle( tr( "CURVE_TYPE_POPUP" ) );
thePopup->addMenu( curTypePopup );
// legend
- myActionsMap[ LegendId ]->addTo(thePopup);
+ scalingPopup->addAction( myActionsMap[ LegendId ] );
// settings
- myActionsMap[ CurvSettingsId ]->addTo(thePopup);
+ scalingPopup->addAction( myActionsMap[ CurvSettingsId ] );
}
/*!
*/
void Plot2d_ViewWindow::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[DumpId] );
SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
aScaleBtn->AddAction(myActionsMap[FitAllId]);
myActionsMap[CurvLinesId]->setChecked(true);
onChangeCurveMode();
- myActionsMap[HorId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[HorId] );
onChangeHorMode();
- myActionsMap[VerId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[VerId] );
onChangeVerMode();
- myActionsMap[LegendId]->addTo(myToolBar);
- myActionsMap[CurvSettingsId]->addTo(myToolBar);
- myActionsMap[CloneId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[LegendId] );
+ myToolBar->addAction( myActionsMap[CurvSettingsId] );
+ myToolBar->addAction( myActionsMap[CloneId] );
onChangeLegendMode();
}
return QWidgetAction::eventFilter( o, e );
}
-/*!
- \brief Add action to widget.
- \param w widget (menu or toolbar)
- \return \c true if the action is added successfully and \c false otherwise.
-*/
-bool QtxAction::addTo( QWidget* w )
-{
- if ( !w )
- return false;
-
- w->addAction( this );
- return true;
-}
-
-/*!
- \brief Add action to widget.
-
- The function adds the action to the menu or toolbar widget at the
- specified \a index. If \a index is negative or greater than number of
- items in the menu/toolbar, the action is added to the end of list.
-
- \param w widget (menu or toolbar)
- \param index index of the action in the action list
- \return \c true if the action is added successfully and \c false otherwise.
-*/
-bool QtxAction::addTo( QWidget* w, const int index )
-{
- if ( !w )
- return false;
-
- QAction* b = 0;
- if ( 0 <= index && index < w->actions().count() )
- b = w->actions().at( index );
-
- w->insertAction( b, this );
-
- return true;
-}
-
-/*!
- \brief Remove action from widget.
- \param w widget (menu or toolbar)
- \return \c true if the action is removed successfully and \c false otherwise.
-*/
-bool QtxAction::removeFrom( QWidget* w )
-{
- if ( !w )
- return false;
-
- w->removeAction( this );
- return true;
-}
-
/*!
\brief Called when the action is added to the widget.
virtual bool eventFilter( QObject*, QEvent* );
- virtual bool addTo( QWidget* );
- virtual bool addTo( QWidget*, const int );
- virtual bool removeFrom( QWidget* );
-
protected:
virtual void addedTo( QWidget* );
virtual void removedFrom( QWidget* );
\brief The QtxColorButton class implements a widget for color
preference items editing.
- The color preference item is represented as the colored button,
- clicking on which invokes the standard "Select color" dialog box.
-
- Initial color value can be set with setColor() method. Currently
- chosen color can be retrieved with color() method.
+ The color preference item is represented as the colored button with
+ assocoiated popup menu whihc is called when the user presses the small
+ arrow button near it. The popup menu allows selecting of the color
+ from the predefined set. In addition it contains the button which
+ invokes standard "Select color" dialog box.
+
+ Initial color value can be set with setColor() method. Chosen color
+ can be retrieved with the color() method.
*/
/*!
- \brief
+ \brief Constructor.
+ \param parent parent widget
*/
QtxColorButton::QtxColorButton( QWidget* parent )
: QToolButton( parent )
}
/*!
- \brief
+ \brief Destructor.
*/
QtxColorButton::~QtxColorButton()
{
}
/*!
- \brief
+ \brief Get currently selected color.
+
+ Returns null QColor if no color is selected.
+
+ \return selected color
+ \sa setColor()
*/
QColor QtxColorButton::color() const
{
}
/*!
- \brief
+ \brief Set color.
+ \param c color to be set as current
+ \sa color()
*/
void QtxColorButton::setColor( const QColor& c )
{
update();
}
+/*!
+ \brief Filter events for the child widgets.
+ \param o event receiver object
+ \param e event
+ \return \c true if the event should be filtered
+*/
bool QtxColorButton::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == QEvent::Leave )
return QToolButton::eventFilter( o, e );
}
+/*!
+ \brief Called when the popup menu is about to show.
+
+ Updates the menu and child widgets state.
+*/
void QtxColorButton::onAboutToShow()
{
updateState();
}
/*!
- \brief
+ \brief Called when the button is clicked by the user.
+
+ Emits the signal clicked( QColor ).
+
+ \param on button state (not used)
*/
-void QtxColorButton::onClicked( bool )
+void QtxColorButton::onClicked( bool /*on*/ )
{
emit clicked( color() );
}
/*!
- \brief
+ \brief Called when any color selection button from popup menu
+ is clicked.
+
+ Changes the currently selected color and emits the signal
+ changed( QColor ).
+
+ \param on button state
*/
void QtxColorButton::onToggled( bool on )
{
}
/*!
- \brief
+ \brief Called the "Other colors" child button from popup menu
+ is clicked.
+
+ Invokes standard "Select color" dialog box allowing user to select
+ custom color. If the current color is changed by the user, emits
+ the signal changed( QColor ).
+
+ \param on (not used)
*/
void QtxColorButton::onDialogClicked( bool )
{
}
/*!
- \brief
+ \brief Customize paint event for the widget.
+ \param e paint event
*/
void QtxColorButton::paintEvent( QPaintEvent* e )
{
}
/*!
- \brief
+ \brief Update widget state.
*/
void QtxColorButton::updateState()
{
}
/*!
- \brief
+ \brief Update child button state.
+ \param btn child button
*/
void QtxColorButton::updateButton( QToolButton* btn )
{
btn->blockSignals( block );
}
+/*!
+ \brief Generate (if necessary) or get the icon for the button.
+ \param c color to be used for the icon
+ \return icon pixmap for the button
+*/
QPixmap QtxColorButton::buttonIcon( const QColor& c ) const
{
static QMap<int, QPixmap> pixMap;
}
/*!
- \brief
+ \brief Draw pixmap.
+ \param pd paint device
+ \param c color
+ \param m margin
*/
void QtxColorButton::drawColor( QPaintDevice* pd, const QColor& c, const int m ) const
{
}
/*!
- \brief
+ \brief Get predefined list of colors to be used in the popup menu.
+ \return list of colors
*/
QList<QColor> QtxColorButton::colorsList() const
{
return lst;
}
+/*!
+ \fn void QtxColorButton::clicked( QColor color );
+ \brief This signal is emitted when the widget button is clicked by
+ the user.
+ \param color current color
+*/
+
+/*!
+ \fn void QtxColorButton::changed( QColor color );
+ \brief This signal is emitted when the current color is changed.
+ \param color new current color
+*/
#include <QFontDatabase>
#include <QFontComboBox>
+/*!
+ \class QtxFontEdit
+ \brief The QtxFontEdit class represents a widget for font
+ preference items editing.
+
+ The font preference item is represented as the drop-down combo box
+ filled with the list of available fonts. Additional controls for
+ modifying font properties ('bold', 'italic', font size, etc) are also
+ available for use.
+
+ Initial font value can be set with setCurrentFont() method. Chosen font
+ can be retrieved with the currentFont() method.
+
+ Font properties can be set with the setFontSize(), setFontFamily(),
+ setFontScripting() methods and retrieved with fontSize(), fontFamily(),
+ fontScripting() methods.
+
+ Additional widgets for direct modyfing font properties are available
+ with use of setFeatures() method.
+*/
+
+/*!
+ \brief Constructor
+ \param feat font widget features (ORed QtxFontEdit::Features flags)
+ \param parent parent widget
+*/
QtxFontEdit::QtxFontEdit( const int feat, QWidget* parent )
: QFrame( parent ),
-myFeatures( feat )
+ myFeatures( feat )
{
initialize();
}
+/*!
+ \brief Constructor
+ \param parent parent widget
+
+ All font widget features are enabled.
+*/
QtxFontEdit::QtxFontEdit( QWidget* parent )
: QFrame( parent ),
-myFeatures( All )
+ myFeatures( All )
{
initialize();
}
+/*!
+ \brief Destructor
+*/
QtxFontEdit::~QtxFontEdit()
{
}
+/*!
+ \brief Get font widget features.
+ \return font widget features (ORed QtxFontEdit::Features flags)
+ \sa setFeatures()
+*/
int QtxFontEdit::features() const
{
return myFeatures;
}
+/*!
+ \brief Set font widget features.
+ \param f font widget features (ORed QtxFontEdit::Features flags)
+ \sa features()
+*/
void QtxFontEdit::setFeatures( const int f )
{
if ( myFeatures == f )
updateState();
}
+/*!
+ \brief Get currently selected font.
+ \return current font
+ \sa setCurrentFont()
+*/
QFont QtxFontEdit::currentFont() const
{
QFont fnt( fontFamily(), fontSize() );
return fnt;
}
+/*!
+ \brief Set currently selected font.
+ \param fnt current font
+ \sa currentFont()
+*/
void QtxFontEdit::setCurrentFont( const QFont& fnt )
{
setFontFamily( fnt.family() );
( fnt.underline() ? Underline : 0 ) );
}
+/*!
+ \brief Get selected font family name.
+ \return current font family name
+ \sa setFontFamily()
+*/
QString QtxFontEdit::fontFamily() const
{
return myFamily->currentFont().family();
}
+/*!
+ \brief Get selected font size.
+ \return current font size
+ \sa setFontSize()
+*/
int QtxFontEdit::fontSize() const
{
bool ok;
return ok ? pSize : 0;
}
+/*!
+ \brief Get selected font scripting.
+ \return current font scripting
+ \sa setFontScripting()
+*/
int QtxFontEdit::fontScripting() const
{
return ( myB->isChecked() ? Bold : 0 ) |
( myU->isChecked() ? Underline : 0 );
}
+/*!
+ \brief Set font family name.
+ \param fam new font family name
+ \sa fontFamily()
+*/
void QtxFontEdit::setFontFamily( const QString& fam )
{
myFamily->setCurrentFont( QFont( fam ) );
onFontChanged( myFamily->currentFont() );
}
+/*!
+ \brief Set font size.
+ \param fam new font size
+ \sa fontSize()
+*/
void QtxFontEdit::setFontSize( const int s )
{
if ( s <= 0 )
mySize->setEditText( QString::number( s ) );
}
+/*!
+ \brief Set font scripting.
+ \param fam new font scripting
+ \sa fontScripting()
+*/
void QtxFontEdit::setFontScripting( const int script )
{
myB->setChecked( script & Bold );
myU->setChecked( script & Underline );
}
+/*!
+ \brief Update widget state
+*/
void QtxFontEdit::updateState()
{
int feat = features();
mySize->setEditable( feat & UserSize );
}
-void QtxFontEdit::onFontChanged( const QFont& )
+/*!
+ \brief Called when current font is changed.
+ \param f (not used)
+*/
+void QtxFontEdit::onFontChanged( const QFont& /*f*/ )
{
int s = fontSize();
mySize->clear();
setFontSize( s );
}
-void QtxFontEdit::onPreview( bool )
+/*!
+ \brief Called when "Preview" button is clicked.
+ \param on (not used)
+*/
+void QtxFontEdit::onPreview( bool /*on*/ )
{
bool ok;
QFont fnt = QFontDialog::getFont( &ok, currentFont() );
setCurrentFont( fnt );
}
+/*
+ \brief Perform internal intialization.
+*/
void QtxFontEdit::initialize()
{
QHBoxLayout* base = new QHBoxLayout( this );
Q_OBJECT
public:
- typedef enum { Family = 0x01,
- Size = 0x02,
- UserSize = 0x04,
- Bold = 0x08,
- Italic = 0x10,
- Underline = 0x20,
- Preview = 0x40,
- Scripting = Bold | Italic | Underline,
- All = Family | Size | UserSize | Scripting | Preview } Features;
+ //! Font widget features
+ typedef enum {
+ Family = 0x01, //!< show font family selection widget
+ Size = 0x02, //!< show font size widget
+ UserSize = 0x04, //!< allow font size direct change
+ Bold = 0x08, //!< show 'bold' widget
+ Italic = 0x10, //!< show 'italic' widget
+ Underline = 0x20, //!< show 'underline' widget
+ Preview = 0x40, //!< show font preview widget
+ Scripting = Bold | Italic | Underline, //!< show font scripting widgets ('bold','italic','underline')
+ All = Family | Size | UserSize | Scripting | Preview //!< show all font widgets
+ } Features;
public:
QtxFontEdit( const int, QWidget* = 0 );
/*!
\class QtxPagePrefMgr
- GUI implementation of QtxPreferenceMgr - manager of preferences
+ \brief GUI implementation of the QtxPreferenceMgr class: preferences manager.
*/
+/*!
+ \brief Constructor.
+ \param resMgr resource manager
+ \param parent parent widget
+*/
QtxPagePrefMgr::QtxPagePrefMgr( QtxResourceMgr* resMgr, QWidget* parent )
: QFrame( parent ),
-QtxPreferenceMgr( resMgr ),
-myInit( false )
+ QtxPreferenceMgr( resMgr ),
+ myInit( false )
{
myBox = new QtxGridBox( 1, Qt::Horizontal, this, 0 );
QVBoxLayout* base = new QVBoxLayout( this );
base->addWidget( myBox );
}
+/*!
+ \brief Destructor
+*/
QtxPagePrefMgr::~QtxPagePrefMgr()
{
}
+/*!
+ \brief Get recommended size for the widget.
+ \return recommended widget size
+*/
QSize QtxPagePrefMgr::sizeHint() const
{
initialize();
return QFrame::sizeHint();
}
+/*!
+ \brief Get recommended minimum size for the widget.
+ \return recommended minimum widget size
+*/
QSize QtxPagePrefMgr::minimumSizeHint() const
{
initialize();
return QFrame::minimumSizeHint();
}
+/*!
+ \brief Customize show/hide widget operation.
+ \param on if \c true the widget is being shown, otherswise
+ it is being hidden
+*/
void QtxPagePrefMgr::setVisible( bool on )
{
if ( on && !myInit )
QFrame::setVisible( on );
}
+/*!
+ \brief Update widget contents.
+*/
void QtxPagePrefMgr::updateContents()
{
QtxPreferenceMgr::updateContents();
}
}
-void QtxPagePrefMgr::itemAdded( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is added.
+ \param item child item being added
+ \sa itemRemoved(), itemChanged()
+*/
+void QtxPagePrefMgr::itemAdded( QtxPreferenceItem* /*item*/ )
{
triggerUpdate();
}
-void QtxPagePrefMgr::itemRemoved( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is removed.
+ \param item child item being removed
+ \sa itemAdded(), itemChanged()
+*/
+void QtxPagePrefMgr::itemRemoved( QtxPreferenceItem* /*item*/ )
{
triggerUpdate();
}
-void QtxPagePrefMgr::itemChanged( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is modified.
+ \param item child item being modified
+ \sa itemAdded(), itemRemoved()
+*/
+void QtxPagePrefMgr::itemChanged( QtxPreferenceItem* /*item*/ )
{
triggerUpdate();
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefMgr::optionValue( const QString& name ) const
{
if ( name == "orientation" )
return QtxPreferenceMgr::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefMgr::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "orientation" )
QtxPreferenceMgr::setOptionValue( name, val );
}
+/*!
+ \brief Perform internal initialization.
+*/
void QtxPagePrefMgr::initialize() const
{
if ( myInit )
/*!
\class QtxPagePrefItem
- Base class for implementation of the preference items
+ \brief Base class for implementation of all the widget-based
+ preference items.
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefItem::QtxPagePrefItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPreferenceItem( title, sect, param, parent ),
-myWidget( 0 )
+ myWidget( 0 )
{
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefItem::~QtxPagePrefItem()
{
delete myWidget;
}
+/*!
+ \brief Get unique item type identifier.
+ \return item type ID
+*/
int QtxPagePrefItem::rtti() const
{
return QtxPagePrefItem::RTTI();
}
+/*!
+ \brief Get preference item editor widget.
+ \return editor widget
+ \sa setWidget()
+*/
QWidget* QtxPagePrefItem::widget() const
{
return myWidget;
}
+/*!
+ \brief Specify unique item class identifier.
+ \return item class ID
+*/
int QtxPagePrefItem::RTTI()
{
return 1000;
}
+/*!
+ \brief Set preference item editor widget.
+ \param wid editor widget
+ \sa widget()
+*/
void QtxPagePrefItem::setWidget( QWidget* wid )
{
myWidget = wid;
sendItemChanges();
}
-void QtxPagePrefItem::itemAdded( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is added.
+ \param item child item being added
+ \sa itemRemoved(), itemChanged()
+*/
+void QtxPagePrefItem::itemAdded( QtxPreferenceItem* /*item*/ )
{
contentChanged();
}
-void QtxPagePrefItem::itemRemoved( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is removed.
+ \param item child item being removed
+ \sa itemAdded(), itemChanged()
+*/
+void QtxPagePrefItem::itemRemoved( QtxPreferenceItem* /*item*/ )
{
contentChanged();
}
-void QtxPagePrefItem::itemChanged( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is modified.
+ \param item child item being modified
+ \sa itemAdded(), itemRemoved()
+*/
+void QtxPagePrefItem::itemChanged( QtxPreferenceItem* /*item*/ )
{
contentChanged();
}
+/*!
+ \brief Store preference item to the resource manager.
+
+ This method should be reimplemented in the subclasses.
+ Base implementation does nothing.
+
+ \sa retrieve()
+*/
void QtxPagePrefItem::store()
{
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+
+ This method should be reimplemented in the subclasses.
+ Base implementation does nothing.
+
+ \sa store()
+*/
void QtxPagePrefItem::retrieve()
{
}
+/*!
+ \brief Find all child items of the QtxPagePrefItem type.
+ \param list used to return list of child items
+ \param rec if \c true, perform recursive search
+*/
void QtxPagePrefItem::pageChildItems( QList<QtxPagePrefItem*>& list, const bool rec ) const
{
QList<QtxPreferenceItem*> lst = childItems( rec );
}
}
+/*!
+ \brief Called when contents is changed (item is added, removed or modified).
+
+ Triggers the item update.
+*/
void QtxPagePrefItem::contentChanged()
{
triggerUpdate();
/*!
\class QtxPageNamedPrefItem
- Base class for implementation of the named preference items (items with text labels).
+ \brief Base class for implementation of the named preference items
+ (items with text labels).
+*/
+
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
QtxPageNamedPrefItem::QtxPageNamedPrefItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param ),
-myControl( 0 )
+ myControl( 0 )
{
QWidget* main = new QWidget();
QHBoxLayout* base = new QHBoxLayout( main );
myLabel->setVisible( !title.isEmpty() );
}
+/*!
+ \brief Destructor.
+*/
QtxPageNamedPrefItem::~QtxPageNamedPrefItem()
{
}
+/*!
+ \brief Set preference title.
+ \param txt new preference title.
+*/
void QtxPageNamedPrefItem::setTitle( const QString& txt )
{
QtxPagePrefItem::setTitle( txt );
label()->setVisible( true );
}
+/*!
+ \brief Get label widget corresponding to the preference item.
+ \return label widget
+*/
QLabel* QtxPageNamedPrefItem::label() const
{
return myLabel;
}
+/*!
+ \brief Get control widget corresponding to the preference item.
+ \return control widget
+ \sa setControl()
+*/
QWidget* QtxPageNamedPrefItem::control() const
{
return myControl;
}
+/*!
+ \brief Set control widget corresponding to the preference item.
+ \param wid control widget
+ \sa control()
+*/
void QtxPageNamedPrefItem::setControl( QWidget* wid )
{
if ( myControl == wid )
/*!
\class QtxPagePrefListItem
+ \brief GUI implementation of the list container preference item.
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefListItem::QtxPagePrefListItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param ),
-myFix( false )
+ myFix( false )
{
QSplitter* main = new QSplitter( Qt::Horizontal );
main->setChildrenCollapsible( false );
setWidget( main );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefListItem::~QtxPagePrefListItem()
{
}
+/*!
+ \brief Get message text which is shown if the container is empty.
+ \return message text
+ \sa setEmptyInfo()
+*/
QString QtxPagePrefListItem::emptyInfo() const
{
return myInfText;
}
+/*!
+ \brief Set message text which is shown if the container is empty.
+ \param new message text
+ \sa emptyInfo()
+*/
void QtxPagePrefListItem::setEmptyInfo( const QString& inf )
{
if ( myInfText == inf )
updateVisible();
}
+/*!
+ \brief Check if the preference item widget is of fixed size.
+ \return \c true if the widget has the fixed size
+ \sa setFixedSize()
+*/
bool QtxPagePrefListItem::isFixedSize() const
{
return myFix;
}
+/*!
+ \brief Set the preference item widget to be of fixed size.
+ \param on if \c true, the widget will have the fixed size
+ \sa isFixedSize()
+*/
void QtxPagePrefListItem::setFixedSize( const bool on )
{
if ( myFix == on )
updateGeom();
}
+/*!
+ \brief Update widget contents.
+*/
void QtxPagePrefListItem::updateContents()
{
updateVisible();
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefListItem::optionValue( const QString& name ) const
{
if ( name == "fixed_size" )
return QtxPagePrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefListItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "fixed_size" )
QtxPagePrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Called when the selection in the list box is changed.
+*/
void QtxPagePrefListItem::onItemSelectionChanged()
{
updateState();
}
+/*!
+ \brief Update information label widget.
+*/
void QtxPagePrefListItem::updateInfo()
{
QString infoText;
myInfLabel->setText( infoText );
}
+/*!
+ \brief Update widget state.
+*/
void QtxPagePrefListItem::updateState()
{
QtxPagePrefItem* item = selectedItem();
updateInfo();
}
+/*!
+ \brief Update visibile child widgets.
+*/
void QtxPagePrefListItem::updateVisible()
{
QList<QtxPagePrefItem*> items;
if ( selected() == -1 && myList->count() )
setSelected( myList->item( 0 )->data( Qt::UserRole ).toInt() );
- myList->setVisible( myList->count() > 1 );
+ //myList->setVisible( myList->count() > 1 );
updateState();
updateGeom();
}
+/*!
+ \brief Update widget geometry.
+*/
void QtxPagePrefListItem::updateGeom()
{
if ( myFix )
}
}
+/*!
+ \brief Get identifier of the currently selected preference item.
+ \return identifier of the currently selected item or -1 if no item is selected
+ \sa setSelected()
+*/
int QtxPagePrefListItem::selected() const
{
QList<QListWidgetItem*> selList = myList->selectedItems();
return v.canConvert( QVariant::Int ) ? v.toInt() : -1;
}
+/*!
+ \brief Get currently selected preference item.
+ \return currently selected item or 0 if no item is selected
+ \sa setSelected()
+*/
QtxPagePrefItem* QtxPagePrefListItem::selectedItem() const
{
int selId = selected();
return item;
}
+/*!
+ \brief Set currently selected preference item.
+ \param id identifier of the preference item to make selected
+*/
void QtxPagePrefListItem::setSelected( const int id )
{
int idx = -1;
/*!
\class QtxPagePrefTabsItem
+ \brief GUI implementation of the tab widget container.
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefTabsItem::QtxPagePrefTabsItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param )
setWidget( myTabs );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefTabsItem::~QtxPagePrefTabsItem()
{
}
+/*!
+ \brief Update widget contents.
+*/
void QtxPagePrefTabsItem::updateContents()
{
updateTabs();
}
+/*!
+ \brief Get tabs position.
+ \return current tabs position (QTabWidget::TabPosition)
+ \sa setTabPosition()
+*/
int QtxPagePrefTabsItem::tabPosition() const
{
return myTabs->tabPosition();
}
+/*!
+ \brief Set tabs position.
+ \param tp new tabs position (QTabWidget::TabPosition)
+ \sa tabPosition()
+*/
void QtxPagePrefTabsItem::setTabPosition( const int tp )
{
myTabs->setTabPosition( (QTabWidget::TabPosition)tp );
}
+/*!
+ \brief Get tabs shape.
+ \return current tabs shape (QTabWidget::TabShape)
+ \sa setTabShape()
+*/
int QtxPagePrefTabsItem::tabShape() const
{
return myTabs->tabShape();
}
+/*!
+ \brief Set tabs shape.
+ \param ts new tabs shape (QTabWidget::TabShape)
+ \sa tabShape()
+*/
void QtxPagePrefTabsItem::setTabShape( const int ts )
{
myTabs->setTabShape( (QTabWidget::TabShape)ts );
}
+/*!
+ \brief Get tabs icon size.
+ \return current tabs icon size
+ \sa setTabIconSize()
+*/
QSize QtxPagePrefTabsItem::tabIconSize() const
{
return myTabs->iconSize();
}
+/*!
+ \brief Set tabs icon size.
+ \param sz new tabs icon size
+ \sa tabIconSize()
+*/
void QtxPagePrefTabsItem::setTabIconSize( const QSize& sz )
{
myTabs->setIconSize( sz );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefTabsItem::optionValue( const QString& name ) const
{
if ( name == "position" )
return QtxPagePrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefTabsItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "position" )
QtxPagePrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Update tabs.
+*/
void QtxPagePrefTabsItem::updateTabs()
{
QList<QtxPagePrefItem*> items;
/*!
\class QtxPagePrefFrameItem
+ \brief GUI implementation of the frame widget container.
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefFrameItem::QtxPagePrefFrameItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param )
setWidget( myBox );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefFrameItem::~QtxPagePrefFrameItem()
{
}
+/*!
+ \brief Update widget contents.
+*/
void QtxPagePrefFrameItem::updateContents()
{
updateFrame();
}
+/*!
+ \brief Get frame margin.
+ \return current frame margin
+ \sa setMargin()
+*/
int QtxPagePrefFrameItem::margin() const
{
return myBox->insideMargin();
}
+/*!
+ \brief Get frame margin.
+ \param m new frame margin
+ \sa margin()
+*/
void QtxPagePrefFrameItem::setMargin( const int m )
{
myBox->setInsideMargin( m );
}
+/*!
+ \brief Get frame spacing.
+ \return current frame spacing
+ \sa setSpacing()
+*/
int QtxPagePrefFrameItem::spacing() const
{
return myBox->insideSpacing();
}
+/*!
+ \brief Set frame spacing.
+ \param s new frame spacing
+ \sa spacing()
+*/
void QtxPagePrefFrameItem::setSpacing( const int s )
{
myBox->setInsideSpacing( s );
}
+/*!
+ \brief Get number of frame columns.
+ \return current columns number
+ \sa setColumns()
+*/
int QtxPagePrefFrameItem::columns() const
{
return myBox->columns();
}
+/*!
+ \brief Set number of frame columns.
+ \param c new columns number
+ \sa columns()
+*/
void QtxPagePrefFrameItem::setColumns( const int c )
{
myBox->setColumns( c );
}
+/*!
+ \brief Get frame box orientation.
+ \return current frame orientation
+ \sa setOrientation()
+*/
Qt::Orientation QtxPagePrefFrameItem::orientation() const
{
return myBox->orientation();
}
+/*!
+ \brief Set frame box orientation.
+ \param o new frame orientation
+ \sa orientation()
+*/
void QtxPagePrefFrameItem::setOrientation( const Qt::Orientation o )
{
myBox->setOrientation( o );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefFrameItem::optionValue( const QString& name ) const
{
if ( name == "margin" )
return QtxPagePrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefFrameItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "margin" )
QtxPagePrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Update frame widget.
+*/
void QtxPagePrefFrameItem::updateFrame()
{
QList<QtxPagePrefItem*> items;
/*!
\class QtxPagePrefGroupItem
+ \brief GUI implementation of the group widget container.
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefGroupItem::QtxPagePrefGroupItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param )
setWidget( myGroup );
}
+/*!
+ \brief Constructor.
+ \param cols columns number
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefGroupItem::QtxPagePrefGroupItem( const int cols, const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPagePrefItem( title, parent, sect, param )
setWidget( myGroup );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefGroupItem::~QtxPagePrefGroupItem()
{
}
+/*!
+ \brief Assign resource file settings to the preference item.
+ \param sect resource file section name
+ \param param resource file parameter name
+ \sa resource()
+*/
void QtxPagePrefGroupItem::setResource( const QString& sect, const QString& param )
{
QtxPagePrefItem::setResource( sect, param );
updateState();
}
+/*!
+ \brief Update widget contents.
+*/
void QtxPagePrefGroupItem::updateContents()
{
myGroup->setTitle( title() );
updateGroup();
}
+/*!
+ \brief Get group box margin.
+ \return current group box margin
+ \sa setMargin()
+*/
int QtxPagePrefGroupItem::margin() const
{
return myBox->insideMargin();
}
+/*!
+ \brief Get group box margin.
+ \param m new group box margin
+ \sa margin()
+*/
void QtxPagePrefGroupItem::setMargin( const int m )
{
myBox->setInsideMargin( m );
}
+/*!
+ \brief Get group box spacing.
+ \return current group box spacing
+ \sa setSpacing()
+*/
int QtxPagePrefGroupItem::spacing() const
{
return myBox->insideSpacing();
}
+/*!
+ \brief Set group box spacing.
+ \param s new group box spacing
+ \sa spacing()
+*/
void QtxPagePrefGroupItem::setSpacing( const int s )
{
myBox->setInsideSpacing( s );
}
+/*!
+ \brief Get number of group box columns.
+ \return current columns number
+ \sa setColumns()
+*/
int QtxPagePrefGroupItem::columns() const
{
return myBox->columns();
}
+/*!
+ \brief Set number of group box columns.
+ \param c new columns number
+ \sa columns()
+*/
void QtxPagePrefGroupItem::setColumns( const int c )
{
myBox->setColumns( c );
}
+/*!
+ \brief Get group box orientation.
+ \return current group box orientation
+ \sa setOrientation()
+*/
Qt::Orientation QtxPagePrefGroupItem::orientation() const
{
return myBox->orientation();
}
+/*!
+ \brief Set group box orientation.
+ \param o new group box orientation
+ \sa orientation()
+*/
void QtxPagePrefGroupItem::setOrientation( const Qt::Orientation o )
{
myBox->setOrientation( o );
}
+/*!
+ \brief Get 'flat' flag of the group box widget.
+ \return \c true if the group box is flat
+*/
bool QtxPagePrefGroupItem::isFlat() const
{
return myGroup->isFlat();
}
+/*!
+ \brief Get 'flat' flag of the group box widget.
+ \param on if \c true the group box will be made flat
+*/
void QtxPagePrefGroupItem::setFlat( const bool on )
{
myGroup->setFlat( on );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefGroupItem::store()
{
if ( myGroup->isCheckable() )
setBoolean( myGroup->isChecked() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefGroupItem::retrieve()
{
if ( myGroup->isCheckable() )
myGroup->setChecked( getBoolean() );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefGroupItem::optionValue( const QString& name ) const
{
if ( name == "margin" )
return QtxPagePrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefGroupItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "margin" )
QtxPagePrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Update widget state.
+*/
void QtxPagePrefGroupItem::updateState()
{
QString section, param;
myGroup->setCheckable( !title().isEmpty() && !section.isEmpty() && !param.isEmpty() );
}
+/*!
+ \brief Update group box widget.
+*/
void QtxPagePrefGroupItem::updateGroup()
{
QList<QtxPagePrefItem*> items;
/*!
\class QtxPagePrefSpaceItem
+ \brief Simple spacer item which can be used in the preferences
+ editor dialog box.
*/
+/*!
+ \brief Constructor.
+
+ Creates spacer item with zero width and height and expanding
+ on both directions (by height and width).
+
+ \param parent parent preference item
+*/
QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( QtxPreferenceItem* parent )
: QtxPagePrefItem( QString(), parent )
{
initialize( 0, 0, 1, 1 );
}
+/*!
+ \brief Constructor.
+
+ Creates spacer item with zero width and height and expanding
+ according to the specified orientation.
+
+ \param o spacer orientation
+ \param parent parent preference item
+*/
QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( Qt::Orientation o, QtxPreferenceItem* parent )
: QtxPagePrefItem( QString(), parent )
{
initialize( 0, 0, 0, 1 );
}
+/*!
+ \brief Constructor.
+
+ Creates spacer item with specified width and height. The spacing
+ item is expanding horizontally if \a w <= 0 and vertically
+ if \a h <= 0.
+
+ \param w spacer width
+ \param h spacer height
+ \param parent parent preference item
+*/
QtxPagePrefSpaceItem::QtxPagePrefSpaceItem( const int w, const int h, QtxPreferenceItem* parent )
: QtxPagePrefItem( QString(), parent )
{
initialize( w, h, w > 0 ? 0 : 1, h > 0 ? 0 : 1 );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefSpaceItem::~QtxPagePrefSpaceItem()
{
}
+/*!
+ \brief Get spacer item size for the specified direction.
+ \param o direction
+ \return size for the specified direction
+ \sa setSize()
+*/
int QtxPagePrefSpaceItem::size( Qt::Orientation o ) const
{
return o == Qt::Horizontal ? widget()->minimumWidth() : widget()->minimumHeight();
}
+/*!
+ \brief Set spacer item size for the specified direction.
+ \param o direction
+ \param sz new size for the specified direction
+ \sa size()
+*/
void QtxPagePrefSpaceItem::setSize( Qt::Orientation o, const int sz )
{
if ( o == Qt::Horizontal )
widget()->setMinimumHeight( sz );
}
+/*!
+ \brief Get spacer item stretch factor for the specified direction.
+ \param o direction
+ \return stretch factor for the specified direction
+ \sa setStretch()
+*/
int QtxPagePrefSpaceItem::stretch( Qt::Orientation o ) const
{
QSizePolicy sp = widget()->sizePolicy();
return o == Qt::Horizontal ? sp.horizontalStretch() : sp.verticalStretch();
}
+/*!
+ \brief Set spacer item stretch factor for the specified direction.
+ \param o direction
+ \param sf new stretch factor for the specified direction
+ \sa stretch()
+*/
void QtxPagePrefSpaceItem::setStretch( Qt::Orientation o, const int sf )
{
QSizePolicy sp = widget()->sizePolicy();
widget()->setSizePolicy( sp );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefSpaceItem::optionValue( const QString& name ) const
{
if ( name == "horizontal_size" || name == "hsize" )
return QtxPagePrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefSpaceItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "horizontal_size" || name == "hsize" )
QtxPagePrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Perform internal initialization.
+ \param w spacer item width
+ \param h spacer item height
+ \param ws spacer item horizontal stretch factor
+ \param hs spacer item vertical stretch factor
+*/
void QtxPagePrefSpaceItem::initialize( const int w, const int h, const int hs, const int vs )
{
QSizePolicy sp;
/*!
\class QtxPagePrefCheckItem
- GUI implementation of resources check item (bool).
+ \brief GUI implementation of the resources check box item (boolean).
*/
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefCheckItem::QtxPagePrefCheckItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
setWidget( myCheck );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefCheckItem::~QtxPagePrefCheckItem()
{
}
+/*!
+ \brief Set preference item title.
+ \param txt new preference title.
+*/
void QtxPagePrefCheckItem::setTitle( const QString& txt )
{
QtxPagePrefItem::setTitle( txt );
myCheck->setText( title() );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefCheckItem::store()
{
setBoolean( myCheck->isChecked() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefCheckItem::retrieve()
{
myCheck->setChecked( getBoolean() );
}
/*!
- \class QtxPagePrefEditItem
- GUI implementation of resources line edit item (string, integer, double).
+ \class QtxPagePrefEditItem
+ \brief GUI implementation of the resources line edit box item
+ for string, integer and double values.
*/
+/*!
+ \brief Constructor.
+
+ Creates preference item for string value editing.
+
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefEditItem::QtxPagePrefEditItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( String )
+ myType( String )
{
setControl( myEditor = new QLineEdit() );
updateEditor();
}
+/*!
+ \brief Constructor.
+
+ Creates preference item for editing of the value which type
+ is specified by parameter \a type.
+
+ \param type preference item input type (QtxPagePrefEditItem::InputType)
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefEditItem::QtxPagePrefEditItem( const int type, const QString& title,
- QtxPreferenceItem* parent, const QString& sect, const QString& param )
+ QtxPreferenceItem* parent, const QString& sect,
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( type )
+ myType( type )
{
setControl( myEditor = new QLineEdit() );
updateEditor();
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefEditItem::~QtxPagePrefEditItem()
{
}
+/*!
+ \brief Get edit box preference item input type.
+ \return preference item input type (QtxPagePrefEditItem::InputType)
+ \sa setInputType()
+*/
int QtxPagePrefEditItem::inputType() const
{
return myType;
}
+/*!
+ \brief Set edit box preference item input type.
+ \param type new preference item input type (QtxPagePrefEditItem::InputType)
+ \sa inputType()
+*/
void QtxPagePrefEditItem::setInputType( const int type )
{
if ( myType == type )
updateEditor();
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefEditItem::store()
{
setString( myEditor->text() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefEditItem::retrieve()
{
QString txt = getString();
myEditor->setText( txt );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefEditItem::optionValue( const QString& name ) const
{
if ( name == "input_type" || name == "type" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefEditItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "input_type" || name == "type" )
QtxPageNamedPrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Update edit box widget.
+*/
void QtxPagePrefEditItem::updateEditor()
{
QValidator* val = 0;
/*!
\class QtxPagePrefSelectItem
- GUI implementation of resources selector item (enum).
+ \brief GUI implementation of the resources selector item
+ (string, integer or double values list).
+
+ All items in the list (represented as combo box) should be specified
+ by the unique identifier which is stored to the resource file instead
+ of the value itself.
+*/
+
+/*!
+ \brief Constructor.
+
+ Creates preference item with combo box widget which is not editable
+ (direct value entering is disabled).
+
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
QtxPagePrefSelectItem::QtxPagePrefSelectItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( NoInput )
+ myType( NoInput )
{
setControl( mySelector = new QtxComboBox() );
mySelector->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
updateSelector();
}
+/*!
+ \brief Constructor.
+
+ Creates preference item with combo box widget which is editable
+ according to the specified input type (integer, double or string values).
+
+ \param type input type (QtxPagePrefSelectItem::InputType)
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefSelectItem::QtxPagePrefSelectItem( const int type, const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( type )
+ myType( type )
{
setControl( mySelector = new QtxComboBox() );
mySelector->setDuplicatesEnabled( false );
updateSelector();
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefSelectItem::~QtxPagePrefSelectItem()
{
}
+/*!
+ \brief Get edit box preference item input type.
+ \return preference item input type (QtxPagePrefSelectItem::InputType)
+ \sa setInputType()
+*/
int QtxPagePrefSelectItem::inputType() const
{
return myType;
}
+/*!
+ \brief Set edit box preference item input type.
+ \param type new preference item input type (QtxPagePrefSelectItem::InputType)
+ \sa inputType()
+*/
void QtxPagePrefSelectItem::setInputType( const int type )
{
if ( myType == type )
updateSelector();
}
+/*!
+ \brief Get the list of the values from the selection widget.
+ \return list of values
+ \sa numbers(), setStrings()
+*/
QStringList QtxPagePrefSelectItem::strings() const
{
QStringList res;
return res;
}
+/*!
+ \brief Get the list of the values identifiers from the selection widget.
+ \return list of values IDs
+ \sa strings(), setNumbers()
+*/
QList<int> QtxPagePrefSelectItem::numbers() const
{
QList<int> res;
return res;
}
+/*!
+ \brief Set the list of the values to the selection widget.
+ \param lst new list of values
+ \sa strings(), setNumbers()
+*/
void QtxPagePrefSelectItem::setStrings( const QStringList& lst )
{
mySelector->clear();
mySelector->addItems( lst );
}
+/*!
+ \brief Set the list of the values identifiers to the selection widget.
+ \param ids new list of values IDs
+ \sa numbers(), setStrings()
+*/
void QtxPagePrefSelectItem::setNumbers( const QList<int>& ids )
{
uint i = 0;
mySelector->setId( i, *it );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefSelectItem::store()
{
if ( mySelector->isCleared() )
setString( mySelector->itemText( idx ) );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefSelectItem::retrieve()
{
QString txt = getString();
}
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefSelectItem::optionValue( const QString& name ) const
{
if ( name == "input_type" || name == "type" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefSelectItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "input_type" || name == "type" )
QtxPageNamedPrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Set the list of the values from the resource manager.
+ \param var new values list
+ \internal
+*/
void QtxPagePrefSelectItem::setStrings( const QVariant& var )
{
if ( var.type() != QVariant::StringList )
setStrings( var.toStringList() );
}
+/*!
+ \brief Set the list of the values identifiers from the resource manager.
+ \param var new values IDs list
+ \internal
+*/
void QtxPagePrefSelectItem::setNumbers( const QVariant& var )
{
if ( var.type() != QVariant::List )
setNumbers( lst );
}
+/*!
+ \brief Update selector widget.
+*/
void QtxPagePrefSelectItem::updateSelector()
{
QValidator* val = 0;
}
/*!
- \class QtxPagePrefSpinItem
- GUI implementation of resources spin box item (integer, double).
+ \class QtxPagePrefSpinItem
+ \brief GUI implementation of the resources spin box item
+ (for integer or double value).
*/
+/*!
+ \brief Constructor.
+
+ Creates spin box preference item for the entering integer values.
+
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefSpinItem::QtxPagePrefSpinItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( Integer )
+ myType( Integer )
{
updateSpinBox();
}
+/*!
+ \brief Constructor.
+
+ Creates spin box preference item for the entering values which type
+ is specified by the parameter \a type.
+
+ \param type input type (QtxPagePrefSpinItem::InputType).
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefSpinItem::QtxPagePrefSpinItem( const int type, const QString& title,
- QtxPreferenceItem* parent, const QString& sect, const QString& param )
+ QtxPreferenceItem* parent, const QString& sect,
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
-myType( type )
+ myType( type )
{
updateSpinBox();
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefSpinItem::~QtxPagePrefSpinItem()
{
}
+/*!
+ \brief Get spin box preference item input type.
+ \return preference item input type (QtxPagePrefSpinItem::InputType)
+ \sa setInputType()
+*/
int QtxPagePrefSpinItem::inputType() const
{
return myType;
}
+/*!
+ \brief Set spin box preference item input type.
+ \param type new preference item input type (QtxPagePrefSpinItem::InputType)
+ \sa inputType()
+*/
void QtxPagePrefSpinItem::setInputType( const int type )
{
if ( myType == type )
updateSpinBox();
}
+/*!
+ \brief Get spin box preference item step value.
+ \return spin box single step value
+ \sa setStep()
+*/
QVariant QtxPagePrefSpinItem::step() const
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
return QVariant();
}
+/*!
+ \brief Get spin box preference item minimum value.
+ \return spin box minimum value
+ \sa setMinimum()
+*/
QVariant QtxPagePrefSpinItem::minimum() const
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
return QVariant();
}
+/*!
+ \brief Get spin box preference item maximum value.
+ \return spin box maximum value
+ \sa setMaximum()
+*/
QVariant QtxPagePrefSpinItem::maximum() const
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
return QVariant();
}
+/*!
+ \brief Get spin box preference item prefix string.
+ \return spin box prefix string
+ \sa setPrefix()
+*/
QString QtxPagePrefSpinItem::prefix() const
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
return QString();
}
+/*!
+ \brief Get spin box preference item suffix string.
+ \return spin box suffix string
+ \sa setSuffix()
+*/
QString QtxPagePrefSpinItem::suffix() const
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
return QString();
}
+/*!
+ \brief Get spin box preference item special value text (which is shown
+ when the spin box reaches minimum value).
+ \return spin box special value text
+ \sa setSpecialValueText()
+*/
QString QtxPagePrefSpinItem::specialValueText() const
{
QAbstractSpinBox* sb = ::qobject_cast<QAbstractSpinBox*>( control() );
return QString();
}
+/*!
+ \brief Set spin box preference item step value.
+ \param step new spin box single step value
+ \sa step()
+*/
void QtxPagePrefSpinItem::setStep( const QVariant& step )
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
}
}
+/*!
+ \brief Set spin box preference item minimum value.
+ \param min new spin box minimum value
+ \sa minimum()
+*/
void QtxPagePrefSpinItem::setMinimum( const QVariant& min )
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
}
}
+/*!
+ \brief Set spin box preference item maximum value.
+ \param min new spin box maximum value
+ \sa maximum()
+*/
void QtxPagePrefSpinItem::setMaximum( const QVariant& max )
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
}
}
+/*!
+ \brief Set spin box preference item prefix string.
+ \param txt new spin box prefix string
+ \sa prefix()
+*/
void QtxPagePrefSpinItem::setPrefix( const QString& txt )
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
dsb->setPrefix( txt );
}
+/*!
+ \brief Set spin box preference item suffix string.
+ \param txt new spin box suffix string
+ \sa suffix()
+*/
void QtxPagePrefSpinItem::setSuffix( const QString& txt )
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
dsb->setSuffix( txt );
}
+/*!
+ \brief Set spin box preference item special value text (which is shown
+ when the spin box reaches minimum value).
+ \param txt new spin box special value text
+ \sa specialValueText()
+*/
void QtxPagePrefSpinItem::setSpecialValueText( const QString& txt )
{
QAbstractSpinBox* sb = ::qobject_cast<QAbstractSpinBox*>( control() );
sb->setSpecialValueText( txt );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefSpinItem::store()
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
setDouble( dsb->value() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefSpinItem::retrieve()
{
if ( QtxIntSpinBox* isb = ::qobject_cast<QtxIntSpinBox*>( control() ) )
dsb->setValue( getDouble( dsb->value() ) );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefSpinItem::optionValue( const QString& name ) const
{
if ( name == "input_type" || name == "type" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefSpinItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "input_type" || name == "type" )
QtxPageNamedPrefItem::setOptionValue( name, val );
}
+/*!
+ \brief Update spin box widget.
+*/
void QtxPagePrefSpinItem::updateSpinBox()
{
QVariant val;
/*!
\class QtxPagePrefTextItem
- GUI implementation of resources text edit item (text - several strings).
+ \brief GUI implementation of the resources text box edit item
+ (for large text data).
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
-QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QString& sect, const QString& param )
+QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QString& sect,
+ const QString& param )
: QtxPageNamedPrefItem( QString(), parent, sect, param )
{
myEditor = new QTextEdit();
setControl( myEditor );
}
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefTextItem::QtxPagePrefTextItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
setControl( myEditor );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefTextItem::~QtxPagePrefTextItem()
{
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefTextItem::store()
{
setString( myEditor->toPlainText() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefTextItem::retrieve()
{
myEditor->setPlainText( getString() );
}
/*!
- \class QtxPagePrefColorItem
- GUI implementation of resources color item.
+ \class QtxPagePrefColorItem
+ \brief GUI implementation of the resources color item.
+*/
+
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
QtxPagePrefColorItem::QtxPagePrefColorItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
myColor->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefColorItem::~QtxPagePrefColorItem()
{
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefColorItem::store()
{
setColor( myColor->color() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefColorItem::retrieve()
{
myColor->setColor( getColor() );
}
/*!
- \class QtxPagePrefFontItem
- GUI implementation of resources font item.
+ \class QtxPagePrefFontItem
+ \brief GUI implementation of the resources font item.
+*/
+
+/*!
+ \brief Constructor.
+ \param feat font editor widget features (QtxFontEdit::Features)
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
QtxPagePrefFontItem::QtxPagePrefFontItem( const int feat, const QString& title,
- QtxPreferenceItem* parent, const QString& sect, const QString& param )
+ QtxPreferenceItem* parent, const QString& sect,
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
{
setControl( myFont = new QtxFontEdit( feat ) );
}
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefFontItem::QtxPagePrefFontItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
setControl( myFont = new QtxFontEdit() );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefFontItem::~QtxPagePrefFontItem()
{
}
+/*!
+ \brief Get font widget features.
+ \return font widget features (ORed QtxFontEdit::Features flags)
+ \sa setFeatures()
+*/
int QtxPagePrefFontItem::features() const
{
return myFont->features();
}
+/*!
+ \brief Set font widget features.
+ \param f new font widget features (ORed QtxFontEdit::Features flags)
+ \sa features()
+*/
void QtxPagePrefFontItem::setFeatures( const int f )
{
myFont->setFeatures( f );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefFontItem::store()
{
setFont( myFont->currentFont() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefFontItem::retrieve()
{
myFont->setCurrentFont( getFont() );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefFontItem::optionValue( const QString& name ) const
{
if ( name == "features" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefFontItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "features" )
/*!
\class QtxPagePrefPathItem
- GUI implementation of resources path item.
+ \brief GUI implementation of the resources file/directory path item.
+*/
+
+/*!
+ \brief Constructor.
+ \param type path widget mode (Qtx::PathType )
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
*/
QtxPagePrefPathItem::QtxPagePrefPathItem( const Qtx::PathType type, const QString& title,
QtxPreferenceItem* parent, const QString& sect, const QString& param )
setControl( myPath = new QtxPathEdit( type ) );
}
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefPathItem::QtxPagePrefPathItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
setControl( myPath = new QtxPathEdit() );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefPathItem::~QtxPagePrefPathItem()
{
}
+/*!
+ \brief Get path widget mode.
+ \return current path widget mode (Qtx::PathType)
+ \sa setPathType()
+*/
Qtx::PathType QtxPagePrefPathItem::pathType() const
{
return myPath->pathType();
}
+/*!
+ \brief Set path widget mode.
+ \param type new path widget mode (Qtx::PathType)
+ \sa pathType()
+*/
void QtxPagePrefPathItem::setPathType( const Qtx::PathType type )
{
myPath->setPathType( type );
}
+/*!
+ \brief Get currently used path widget filters.
+ \return file or directory path filters
+ \sa setPathFilter()
+*/
QString QtxPagePrefPathItem::pathFilter() const
{
return myPath->pathFilter();
}
+/*!
+ \brief Set path widget filters.
+ \param f new file or directory path filters
+ \sa pathFilter()
+*/
void QtxPagePrefPathItem::setPathFilter( const QString& f )
{
myPath->setPathFilter( f );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefPathItem::store()
{
setString( myPath->path() );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefPathItem::retrieve()
{
myPath->setPath( getString() );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefPathItem::optionValue( const QString& name ) const
{
if ( name == "path_type" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefPathItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "path_type" )
}
/*!
- \class QtxPagePrefPathsItem
- \brief GUI implementation of resources directory list item.
+ \class QtxPagePrefPathsItem
+ \brief GUI implementation of the resources files/directories list item.
*/
-QtxPagePrefPathsItem::QtxPagePrefPathsItem( QtxPreferenceItem* parent, const QString& sect, const QString& param )
+
+/*!
+ \brief Constructor.
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
+QtxPagePrefPathsItem::QtxPagePrefPathsItem( QtxPreferenceItem* parent, const QString& sect,
+ const QString& param )
: QtxPageNamedPrefItem( QString(), parent, sect, param )
{
setControl( myPaths = new QtxPathListEdit() );
}
+/*!
+ \brief Constructor.
+ \param type path list widget mode (Qtx::PathType)
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefPathsItem::QtxPagePrefPathsItem( const Qtx::PathType type, const QString& title,
QtxPreferenceItem* parent, const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
setControl( myPaths = new QtxPathListEdit( type ) );
}
+/*!
+ \brief Constructor.
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
QtxPagePrefPathsItem::QtxPagePrefPathsItem( const QString& title, QtxPreferenceItem* parent,
const QString& sect, const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
setControl( myPaths = new QtxPathListEdit() );
}
+/*!
+ \brief Destructor.
+*/
QtxPagePrefPathsItem::~QtxPagePrefPathsItem()
{
}
+/*!
+ \brief Get path list widget mode.
+ \return currently used path list widget mode (Qtx::PathType)
+ \sa setPathType()
+*/
Qtx::PathType QtxPagePrefPathsItem::pathType() const
{
return myPaths->pathType();
}
+/*!
+ \brief Set path list widget mode.
+ \param type new path list widget mode (Qtx::PathType)
+ \sa pathType()
+*/
void QtxPagePrefPathsItem::setPathType( const Qtx::PathType type )
{
myPaths->setPathType( type );
}
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
void QtxPagePrefPathsItem::store()
{
setString( myPaths->pathList().join( ";" ) );
}
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
void QtxPagePrefPathsItem::retrieve()
{
myPaths->setPathList( getString().split( ";" ) );
}
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
QVariant QtxPagePrefPathsItem::optionValue( const QString& name ) const
{
if ( name == "path_type" )
return QtxPageNamedPrefItem::optionValue( name );
}
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
void QtxPagePrefPathsItem::setOptionValue( const QString& name, const QVariant& val )
{
if ( name == "path_type" )
class QFileDialog;
class QStackedWidget;
-/*!
- \class QtxPagePrefMgr
- GUI implementation of QtxPreferenceMgr - manager of preferences
-*/
-
class QTX_EXPORT QtxPagePrefMgr : public QFrame, public QtxPreferenceMgr
{
Q_OBJECT
bool myInit;
};
-/*!
- \class QtxPagePrefItem
- Base class for implementation of the preference items
-*/
class QTX_EXPORT QtxPagePrefItem : public QtxPreferenceItem
{
public:
QPointer<QWidget> myWidget;
};
-/*!
- \class QtxPageNamedPrefItem
- Base class for implementation of the named preference items (items with text labels).
-*/
class QTX_EXPORT QtxPageNamedPrefItem : public QtxPagePrefItem
{
public:
QPointer<QWidget> myControl;
};
-/*!
- \class QtxPagePrefListItem
- GUI implementation of listed container.
-*/
class QTX_EXPORT QtxPagePrefListItem : public QObject, public QtxPagePrefItem
{
Q_OBJECT
QLabel* myInfLabel;
};
-/*!
- \class QtxPagePrefTabsItem
- GUI implementation of tab widget container.
-*/
class QTX_EXPORT QtxPagePrefTabsItem : public QtxPagePrefItem
{
public:
QTabWidget* myTabs;
};
-/*!
- \class QtxPagePrefFrameItem
- GUI implementation of frame container.
-*/
class QTX_EXPORT QtxPagePrefFrameItem : public QtxPagePrefItem
{
public:
QtxGridBox* myBox;
};
-/*!
- \class QtxPagePrefGroupItem
- GUI implementation of group container.
-*/
class QTX_EXPORT QtxPagePrefGroupItem : public QtxPagePrefItem
{
public:
QtxGroupBox* myGroup;
};
-/*!
- \class QtxPagePrefSpaceItem
-*/
class QTX_EXPORT QtxPagePrefSpaceItem : public QtxPagePrefItem
{
public:
void initialize( const int, const int, const int, const int );
};
-/*!
- \class QtxPagePrefCheckItem
- GUI implementation of resources check item (bool).
-*/
class QTX_EXPORT QtxPagePrefCheckItem : public QtxPagePrefItem
{
public:
QCheckBox* myCheck;
};
-/*!
- \class QtxPagePrefEditItem
- GUI implementation of resources line edit item (string, integer, double).
-*/
class QTX_EXPORT QtxPagePrefEditItem : public QtxPageNamedPrefItem
{
public:
QLineEdit* myEditor;
};
-/*!
- \class QtxPagePrefSelectItem
- GUI implementation of resources selector item (enum).
-*/
-
class QTX_EXPORT QtxPagePrefSelectItem : public QtxPageNamedPrefItem
{
public:
QtxComboBox* mySelector;
};
-/*!
- \class QtxPagePrefSpinItem
- GUI implementation of resources spin box item (integer, double).
-*/
class QTX_EXPORT QtxPagePrefSpinItem : public QtxPageNamedPrefItem
{
public:
int myType;
};
-/*!
- \class QtxPagePrefTextItem
- GUI implementation of resources text edit item (text - several strings).
-*/
class QTX_EXPORT QtxPagePrefTextItem : public QtxPageNamedPrefItem
{
public:
QTextEdit* myEditor;
};
-/*!
- \class QtxPagePrefColorItem
- GUI implementation of resources color item.
-*/
class QTX_EXPORT QtxPagePrefColorItem : public QtxPageNamedPrefItem
{
public:
QtxColorButton* myColor;
};
-/*!
- \class QtxPagePrefFontItem
- GUI implementation of resources font item.
-*/
class QTX_EXPORT QtxPagePrefFontItem : public QObject, public QtxPageNamedPrefItem
{
Q_OBJECT
QtxFontEdit* myFont;
};
-/*!
- \class QtxPagePrefPathItem
- GUI implementation of resources path item.
-*/
class QTX_EXPORT QtxPagePrefPathItem : public QtxPageNamedPrefItem
{
public:
QtxPathEdit* myPath;
};
-/*!
- \class QtxPagePrefPathsItem
- \brief GUI implementation of resources directory list item.
-*/
class QTX_EXPORT QtxPagePrefPathsItem : public QtxPageNamedPrefItem
{
public:
" "
};
+/*!
+ \class QtxPathEdit
+ \brief The QtxPathEdit class represents a widget for file or directory
+ path preference items editing.
+
+ The path preference item is represented as the line edit box for the
+ direct path editing and small button clicking on which invokes browse
+ dialog box. The widget can be used in different modes: "Open File",
+ "Save File", "Select Directory". The mode defines the type of the
+ standard browse dialog box which is invoked on the button clicking.
+
+ Initial path value can be set with setPath() method. Chosen path
+ can be retrieved with the path() method. The widget mode can be set
+ with setPathType() and retrieved with pathType() method.
+
+ In addition, file/direcrory filters (wildcards) can be set with the
+ setPathFilter() method and retrieved with pathFilter() method.
+*/
+
+/*!
+ \brief Constructor
+ \param type widget mode (Qtx::PathType)
+ \param parent parent widget
+ \sa pathType(), setPathType()
+*/
QtxPathEdit::QtxPathEdit( const Qtx::PathType type, QWidget* parent )
: QFrame( parent ),
-myType( type )
+ myType( type )
{
initialize();
}
+/*!
+ \brief Constructor
+
+ Qtx::PT_OpenFile mode is used by default.
+
+ \param parent parent widget
+ \sa pathType(), setPathType()
+*/
QtxPathEdit::QtxPathEdit( QWidget* parent )
: QFrame( parent ),
-myType( Qtx::PT_OpenFile )
+ myType( Qtx::PT_OpenFile )
{
initialize();
}
+/*!
+ \brief Destructor
+*/
QtxPathEdit::~QtxPathEdit()
{
}
+/*!
+ \brief Get widget mode.
+ \return currently used widget mode (Qtx::PathType)
+ \sa setPathType()
+*/
Qtx::PathType QtxPathEdit::pathType() const
{
return myType;
}
+/*!
+ \brief Set widget mode.
+ \param type new widget mode (Qtx::PathType)
+ \sa pathType()
+*/
void QtxPathEdit::setPathType( const Qtx::PathType type )
{
if ( myType == type )
updateState();
}
+/*!
+ \brief Get currently selected path.
+ \return file or directory path entered by the user
+ \sa setPath()
+*/
QString QtxPathEdit::path() const
{
return myPath->text();
}
+/*!
+ \brief Set path.
+ \param txt file or directory path
+ \sa path()
+*/
void QtxPathEdit::setPath( const QString& txt )
{
myPath->setText( txt );
}
+/*!
+ \brief Get currently used path filters.
+ \return file or directory path filters
+ \sa setPathFilter()
+*/
QString QtxPathEdit::pathFilter() const
{
return myFilter;
}
+/*!
+ \brief Set path filters.
+ \param f new file or directory path filters
+ \sa pathFilter()
+*/
void QtxPathEdit::setPathFilter( const QString& f )
{
if ( myFilter == f )
updateState();
}
-void QtxPathEdit::onBrowse( bool )
+/*!
+ \brief Called when user clicks "Browse" button.
+
+ Invokes standard browsng dialog box depending on the used widget mode.
+
+ \param on (not used)
+ \sa mode(), setMode()
+*/
+void QtxPathEdit::onBrowse( bool /*on*/ )
{
QString path;
QString initial = QFileInfo( myPath->text() ).path();
myPath->setFocus();
}
+/*!
+ \brief Get internal line edit widget.
+ \return line edit box widget
+*/
QLineEdit* QtxPathEdit::lineEdit() const
{
return myPath;
}
+/*!
+ \brief Perform internal widget intialization.
+*/
void QtxPathEdit::initialize()
{
QHBoxLayout* base = new QHBoxLayout( this );
updateState();
}
+/*!
+ \brief Update widget state.
+*/
void QtxPathEdit::updateState()
{
myPath->setCompleter( Qtx::pathCompleter( pathType(), pathFilter() ) );
" "
};
+
/*!
\class QtxPathListEdit::Editor
+ \brief Path editor widget
+ \internal
*/
+
class QtxPathListEdit::Editor : public QtxPathEdit
{
public:
+ /*!
+ \brief Constructor
+ \internal
+ */
Editor( QWidget* parent = 0 ) : QtxPathEdit( parent )
{
layout()->setSpacing( 0 );
lineEdit()->setFrame( false );
}
+ /*!
+ \brief Destructor
+ \internal
+ */
virtual ~Editor() {}
};
/*!
\class QtxPathListEdit::Delegate
+ \brief Custom item delegate for the paths list widget.
+ \internal
*/
+
class QtxPathListEdit::Delegate : public QItemDelegate
{
public:
QtxPathListEdit* myPathEdit;
};
+/*!
+ \brief Constructor.
+ \internal
+ \param pe path list editor
+ \param parent parent widget
+*/
QtxPathListEdit::Delegate::Delegate( QtxPathListEdit* pe, QObject* parent )
: QItemDelegate( parent ),
-myPathEdit( pe )
+ myPathEdit( pe )
{
}
+/*!
+ \brief Destructor.
+ \internal
+*/
QtxPathListEdit::Delegate::~Delegate()
{
}
+/*!
+ \brief Create editor widget.
+ \internal
+ \param parent parent widget
+ \param option style option
+ \param index data model index
+*/
QWidget* QtxPathListEdit::Delegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index ) const
{
return myPathEdit->createEditor( parent );
}
+/*!
+ \brief Set modified data back to the data model.
+ \internal
+ \param editor editor widget
+ \param model data model
+ \param index data model index
+*/
void QtxPathListEdit::Delegate::setModelData( QWidget* editor, QAbstractItemModel* model,
const QModelIndex& index ) const
{
myPathEdit->setModelData( editor, index );
}
+/*!
+ \brief Set data from the data model to the editor.
+ \internal
+ \param editor editor widget
+ \param index data model index
+*/
void QtxPathListEdit::Delegate::setEditorData( QWidget* editor, const QModelIndex& index ) const
{
myPathEdit->setEditorData( editor, index );
}
+/*!
+ \brief Customize paint operation.
+ \internal
+ \param painter painter
+ \param option style option
+ \param index data model index
+*/
void QtxPathListEdit::Delegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index ) const
{
QItemDelegate::paint( painter, option, index );
}
+/*!
+ \brief Customize drawing selection focus operation.
+ \internal
+ \param painter painter
+ \param option style option
+ \param rect selection rectangle
+*/
void QtxPathListEdit::Delegate::drawFocus( QPainter* painter, const QStyleOptionViewItem& option,
const QRect& rect ) const
{
/*!
\class QtxPathListEdit
+ \brief The QtxPathListEdit class represents a widget for files or
+ directories paths list preference items editing.
+
+ The path list preference item is represented as the list box widget.
+ It provides such operations like adding new file/directory path to the
+ list, removing selected paths and modifying of already entered ones.
+
+ The widget can be used in two modes: list of files or list of directories.
+ The mode defines the type of the standard browse dialog box which is
+ invoked on the browse button clicking.
+
+ Initial path list value can be set with setPathList() method. Chosen path
+ list can be retrieved with the pathList() method. The widget mode can be set
+ with setPathType() and retrieved with pathType() method.
+
+ In addition, it is possible to add path items to the list with the insert()
+ method, remove items with the remove() methods, clear all the widget contents
+ with the clear() method. To get the number of entered paths can be retrieved
+ with the count() method. To check if any path already exists in the paths list,
+ use contains() method.
+*/
+
+/*!
+ \brief Constructor.
+ \param type widget mode (Qtx::PathType)
+ \param parent parent widget
+ \sa pathType(), setPathType()
*/
QtxPathListEdit::QtxPathListEdit( const Qtx::PathType type, QWidget* parent )
: QFrame( parent ),
-myCompleter( 0 ),
-myType( type ),
-myDuplicate( false )
+ myCompleter( 0 ),
+ myType( type ),
+ myDuplicate( false )
{
initialize();
}
+/*!
+ \brief Constructor.
+
+ Qtx::PT_OpenFile mode is used by default.
+
+ \param parent parent widget
+ \sa pathType(), setPathType()
+*/
QtxPathListEdit::QtxPathListEdit( QWidget* parent )
: QFrame( parent ),
-myCompleter( 0 ),
-myType( Qtx::PT_OpenFile ),
-myDuplicate( false )
+ myCompleter( 0 ),
+ myType( Qtx::PT_OpenFile ),
+ myDuplicate( false )
{
initialize();
}
/*!
- Destructor
+ \brief Destructor.
*/
QtxPathListEdit::~QtxPathListEdit()
{
}
+/*!
+ \brief Get widget mode.
+ \return currently used widget mode (Qtx::PathType)
+ \sa setPathType()
+*/
Qtx::PathType QtxPathListEdit::pathType() const
{
return myType;
}
+/*!
+ \brief Set widget mode.
+ \param t new widget mode (Qtx::PathType)
+ \sa pathType()
+*/
void QtxPathListEdit::setPathType( const Qtx::PathType t )
{
if ( myType == t )
myCompleter = 0;
}
+/*!
+ \brief Get currently selected paths list.
+ \return files or directories paths list entered by the user
+ \sa setPathList()
+*/
QStringList QtxPathListEdit::pathList() const
{
return myModel->stringList();
}
+/*!
+ \brief Set paths list.
+ \param lst files or directories paths list
+ \sa pathList()
+*/
void QtxPathListEdit::setPathList( const QStringList& lst )
{
myModel->setStringList( lst );
}
+/*!
+ \brief Check if the duplication of paths is enabled.
+ \return \c true if the duplication is enabled
+*/
bool QtxPathListEdit::isDuplicateEnabled() const
{
return myDuplicate;
}
+/*!
+ \brief Enable/disable paths duplication.
+ \param on new flag value
+*/
void QtxPathListEdit::setDuplicateEnabled( const bool on )
{
myDuplicate = on;
}
+/*!
+ \brief Get number of currently entered paths.
+ \return current paths number
+*/
int QtxPathListEdit::count() const
{
return myModel->rowCount();
}
+/*!
+ \brief Check if the specified \a path already exists in
+ the paths list.
+ \param path path to be checked
+ \return \c true if the path is already selected by the user
+ or \c false otherwise
+*/
bool QtxPathListEdit::contains( const QString& path ) const
{
return myModel->stringList().contains( path );
}
+/*!
+ \brief Clear paths list.
+*/
void QtxPathListEdit::clear()
{
myModel->removeRows( 0, myModel->rowCount() );
}
+/*!
+ \brief Remove path from the paths list.
+ \param idx path index in the list
+*/
void QtxPathListEdit::remove( const int idx )
{
if ( 0 <= idx && idx < myModel->rowCount() )
myModel->removeRow( idx );
}
+/*!
+ \brief Remove path from the paths list.
+ \param path path to be removed
+*/
void QtxPathListEdit::remove( const QString& path )
{
QModelIndexList indexes = myModel->match( myModel->index( 0, 0 ), Qt::DisplayRole, path,
}
}
+/*!
+ \brief Add path to the list of paths.
+
+ If the specified index is out of range, the path is added to
+ the end of the list.
+
+ \param path path to be added
+ \param idx index in the list to which the path should be inserted.
+*/
void QtxPathListEdit::insert( const QString& path, const int idx )
{
int index = idx < 0 ? myModel->rowCount() : qMin( idx, myModel->rowCount() );
myModel->setData( myModel->index( index, 0 ), path, Qt::EditRole );
}
-/*!
- Validates entered path, returns true if OK
-*/
/*
bool QtxPathListEdit::validate( const bool quietMode )
{
return true;
}
*/
+
/*!
- Event filter
+ \brief Customize child widget events processing.
+ \param o event receiver object
+ \param e event
+ \return \c true if the further event processing should be stopped.
*/
bool QtxPathListEdit::eventFilter( QObject* o, QEvent* e )
{
}
/*!
- <Insert> button slot
-*/
+ \brief Called when <Insert> button is clicked.
-void QtxPathListEdit::onInsert( bool )
+ Inserts new empty line to the list and sets input focus to it.
+
+ \param on (not used)
+*/
+void QtxPathListEdit::onInsert( bool /*on*/ )
{
int empty = -1;
QStringList lst = myModel->stringList();
}
/*!
- <Delete> button slot
+ \brief Called when <Delete> button is clicked.
+
+ Removes currently selected path item.
+
+ \param on (not used)
*/
void QtxPathListEdit::onDelete( bool )
{
}
/*!
- <Move up> button slot
+ \brief Called when <Up> button is clicked.
+
+ Move currently selected path item up to one row in the paths list.
+
+ \param on (not used)
*/
void QtxPathListEdit::onUp( bool )
{
}
/*!
- <Move down> button slot
+ \brief Called when <Down> button is clicked.
+
+ Move currently selected path item down to one row in the paths list.
+
+ \param on (not used)
*/
void QtxPathListEdit::onDown( bool )
{
myList->setCurrentIndex( toIdx );
}
+/*!
+ \brief Perform internal widget initialization.
+*/
void QtxPathListEdit::initialize()
{
QVBoxLayout* base = new QVBoxLayout( this );
connect( downBtn, SIGNAL( clicked( bool ) ), this, SLOT( onDown( bool ) ) );
}
+/*!
+ \brief Create editor widget.
+ \param parent parent widget for the editor
+ \return created editor widget
+*/
QWidget* QtxPathListEdit::createEditor( QWidget* parent )
{
QtxPathEdit* edit = new Editor( parent );
return edit;
}
+/*!
+ \brief Set modified data from the editor to the list widget.
+ \param editor editor widget
+ \param index data model index
+*/
void QtxPathListEdit::setModelData( QWidget* editor, const QModelIndex& index )
{
QtxPathEdit* edit = ::qobject_cast<QtxPathEdit*>( editor );
myModel->setData( index, path, Qt::EditRole );
}
+/*!
+ \brief Set data to the editor from the list widget when
+ user starts path edition.
+ \param editor editor widget
+ \param index data model index
+*/
void QtxPathListEdit::setEditorData( QWidget* editor, const QModelIndex& index )
{
QtxPathEdit* edit = ::qobject_cast<QtxPathEdit*>( editor );
edit->setPath( v.toString() );
}
+/*!
+ \brief Check if path is correct (exists) and optionally
+ show the question message box.
+ \param str path to be checked
+ \param msg if \c true and path does not exist, question message box is shown
+ \return \c true if the user confirms the path adding
+*/
bool QtxPathListEdit::checkExistance( const QString& str, const bool msg )
{
if ( pathType() == Qtx::PT_SaveFile )
return ok;
}
+/*!
+ \brief Check if path already exists in the list and optionally
+ show the warning message box.
+ \param str path to be checked
+ \param row row corresponding to the path checked
+ \param msg if \c true and path does not exist, warning message box is shown
+ \return \c true if the user confirms the path adding
+*/
bool QtxPathListEdit::checkDuplicate( const QString& str, const int row, const bool msg )
{
int cur = -1;
/*!
\class QtxPreferenceItem::Updater
- Class for incapsulation of one preference item
+ \brief Preference item updater.
+ \internal
*/
class QtxPreferenceItem::Updater : public QObject
{
-public:
Updater();
+public:
~Updater();
static Updater* instance();
QtxPreferenceItem::Updater* QtxPreferenceItem::Updater::_Updater = 0;
+/*!
+ \brief Constructor.
+ \internal
+*/
QtxPreferenceItem::Updater::Updater()
{
}
+/*!
+ \brief Destructor.
+ \internal
+*/
QtxPreferenceItem::Updater::~Updater()
{
}
+/*!
+ \brief Get the only updater instance.
+ \internal
+ \return the only updater instance
+*/
QtxPreferenceItem::Updater* QtxPreferenceItem::Updater::instance()
{
if ( !_Updater )
return _Updater;
}
+/*!
+ \brief Update the preference item.
+ \internal
+ \param item preference item to be updated
+*/
void QtxPreferenceItem::Updater::updateItem( QtxPreferenceItem* item )
{
if ( !item || myItems.contains( item ) )
QApplication::postEvent( this, new QEvent( QEvent::User ) );
}
+/*!
+ \brief Called when preference item is removed.
+ \internal
+ \param item preference item being removed
+*/
void QtxPreferenceItem::Updater::removeItem( QtxPreferenceItem* item )
{
myItems.removeAll( item );
}
-void QtxPreferenceItem::Updater::customEvent( QEvent* e )
+/*!
+ \brief Custom events provessing. Updates all the items.
+ \internal
+ \param e custom event (not used)
+*/
+void QtxPreferenceItem::Updater::customEvent( QEvent* /*e*/ )
{
QList<QtxPreferenceItem*> lst = myItems;
for ( QList<QtxPreferenceItem*>::const_iterator it = lst.begin(); it != lst.end(); ++it )
/*!
\class QtxPreferenceItem
- Class for incapsulation of one preference item
-*/
+ \brief Base class for implementing of all the preference items.
+ To implement any specific preference item, cubclass from the
+ QtxPreferenceItem and redefine store() and retrieve() methods.
+*/
/*!
- Constructor
+ \brief Constructor.
+ \param parent parent preference item
*/
QtxPreferenceItem::QtxPreferenceItem( QtxPreferenceItem* parent )
: myParent( 0 )
parent->insertItem( this );
}
+/*!
+ \brief Constructor.
+ \param title item title
+ \param parent parent preference item
+*/
QtxPreferenceItem::QtxPreferenceItem( const QString& title, QtxPreferenceItem* parent )
: myParent( 0 ),
-myTitle( title )
+ myTitle( title )
{
myId = generateId();
parent->insertItem( this );
}
+/*!
+ \brief Constructor.
+ \param title item title
+ \param sect resource file section to be associated with the item
+ \param param resource file parameter to be associated with the item
+ \param parent parent preference item
+*/
QtxPreferenceItem::QtxPreferenceItem( const QString& title, const QString& sect,
const QString& param, QtxPreferenceItem* parent )
: myParent( 0 ),
-myTitle( title ),
-mySection( sect ),
-myParameter( param )
+ myTitle( title ),
+ mySection( sect ),
+ myParameter( param )
{
myId = generateId();
}
/*!
- Destructor
+ \brief Destructor.
*/
QtxPreferenceItem::~QtxPreferenceItem()
{
}
/*!
- \return id of item
+ \brief Get unique item identifier.
+ \return item ID
*/
int QtxPreferenceItem::id() const
{
return myId;
}
+/*!
+ \brief Get unique item type identifier.
+ \return item type ID
+*/
int QtxPreferenceItem::rtti() const
{
return QtxPreferenceItem::RTTI();
}
+/*!
+ \brief Specify unique item class identifier.
+ \return item class ID
+*/
int QtxPreferenceItem::RTTI()
{
return 1;
}
/*!
+ \brief Get root preference item.
\return root item
*/
QtxPreferenceItem* QtxPreferenceItem::rootItem() const
}
/*!
+ \brief Get parent preference item.
\return parent item
*/
QtxPreferenceItem* QtxPreferenceItem::parentItem() const
}
/*!
- Appends child and (if necessary) removes item from old parent
- \param item - item to be added
+ \brief Append child preference item.
+
+ Removes (if necessary) the item from the previous parent.
+
+ \param item item to be added
+ \sa removeItem()
*/
void QtxPreferenceItem::insertItem( QtxPreferenceItem* item )
{
}
/*!
- Removes child
- \param item - item to be removed
+ \brief Remove child preference item.
+ \param item item to be removed
+ \sa insertItem()
*/
void QtxPreferenceItem::removeItem( QtxPreferenceItem* item )
{
}
/*!
- Fills list with children items
- \param lst - list to be filled with
+ \brief Get all child preference items.
+ \param rec recursion boolean flag
+ \return list of child items
*/
QList<QtxPreferenceItem*> QtxPreferenceItem::childItems( const bool rec ) const
{
return lst;
}
+/*!
+ \brief Get preference item depth.
+ \return item depth
+*/
int QtxPreferenceItem::depth() const
{
return parentItem() ? parentItem()->depth() + 1 : 0;
}
+/*!
+ \brief Get child preference items number.
+ \return number of child items
+ \sa isEmpty()
+*/
int QtxPreferenceItem::count() const
{
return myChildren.count();
}
/*!
- \return true if there is no children of this item
+ \brief Check if the item has children.
+ \return \c true if item does not have children
+ \sa count()
*/
bool QtxPreferenceItem::isEmpty() const
{
}
/*!
- \return icon of item
+ \brief Get preference item icon.
+ \return item icon
+ \sa setIcon()
*/
QIcon QtxPreferenceItem::icon() const
{
}
/*!
- \return title of item
+ \brief Get preference item title.
+ \return item title
+ \sa setTitle()
*/
QString QtxPreferenceItem::title() const
{
}
/*!
- \return assigned resource placement
- \param sec - to return section
- \param param - to return param name
+ \brief Get resource file settings associated to the preference item.
+ \param sec used to return resource file section name
+ \param param used to return resource file parameter name
+ \sa setResource()
*/
void QtxPreferenceItem::resource( QString& sec, QString& param ) const
{
}
/*!
- Sets item icon
- \param ico - new item icon
+ \brief Set prefence item icon.
+ \param ico new item icon
+ \sa icon()
*/
void QtxPreferenceItem::setIcon( const QIcon& ico )
{
}
/*!
- Sets item title
- \param title - new item title
+ \brief Set preference item title .
+ \param title new item title
+ \sa title()
*/
void QtxPreferenceItem::setTitle( const QString& title )
{
}
/*!
- Assigns new resource to item
- \param sec - section
- \param sec - param name
+ \brief Assign resource file settings to the preference item.
+ \param sec resource file section name
+ \param param resource file parameter name
+ \sa resource()
*/
void QtxPreferenceItem::setResource( const QString& sec, const QString& param )
{
}
/*!
- Updates item (default implementation is empty)
+ \brief Update preference item.
*/
void QtxPreferenceItem::updateContents()
{
}
/*!
- \return property value
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOption()
*/
QVariant QtxPreferenceItem::option( const QString& name ) const
{
}
/*!
- Sets property value
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa option()
*/
void QtxPreferenceItem::setOption( const QString& name, const QVariant& val )
{
}
/*!
- \return value of assigned resource
+ \fn void QtxPreferenceItem::store();
+ \brief Save preference item (for example, to the resource file).
+
+ This method should be implemented in the subclasses.
+
+ \sa retrieve()
+*/
+
+/*!
+ \fn virtual void QtxPreferenceItem::retrieve();
+ \brief Restore preference item (for example, from the resource file).
+
+ This method should be implemented in the subclasses.
+
+ \sa store()
+*/
+
+/*!
+ \brief Get the value of the associated resource file setting.
+ \return associated resource file setting value
+ \sa setResourceValue()
*/
QString QtxPreferenceItem::resourceValue() const
{
}
/*!
- Sets value of assigned resource
- \param val - new value
+ \brief Get the value of the associated resource file setting.
+ \param val new associated resource file setting value
+ \sa resourceValue()
*/
void QtxPreferenceItem::setResourceValue( const QString& val )
{
}
/*!
- \return corresponding resource manager
+ \brief Get the resources manager.
+ \return resource manager pointer or 0 if it is not defined
*/
QtxResourceMgr* QtxPreferenceItem::resourceMgr() const
{
}
/*!
- \return corresponding resource edit
+ \brief Get the parent preferences manager.
+ \return preferences manager or 0 if it is not defined
*/
QtxPreferenceMgr* QtxPreferenceItem::preferenceMgr() const
{
}
/*!
- \return other item
- \param id - other item id
+ \brief Find the item by the specified identifier.
+ \param id child item ID
+ \param rec if \c true recursive search is done
+ \return child item or 0 if it is not found
*/
QtxPreferenceItem* QtxPreferenceItem::findItem( const int id, const bool rec ) const
{
}
/*!
- \return other item
- \param title - other item title
+ \brief Find the item by the specified title.
+ \param title child item title
+ \param rec if \c true recursive search is done
+ \return child item or 0 if it is not found
*/
QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const bool rec ) const
{
}
/*!
- \return other item
- \param title - other item title
- \param id - parent item id
+ \brief Find the item by the specified title and identifier.
+ \param title child item title
+ \param id child item ID
+ \param rec if \c true recursive search is done
+ \return child item or 0 if it is not found
*/
QtxPreferenceItem* QtxPreferenceItem::findItem( const QString& title, const int id, const bool rec ) const
{
/*!
- \return integer value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get integer resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return integer value of the associated resource
+ \sa setInteger()
*/
int QtxPreferenceItem::getInteger( const int val ) const
{
}
/*!
- \return double value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get double resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return double value of the associated resource
+ \sa setDouble()
*/
double QtxPreferenceItem::getDouble( const double val ) const
{
}
/*!
- \return boolean value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get boolean resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return boolean value of the associated resource
+ \sa setBoolean()
*/
bool QtxPreferenceItem::getBoolean( const bool val ) const
{
}
/*!
- \return string value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get string resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return string value of the associated resource
+ \sa setString()
*/
QString QtxPreferenceItem::getString( const QString& val ) const
{
}
/*!
- \return color value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get color resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return color value of the associated resource
+ \sa setColor()
*/
QColor QtxPreferenceItem::getColor( const QColor& val ) const
{
}
/*!
- \return font value of resource corresponding to item
- \param val - default value (it is returned if there is no such resource)
+ \brief Get font resources value corresponding to the item.
+ \param val default value (returned if there is no such resource)
+ \return font value of the associated resource
+ \sa setFont()
*/
QFont QtxPreferenceItem::getFont( const QFont& val ) const
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set integer resources value corresponding to the item.
+ \param val new value
+ \sa getInteger()
*/
void QtxPreferenceItem::setInteger( const int val )
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set double resources value corresponding to the item.
+ \param val new value
+ \sa getDouble()
*/
void QtxPreferenceItem::setDouble( const double val )
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set boolean resources value corresponding to the item.
+ \param val new value
+ \sa getBoolean()
*/
void QtxPreferenceItem::setBoolean( const bool val )
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set string resources value corresponding to the item.
+ \param val new value
+ \sa getString()
*/
void QtxPreferenceItem::setString( const QString& val )
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set color resources value corresponding to the item.
+ \param val new value
+ \sa getColor()
*/
void QtxPreferenceItem::setColor( const QColor& val )
{
}
/*!
- Sets value of resource
- \param val - value
+ \brief Set font resources value corresponding to the item.
+ \param val new value
+ \sa getFont()
*/
void QtxPreferenceItem::setFont( const QFont& val )
{
resMgr->setValue( mySection, myParameter, val );
}
-void QtxPreferenceItem::itemAdded( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is added.
+
+ This function can be reimplemented in the subclasses to customize
+ child item addition operation. Base implementation does nothing.
+
+ \param item child item being added
+ \sa itemRemoved(), itemChanged()
+*/
+void QtxPreferenceItem::itemAdded( QtxPreferenceItem* /*item*/ )
{
}
-void QtxPreferenceItem::itemRemoved( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is removed.
+
+ This function can be reimplemented in the subclasses to customize
+ child item removal operation. Base implementation does nothing.
+
+ \param item child item being removed
+ \sa itemAdded(), itemChanged()
+*/
+void QtxPreferenceItem::itemRemoved( QtxPreferenceItem* /*item*/ )
{
}
-void QtxPreferenceItem::itemChanged( QtxPreferenceItem* )
+/*!
+ \brief Callback function which is called when the child
+ preference item is modified.
+
+ This function can be reimplemented in the subclasses to customize
+ child item modifying operation. Base implementation does nothing.
+
+ \param item child item being modified
+ \sa itemAdded(), itemRemoved()
+*/
+void QtxPreferenceItem::itemChanged( QtxPreferenceItem* /*item*/ )
{
}
+/*!
+ \brief Initiate item updating.
+*/
void QtxPreferenceItem::triggerUpdate()
{
Updater::instance()->updateItem( this );
}
-QVariant QtxPreferenceItem::optionValue( const QString& ) const
+/*!
+ \brief Get preference item option value.
+
+ This function can be reimplemented in the subclasses.
+ Base implementation does nothing.
+
+ \param name option name
+ \return property value or null QVariant if option is not set
+ \sa setOptionValue()
+*/
+QVariant QtxPreferenceItem::optionValue( const QString& /*name*/ ) const
{
return QVariant();
}
-void QtxPreferenceItem::setOptionValue( const QString&, const QVariant& )
+/*!
+ \brief Set preference item option value.
+
+ This function can be reimplemented in the subclasses.
+ Base implementation does nothing.
+
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
+void QtxPreferenceItem::setOptionValue( const QString& /*name*/, const QVariant& /*val*/ )
{
}
+/*!
+ \brief Initiate item changing call back operation.
+*/
void QtxPreferenceItem::sendItemChanges()
{
if ( parentItem() )
}
/*!
- \return free item id
+ \brief Generate unique preference item identifier.
+ \return unique item ID
*/
int QtxPreferenceItem::generateId()
{
return _id++;
}
-
-
/*!
\class QtxPreferenceMgr
- Class for managing preferences items
+ \brief Class for managing preferences items.
*/
-
-
/*!
- Constructor
+ \brief Constructor.
+ \param mgr resources manager
*/
QtxPreferenceMgr::QtxPreferenceMgr( QtxResourceMgr* mgr )
: QtxPreferenceItem( 0 ),
-myResMgr( mgr )
+ myResMgr( mgr )
{
}
/*!
- Destructor
+ \brief Destructor.
*/
QtxPreferenceMgr::~QtxPreferenceMgr()
{
}
/*!
- \return assigned resource manager
+ \brief Get the resources manager.
+ \return resource manager pointer or 0 if it is not defined
*/
QtxResourceMgr* QtxPreferenceMgr::resourceMgr() const
{
return myResMgr;
}
+/*!
+ \brief Get the parent preferences manager.
+ \return pointer to itself
+*/
QtxPreferenceMgr* QtxPreferenceMgr::preferenceMgr() const
{
return (QtxPreferenceMgr*)this;
}
-/*!
- Adds new item
- \param label - label of widget to edit preference
- \param pId - parent item id
- \param type - type of item
- \param section - section of resource assigned with item
- \param param - name of resource assigned with item
+/*
+ \brief Add new preference item.
+ \param label label of widget to edit preference item
+ \param pId parent preference item id
+ \param type preference item type
+ \param section resource file section associated to the preference item
+ \param param resource file parameter associated to the preference item
*/
/*
int QtxPreferenceMgr::addItem( const QString& label, const int pId, const int type,
*/
/*!
- \return value of item property
- \param id - item id
- \propName - propertyName
+ \brief Get preference item option value.
+ \param id preference item ID
+ \param propName option name
+ \return property value or null QVariant if option is not set
+ \sa setOption()
*/
QVariant QtxPreferenceMgr::option( const int id, const QString& propName ) const
{
propValue = i->option( propName );
return propValue;
}
+
/*!
- Sets value of item property
- \param id - item id
- \propName - propertyName
- \propValue - new value of property
+ \brief Set preference item option value.
+ \param id preference item ID
+ \param propName option name
+ \param propValue new property value
+ \sa option()
*/
void QtxPreferenceMgr::setOption( const int id, const QString& propName, const QVariant& propValue )
{
}
/*!
- Stores all values to resource manager
+ \brief Store all preferences item to the resource manager.
+ \sa retrieve()
*/
void QtxPreferenceMgr::store()
{
}
/*!
- Retrieve all values from resource manager
+ \brief Retrieve all preference items from the resource manager.
+ \sa store()
*/
void QtxPreferenceMgr::retrieve()
{
}
/*!
- Stores all values to backup container
+ \brief Dumps all values to the backup container.
+ \sa fromBackup()
*/
void QtxPreferenceMgr::toBackup()
{
}
/*!
- Retrieve all values from backup container
+ \brief Restore all values from the backup container.
+ \sa toBackup()
*/
void QtxPreferenceMgr::fromBackup()
{
}
/*!
- Updates resource edit (default implementation is empty)
+ \brief Update preferences manager.
+
+ Base implementation does nothing.
*/
void QtxPreferenceMgr::update()
{
}
-/*!
- Creates item
+/*
+ \brief Create preference item.
+ \param label preference item title
+ \param type preference item type
+ \param pId parent preference item ID
\return new item
- \param label - text of label for new item
- \param type - type of new item
- \param pId - parent id
-
+*/
+/*
QtxPreferenceItem* QtxPreferenceMgr::createItem( const QString& label, const int type, const int pId )
{
Item* i = 0;
*/
/*!
- \return all resources values from widgets
- \param map - map to be filled by resources values
+ \brief Get all resources items values.
+ \param map used as container filled with the resources values (<ID>:<value>)
+ \sa setResourceValues()
*/
void QtxPreferenceMgr::resourceValues( QMap<int, QString>& map ) const
{
}
/*!
- \return all resources values from widgets
- \param map - map to be filled by resources values
+ \brief Get all resources items values.
+ \param map used as container filled with the resources values
+ (<item>:<value>)
+ \sa setResourceValues()
*/
void QtxPreferenceMgr::resourceValues( ResourceMap& map ) const
{
}
/*!
- Sets to widgets all resources values from map
- \param map - map with resources values
+ \brief Set all resources items values.
+ \param map map with resources values (<ID>:<value>)
+ \sa resourceValues()
*/
void QtxPreferenceMgr::setResourceValues( QMap<int, QString>& map ) const
{
}
/*!
- Sets to widgets all resources values from map
- \param map - map with resources values
+ \brief Set all resources items values.
+ \param map map with resources values (<item>:<value>)
+ \sa resourceValues()
*/
void QtxPreferenceMgr::setResourceValues( ResourceMap& map ) const
{
}
/*!
- Compares two map of resources values and finds different ones
- \param map1 - first map
- \param map2 - second map
- \param resMap - map to be filled with different values
- \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+ \brief Compare two maps of resources values to find differences.
+ \param map1 first map
+ \param map2 second map
+ \param resMap map to be filled with different values
+ \param fromFirst if \c true, then \a resMap will be filled with the values
+ from \a map1, otherwise - from \a map2
*/
void QtxPreferenceMgr::differentValues( const QMap<int, QString>& map1, const QMap<int, QString>& map2,
QMap<int, QString>& resMap, const bool fromFirst ) const
}
/*!
- Compares two map of resources values and finds different ones
- \param map1 - first map
- \param map2 - second map
- \param resMap - map to be filled with different values
- \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+ \brief Compare two maps of resources values to find differences.
+ \param map1 first map
+ \param map2 second map
+ \param resMap map to be filled with different values
+ \param fromFirst if \c true, then \a resMap will be filled with the values
+ from \a map1, otherwise - from \a map2
*/
void QtxPreferenceMgr::differentValues( const ResourceMap& map1, const ResourceMap& map2,
ResourceMap& resMap, const bool fromFirst ) const
}
/*!
- Makes some activity on resource changing (called from store() method)
- \sa store()
+ \brief Perform custom activity on resource changing.
+
+ This method is called from store() and fromBackup() methods.
+ Base implementation does nothing.
+
+ \sa store(), fromBackup()
*/
void QtxPreferenceMgr::changedResources( const ResourceMap& )
{
class QtxResourceMgr;
class QtxPreferenceMgr;
-/*!
- \class QtxPreferenceItem
- Class for incapsulation of one preference item
-*/
class QTX_EXPORT QtxPreferenceItem
{
class Updater;
QString myParameter;
};
-
-/*!
- \class QtxPreferenceMgr
- Class for managing preferences items
-*/
class QTX_EXPORT QtxPreferenceMgr : public QtxPreferenceItem
{
public:
PT_Font = LightApp_Preferences::Font,
PT_DirList = LightApp_Preferences::DirList,
PT_File = LightApp_Preferences::File,
- PT_User = LightApp_Preferences::User
};
class SalomePyQt
PT_Font,
PT_DirList,
PT_File,
- PT_User
};
class QtxAction : QAction
if ( !action() )
return false;
- return action()->addTo( wid );
-}
-
-/*! Add action to widget \a wid.
- *\retval TRUE - successful, FALSE - not successful.
- */
-bool SUIT_ActionOperation::addTo( QWidget* wid, int idx )
-{
- if ( !action() )
- return false;
-
- return action()->addTo( wid, idx );
+ wid->addAction( action() );
+ return true;
}
/*! Set status tip for action.
virtual void setAction( QtxAction* theAction );
bool addTo( QWidget* theWidget );
- bool addTo( QWidget* theWidget, int thePos );
void setStatusTip( const QString& theTip );
//@}
*/
void SUPERVGraph_ViewFrame::createToolBar()
{
- myActionsMap[PanId]->addTo(myToolBar);
- myActionsMap[ResetId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[PanId] );
+ myToolBar->addAction( myActionsMap[ResetId] );
}
/*!
SVTK_MainWindow
::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
- myActionsMap[ViewTrihedronId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[DumpId] );
+ myToolBar->addAction( myActionsMap[ViewTrihedronId] );
SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
aScaleBtn->AddAction(myActionsMap[FitAllId]);
aPanningBtn->AddAction(myActionsMap[PanId]);
aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
- myActionsMap[ChangeRotationPointId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ChangeRotationPointId] );
- myActionsMap[RotationId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[RotationId] );
SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
aViewsBtn->AddAction(myActionsMap[FrontId]);
aViewsBtn->AddAction(myActionsMap[LeftId]);
aViewsBtn->AddAction(myActionsMap[RightId]);
- myActionsMap[ResetId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ResetId] );
- myActionsMap[UpdateRate]->addTo(myToolBar);
- myActionsMap[NonIsometric]->addTo(myToolBar);
- myActionsMap[GraduatedAxes]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[UpdateRate] );
+ myToolBar->addAction( myActionsMap[NonIsometric] );
+ myToolBar->addAction( myActionsMap[GraduatedAxes] );
}
/*!
pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ).toLatin1() ), defCols,
LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
- pref->setItemProperty( defCols, "columns", 1 );
+ pref->setItemProperty( "columns", 1, defCols );
// adding preference to LightApp_Application handled preferences.. a bit of hacking with resources..
int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat );
/*!Create tool bar.*/
void VTKViewer_ViewWindow::createToolBar()
{
- myActionsMap[DumpId]->addTo(myToolBar);
- myActionsMap[TrihedronShowId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[DumpId] );
+ myToolBar->addAction( myActionsMap[TrihedronShowId] );
SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
aScaleBtn->AddAction(myActionsMap[FitAllId]);
aPanningBtn->AddAction(myActionsMap[PanId]);
aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
- myActionsMap[RotationId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[RotationId] );
SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
aViewsBtn->AddAction(myActionsMap[FrontId]);
aViewsBtn->AddAction(myActionsMap[LeftId]);
aViewsBtn->AddAction(myActionsMap[RightId]);
- myActionsMap[ResetId]->addTo(myToolBar);
+ myToolBar->addAction( myActionsMap[ResetId] );
}
/*!On front view event.*/