CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkSettingsPanel Class Reference

#include <Libs/Widgets/ctkSettingsPanel.h>

Inheritance diagram for ctkSettingsPanel:
Inheritance graph
[legend]
Collaboration diagram for ctkSettingsPanel:
Collaboration graph
[legend]

Public Types

enum  SettingOption { OptionNone = 0x0000 , OptionRequireRestart = 0x0001 , OptionAll_Mask = ~0 }
 
typedef QWidget Superclass
 Superclass typedef. More...
 

Public Slots

virtual void applySettings ()
 
virtual void reloadSettings ()
 
virtual void resetSettings ()
 
virtual void restoreDefaultSettings ()
 

Signals

void settingChanged (const QString &key, const QVariant &value)
 Fired anytime a property is modified. More...
 

Public Member Functions

QStringList changedSettings () const
 
 ctkSettingsPanel (QWidget *parent=0)
 Constructor. More...
 
void registerProperty (const QString &settingKey, QObject *object, const QString &objectProperty, const char *propertySignal, const QString &settingLabel=QString(), SettingOptions options=OptionNone, QSettings *settings=0)
 
Q_INVOKABLE void registerProperty (const QString &settingKey, QObject *object, const QString &objectProperty, const QByteArray &propertySignal, const QString &settingLabel=QString(), SettingOptions options=OptionNone, QSettings *settings=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void setSetting (const QString &key, const QVariant &newVal)
 
void setSettings (QSettings *settings)
 
QString settingLabel (const QString &settingKey) const
 Return the label associated to a setting. More...
 
SettingOptions settingOptions (const QString &settingKey) const
 Return the options associated to a setting. More...
 
QSettings * settings () const
 
virtual ~ctkSettingsPanel ()
 Destructor. More...
 

Protected Slots

void updateSetting (const QString &key)
 

Protected Member Functions

QVariant defaultPropertyValue (const QString &key) const
 
QVariant previousPropertyValue (const QString &key) const
 
QVariant propertyValue (const QString &key) const
 

Protected Attributes

QScopedPointer< ctkSettingsPanelPrivate > d_ptr
 

Properties

QSettings * settings
 

Detailed Description

Definition at line 35 of file ctkSettingsPanel.h.

Member Typedef Documentation

◆ Superclass

Superclass typedef.

Definition at line 45 of file ctkSettingsPanel.h.

Member Enumeration Documentation

◆ SettingOption

Enumerator
OptionNone 
OptionRequireRestart 
OptionAll_Mask 

Definition at line 56 of file ctkSettingsPanel.h.

Constructor & Destructor Documentation

◆ ctkSettingsPanel()

ctkSettingsPanel::ctkSettingsPanel ( QWidget *  parent = 0)
explicit

Constructor.

◆ ~ctkSettingsPanel()

virtual ctkSettingsPanel::~ctkSettingsPanel ( )
virtual

Destructor.

Member Function Documentation

◆ applySettings

virtual void ctkSettingsPanel::applySettings ( )
virtualslot

Forget the old property values so next time resetSettings is called it will set the properties with the same values when applySettings() is called.

Reimplemented in ctkCmdLineModuleExplorerModulesSettings, ctkCmdLineModuleExplorerGeneralModuleSettings, and ctkCmdLineModuleExplorerDirectorySettings.

◆ changedSettings()

QStringList ctkSettingsPanel::changedSettings ( ) const

Return the list of settings keys that have been modified and are not yet applied.

◆ defaultPropertyValue()

QVariant ctkSettingsPanel::defaultPropertyValue ( const QString &  key) const
protected

Return the default value of a property identified by its settings key

See also
registerProperty();

◆ previousPropertyValue()

QVariant ctkSettingsPanel::previousPropertyValue ( const QString &  key) const
protected

Return the previous value of a property identified by its settings key

See also
registerProperty();

◆ propertyValue()

QVariant ctkSettingsPanel::propertyValue ( const QString &  key) const
protected

Return the value of a property identified by its settings key

See also
registerProperty();

◆ registerProperty() [1/2]

void ctkSettingsPanel::registerProperty ( const QString &  settingKey,
QObject *  object,
const QString &  objectProperty,
const char *  propertySignal,
const QString &  settingLabel = QString(),
SettingOptions  options = OptionNone,
QSettings *  settings = 0 
)

Add an entry into the settings uniquely defined by the key name and the current value of the property. The property is then synchronized with the settings by observing the signal notification. Anytime the property is modified (the signal signal is fired), its value associated to key is updated in the settings. signal is typically the value under NOTIFY in Q_PROPERTY. The current value of the property is later used when restoreDefaultSettings() is called. If you want to register the logical complement of a boolean property you can use ctkBooleanMapper: panel->registerProperty("unchecked", new ctkBooleanMapper(checkBox, "checked", SIGNAL(toggled(bool))), "complement", SIGNAL(complementChanged(bool))); By default, property are associated with the general settings set using setSettings(QSettings*) or ctkSettingsDialog::setSettings(QSettings*). Note that it also possible to associate a specific settings for any given settingKey.

See also
Q_PROPERTY(),
ctkBooleanMapper

◆ registerProperty() [2/2]

Q_INVOKABLE void ctkSettingsPanel::registerProperty ( const QString &  settingKey,
QObject *  object,
const QString &  objectProperty,
const QByteArray &  propertySignal,
const QString &  settingLabel = QString(),
SettingOptions  options = OptionNone,
QSettings *  settings = 0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ reloadSettings

virtual void ctkSettingsPanel::reloadSettings ( )
virtualslot

Reload all properties from disk.

This reloads all properties from their respective QSettings instance(s). The previous values are discarded (as in resetSettings()).

See also
resetSettings(), restoreDefaultSettings()

◆ resetSettings

virtual void ctkSettingsPanel::resetSettings ( )
virtualslot

Restore all the properties with their values when applySettings() was called last (or their original values if applySettings was never called).

◆ restoreDefaultSettings

virtual void ctkSettingsPanel::restoreDefaultSettings ( )
virtualslot

Restore all the properties with their original values; the current values of the properties when they were registered using registerProperty().

◆ setSetting()

void ctkSettingsPanel::setSetting ( const QString &  key,
const QVariant &  newVal 
)

Set the setting to the property defined by the key. The old value can be restored using resetSettings()

◆ setSettings()

void ctkSettingsPanel::setSettings ( QSettings *  settings)

◆ settingChanged

void ctkSettingsPanel::settingChanged ( const QString &  key,
const QVariant &  value 
)
signal

Fired anytime a property is modified.

◆ settingLabel()

QString ctkSettingsPanel::settingLabel ( const QString &  settingKey) const

Return the label associated to a setting.

◆ settingOptions()

SettingOptions ctkSettingsPanel::settingOptions ( const QString &  settingKey) const

Return the options associated to a setting.

◆ settings()

QSettings* ctkSettingsPanel::settings ( ) const

◆ updateSetting

void ctkSettingsPanel::updateSetting ( const QString &  key)
protectedslot

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkSettingsPanelPrivate> ctkSettingsPanel::d_ptr
protected

Definition at line 154 of file ctkSettingsPanel.h.

Property Documentation

◆ settings

QSettings* ctkSettingsPanel::settings
readwrite

Definition at line 1 of file ctkSettingsPanel.h.


The documentation for this class was generated from the following file: