QSettingsDialog
1.0.0
A Qt library to easily create a settings dialog for user configurable settings
|
A static class to globally register different types of edit widgets. More...
#include <variantwidgetsregistrator.h>
Static Public Member Functions | |
static void | registerGroupWidgets () |
Registeres the default group widgets. More... | |
static void | registerVariantWidgets () |
Registeres the default edit widgets. More... | |
static void | registerEnumFactories () |
Registeres the enum and flag edit widget facotries. More... | |
static void | registerExtendedVariantWidgets () |
Registeres the extended edit widgets. More... | |
A static class to globally register different types of edit widgets.
The static members of this class can be used to globally register different types of edit widgets. They are seperated into four groups, each represented by one of the member functions.
|
static |
Registeres the enum and flag edit widget facotries.
A registry is installed that is able to automatically create edit widgets for basically any enum or flags.
The requirement for enums to be used is to register the enum with #Q_ENUM. The id of the correpsonding widget will be qMetaTypeId<MyEnum>()
.
The enum can be displayed as a combobox or as a list of radiobuttons. This can be done using special properties.
showAsRadio : bool
-> Can be used to show a radiolist instead of a combox. Defaults to falsetranslated : bool
-> If set (the default), the combobox will look for translationsTo have flags, the flags type has to be created using #Q_DECLARE_FLAGS and have to be registered with #Q_FLAG. However, in addition to that, you will have to register converter operations to QVariant to make the flags work. Use the REGISTER_FLAG_CONVERTERS macro in your main after you created the QApplication to do so.
The flags will be displayed as a Checklist. It too provides the translation property:
translated : bool
-> If set (the default), the combobox will look for translationsAll translations will be done by using the enums name as context and the values name as key. Simple example:
Will have MyEnum
as context and Value0
(or Value1
) as key for the translation.
|
static |
Registeres the extended edit widgets.
The extended widgets are widgets that I decided are somewhat important to have, but are not represented by the default widgets. The following list shows all included types with their edit widgets:
Class-Name | Edit widget |
---|---|
FilePath | QPathEdit |
IntRange | QSlider |
HtmlText | QTextEdit (with advanced context menu) |
To get the id's of each of these types, use e.g. qMetaTypeId<FilePath>()
as id for the QSettingsEntry displayId.
|
static |
Registeres the default group widgets.
The groups widgets are for now just one - the default group widget that is a QGroupBox. It has the id 0
|
static |
Registeres the default edit widgets.
The default widgets are widgets for known and editable types that are registered as metatypes. The following list shows all included types with their edit widgets:
Metatype | Edit widget |
---|---|
QMetaType::Bool | QCheckBox |
QMetaType::UInt | QSpinBox |
QMetaType::Double | QDoubleSpinBox |
QMetaType::QString | QLineEdit |
QMetaType::QByteArray | QLineEdit |
QMetaType::Long | QSpinBox |
QMetaType::LongLong | QSpinBox |
QMetaType::Short | QSpinBox |
QMetaType::Char | QSpinBox |
QMetaType::Ulong | QSpinBox |
QMetaType::ULongLong | QSpinBox |
QMetaType::UShort | QSpinBox |
QMetaType::SChar | QSpinBox |
QMetaType::UChar | QSpinBox |
QMetaType::Float | QDoubleSpinBox |
QMetaType::QDate | QDateEdit |
QMetaType::QTime | QTimeEdit |
QMetaType::QColor | QColorEdit |
QMetaType::QStringList | ListEdit (custom class) |
QMetaType::QUrl | QLineEdit (with validator) |
QMetaType::QDateTime | QDateTimeEdit |
QMetaType::QFont | QFontComboBox |
QMetaType::QKeySequence | QKeySequenceEdit |
QMetaType::QUuid | QLineEdit (with validator) |