QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
Classes | Macros
Dialog-UI

The display module of the dialog library. More...

Classes

class  QSettingsWidgetDialogEngine
 The default engine implementation for the settings dialog. More...
 
class  QSettingsWidgetBase
 The base class for edit widgets in the settings dialog. More...
 
class  QSettingsWidget< TWidget >
 Generic base class for settings widgets. More...
 
class  QSettingsWidgetFactory
 The base class for a factory to create QSettingsWidgets. More...
 
class  GenericSettingsWidgetFactory< TSettingsWidget >
 [INTERNAL USE] Generic base class for a factory to create QSettingsWidgets More...
 
class  QSettingsWidgetFactoryRegistry
 A registry to load widget factories based on an id. More...
 
class  QSettingsDialogWidgetBase
 The base class for dialog based edit widgets in the settings dialog. More...
 
class  QSettingsDialogWidget< TSettingsWidget >
 A generic class to easily create a dialog widget from a normal one. More...
 
class  QSettingsGroupWidgetBase
 The base class for group widgets in the settings dialog. More...
 
class  QSettingsGroupWidget< TWidget >
 Generic base class for group widgets. More...
 
class  QSettingsGroupWidgetFactory
 The base class for a factory to create QSettingsGroupWidgets. More...
 
class  GenericSettingsGroupWidgetFactory< TSettingsGroupWidget >
 [INTERNAL USE] Generic base class for a factory to create QSettingsWidgets More...
 

Macros

#define REGISTER_TYPE_CONVERTERS(TypeA, TypeB)
 A macro for type converter registration. More...
 
#define REGISTER_FLAG_CONVERTERS(FlagsType)   REGISTER_TYPE_CONVERTERS(FlagsType, int)
 A macro to register flag types. More...
 

Detailed Description

The display module of the dialog library.

The Dialog-UI part of the library is responsible for creating the actual visible dialog from the cores data. This module defines the QSettingsWidgetDialogEngine that will be used as default engine by the QSettingsDialog for dialog creation. The most important part of this engine are it's add/registery functions, that allow you to define custom edit widgets and group widgets.

Dialog-UI Structure

The following diagramm describes the Dialog-UI structure. Bold classes are the most important ones for you as an api user:

structure_dialogui.svg
The Dialog-UI-Structure in a class diagram

Examples

The core can be found in any of the default examples, but all of it's features are tested out in the EngineTest and the VariantWidgetsTest. Use these examples if you interested in all the feature of the Dialog-UI.

Macro Definition Documentation

#define REGISTER_FLAG_CONVERTERS (   FlagsType)    REGISTER_TYPE_CONVERTERS(FlagsType, int)

A macro to register flag types.

Parameters
FlagsTypeThe custom QFlags class that should have it's converters registered

This macro will use REGISTER_TYPE_CONVERTERS to make it possible to convert your custom flags from and to int. This is required if you want to use the flags type with the QSettingsDialog!

#define REGISTER_TYPE_CONVERTERS (   TypeA,
  TypeB 
)
Value:
do {\
QMetaType::registerConverter<TypeA, TypeB>([](TypeA aVal) -> TypeB {\
return (TypeB)aVal;\
});\
QMetaType::registerConverter<TypeB, TypeA>([](TypeB bVal) -> TypeA {\
return TypeA(bVal);\
});\
} while(false)

A macro for type converter registration.

Parameters
TypeAThe first, custom type that provides the converters
TypeBthe second, less complex type, that serves as "target" of these converters

This macro can be used to register simple type converters for QVariant. This may be required for some types to make it possible to use them with edit widgets.

Simple example: You defined your own class SuperInt. To edit it, you use a spinbox. Now since the spinbox uses int as a type, you need to convert these types. First step is to create conversion functionality in SuperInt. You will need a constructor from int and a conversion operator to int:

class SuperInt {
public:
SuperInt(int value);
operator int();
}

Next step is to register the converter using this macro. You do this in your main after you have create the QApplication:

REGISTER_TYPE_CONVERTERS(SuperInt, int);

Thats it. Now QVariant is able to internally convert these two types into each other, which makes it possible to do for example this:

SuperInt sup(42);
int test = var.toInt();//this will work now
QVariant var2 = test;
SuperInt back = var2.value<SuperInt>();//will work too