QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
Public Slots | Public Member Functions | Protected Member Functions | List of all members
QSectionSettingsContainer Class Reference

A settings container for sections. More...

#include <qsettingscontainer.h>

+ Inheritance diagram for QSectionSettingsContainer:

Public Slots

int appendEntry (QSettingsEntry *entry) override
 
int prependEntry (QSettingsEntry *entry) override
 
int insertEntry (int index, QSettingsEntry *entry) override
 
int insertEntry (int index, QSharedPointer< QSettingsEntry > entry) override
 
void appendGroup (const QString &id, int displayId=0, const QString &name=QString(), bool optional=false, const QString &tooltip=QString())
 Creates and appends a new group to the containers children.
 
void prependGroup (const QString &id, int displayId=0, const QString &name=QString(), bool optional=false, const QString &tooltip=QString())
 Creates and prepends a new group to the containers children.
 
void insertGroup (int index, const QString &id, int displayId=0, const QString &name=QString(), bool optional=false, const QString &tooltip=QString())
 Creates and inserts a new group to the containers children at the given index.
 
bool removeEntry (int id) override
 
bool removeGroup (const QString &id)
 Removes the group with the given id. More...
 
bool removeElementFromIndex (int index) override
 
void moveElement (int indexFrom, int indexTo) override
 
- Public Slots inherited from QSettingsContainer
virtual int appendEntry (QSettingsEntry *entry)=0
 Appends the entry to the containers children. More...
 
virtual int prependEntry (QSettingsEntry *entry)=0
 Prepends the entry to the containers children. More...
 
virtual int insertEntry (int index, QSettingsEntry *entry)=0
 Inserts the entry to the containers children at the given index. More...
 
virtual int insertEntry (int index, QSharedPointer< QSettingsEntry > entry)=0
 Appends the entry to the containers children at the given index.
 
virtual bool removeEntry (int id)=0
 Removes the entry with the given id. More...
 
virtual bool removeElementFromIndex (int index)=0
 Removes the element at the given index. More...
 
virtual void moveElement (int indexFrom, int indexTo)=0
 Moves the element from the old to the new index.
 

Public Member Functions

 QSectionSettingsContainer (QSettingsDialog *settingsDialog, const QString &containerPath, QObject *parent=nullptr)
 Creates a new container for a container at the given path for the given dialog. More...
 
 QSectionSettingsContainer (const QSettingsLayout &layout, QObject *parent=nullptr)
 Creates a new container from a settings layout. More...
 
 ~QSectionSettingsContainer ()
 Destructor.
 
QSettingsDialogdialog () const override
 Returns the dialog this container belongs to.
 
QString containerPath () const override
 Returns the container path this container has.
 
int elementCount () const override
 Returns the number of elements in this container.
 
bool isEntry (int index) const override
 Checks whether the element at the given index is an entry or not.
 
int getEntryIndex (int id) const override
 Searches for entries index. More...
 
int getGroupIndex (const QString &id) const
 Searches for groups index. More...
 
QVariant getElementId (int index) const
 Returns the id for the element at the index. More...
 
int getEntryId (int index) const override
 Returns the id for the entry at the index. More...
 
QString getGrouptId (int index) const
 Returns the id for the group at the index. More...
 
QSharedPointer< QSettingsEntrygetEntry (int id) const override
 Returns the entry with the given id. More...
 
QSharedPointer< QSettingsEntrygetEntryFromIndex (int index) const override
 Returns the entry at the given index. More...
 
bool transferElement (int indexFrom, QSettingsContainer *targetContainer, int indexTo) override
 Tries to transfer the element at index to the target container. More...
 
QGroupSettingsContainercreateGroupContainer (const QString &id)
 Creates a new container for the child group with the given id. More...
 
QGroupSettingsContainercreateGroupContainer (const QString &id, QObject *parent) const
 Creates a new container for the child group with the given id. More...
 
QGroupSettingsContainercreateGroupContainerFromIndex (int index)
 Creates a new container for the child group at the given index. More...
 
QGroupSettingsContainercreateGroupContainerFromIndex (int index, QObject *parent) const
 Creates a new container for the child group at the given index. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 

Protected Member Functions

bool acceptEntry (int index, int id, QSharedPointer< QSettingsEntry > entry) override
 Will be called to insert the given entry from a transfer. More...
 
- Protected Member Functions inherited from QSettingsContainer
 QSettingsContainer (QObject *parent=nullptr)
 Protected constructor.
 
bool doAccept (QSettingsContainer *target, int index, int id, QSharedPointer< QSettingsEntry > entry)
 [INTERNAL USE] Helper function
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A settings container for sections.

Constructor & Destructor Documentation

QSectionSettingsContainer::QSectionSettingsContainer ( QSettingsDialog settingsDialog,
const QString containerPath,
QObject parent = nullptr 
)
explicit

Creates a new container for a container at the given path for the given dialog.

Parameters
settingsDialogThe settings dialog to create the container for
containerPathThe path to the section to be used
parentThe parent QObject
Attention
The path must be a path to a section! Otherwise the construction will fail!
QSectionSettingsContainer::QSectionSettingsContainer ( const QSettingsLayout layout,
QObject parent = nullptr 
)
explicit

Creates a new container from a settings layout.

Parameters
layoutThe QSettingsLayout to create the container for
parentThe parent QObject
Attention
The layout must be a layout with QSettingsLayout::SectionLayout as type! Otherwise the construction will fail!

Member Function Documentation

bool QSectionSettingsContainer::acceptEntry ( int  index,
int  id,
QSharedPointer< QSettingsEntry entry 
)
overrideprotectedvirtual

Will be called to insert the given entry from a transfer.

Parameters
indexThe target index to insert the entry at
idThe id of the entry to be inserted
entryThe entry itself to insert
Returns
true, if the entry was accepted and taken, false if not

This function will be called internally to insert an entry from a QSettingsContainer::transferElement. It will be called on the target container with the given parameters. If true is returned, the original container assumes the element was taken and will remove it from itself. If false is returned, it's expected that the target container did not accept the element and the original one will keep the entry.

Implements QSettingsContainer.

QSectionSettingsContainer::createGroupContainer ( const QString id)

Creates a new container for the child group with the given id.

Parameters
idThe id of the group to create a container for
Returns
A newly created settings container to the child container, or nullptr

If there is a group with the given id, a container with this element as parent QObject will be created. If the id was not found, a nullptr will be returned.

QSectionSettingsContainer::createGroupContainer ( const QString id,
QObject parent 
) const

Creates a new container for the child group with the given id.

Parameters
idThe id of the group to create a container for
parentThe parent for the new container
Returns
A newly created settings container to the child container, or nullptr

If there is a group with the given id, a container with the given parent as parent QObject will be created. If the id was not found, a nullptr will be returned.

QSectionSettingsContainer::createGroupContainerFromIndex ( int  index)

Creates a new container for the child group at the given index.

Parameters
indexThe index of the group to create a container for
Returns
A newly created settings container to the child container, or nullptr

If there is a group at the given index, a container with this element as parent QObject will be created. If the element at the index is not a group, a nullptr will be returned.

QSectionSettingsContainer::createGroupContainerFromIndex ( int  index,
QObject parent 
) const

Creates a new container for the child group at the given index.

Parameters
indexThe index of the group to create a container for
parentThe parent for the new container
Returns
A newly created settings container to the child container, or nullptr

If there is a group with the given id, a container with the given parent as parent QObject will be created. If the element at the index is not a group, a nullptr will be returned.

QSectionSettingsContainer::getElementId ( int  index) const

Returns the id for the element at the index.

Parameters
indexThe index of the element
Returns
The id of the entry at that index

If the element is an entry, the QVariant will contain an integer, the entries id (see QSettingsContainer::getEntryId). If the element is a group, the QVariant will contain a string, the groups id (see QSettingsContainer::getGrouptId)

QSharedPointer<QSettingsEntry> QSectionSettingsContainer::getEntry ( int  id) const
overridevirtual

Returns the entry with the given id.

Parameters
idThe id of the entry to be found
Returns
The entry, or nullptr, if the entry is not in there

Implements QSettingsContainer.

QSharedPointer<QSettingsEntry> QSectionSettingsContainer::getEntryFromIndex ( int  index) const
overridevirtual

Returns the entry at the given index.

Parameters
indexThe index of the entry
Returns
The entry at that index, if it is an entry. If not, nullptr

Implements QSettingsContainer.

int QSectionSettingsContainer::getEntryId ( int  index) const
overridevirtual

Returns the id for the entry at the index.

Parameters
indexThe index of the entry
Returns
The id of the entry at that index, if it is an entry. If not, -1

Implements QSettingsContainer.

int QSectionSettingsContainer::getEntryIndex ( int  id) const
overridevirtual

Searches for entries index.

Parameters
idThe id of the entry to be found
Returns
The index within this container, or -1, if the entry is not in there

Implements QSettingsContainer.

QSectionSettingsContainer::getGroupIndex ( const QString id) const

Searches for groups index.

Parameters
idThe id of the group to be found
Returns
The index within this container, or -1, if the entry is not in there
QSectionSettingsContainer::getGrouptId ( int  index) const

Returns the id for the group at the index.

Parameters
indexThe index of the group
Returns
The id of the group at that index, if it is a group. If not, a null string
QSectionSettingsContainer::removeGroup ( const QString id)
slot

Removes the group with the given id.

Parameters
idThe id of the group to be removed
Returns
true, if a group with that id was removed, false if not
bool QSectionSettingsContainer::transferElement ( int  indexFrom,
QSettingsContainer targetContainer,
int  indexTo 
)
overridevirtual

Tries to transfer the element at index to the target container.

Parameters
indexFromThe index of the element to be transfered
targetContainerThe container to transfer the element to
indexToThe index to insert the element at in the target container
Returns
true, if the transfer was successful, false if not

The function will first check if the target container accepts the element at indexFrom. If it does, it will be transfered. If not, nothign happens and false is returned.

Implements QSettingsContainer.


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