QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qasyncsettingscontainer.h
1 #ifndef QASYNCSETTINGSCONTAINER_H
2 #define QASYNCSETTINGSCONTAINER_H
3 
4 #include "qsettingsdialog_global.h"
5 #include <QObject>
6 #include "qsettingscontainer.h"
7 
8 class QAsyncSettingsContainerPrivate;
10 class QSETTINGSDIALOGSHARED_EXPORT QAsyncSettingsContainer : public QSettingsContainer
11 {
12  Q_OBJECT
13 public:
15  explicit QAsyncSettingsContainer(QSettingsDialog *settingsDialog, const QString &containerPath, QObject *parent = nullptr);
18 
19  // QSettingsContainer interface
20  QSettingsDialog *dialog() const override;
21  QString containerPath() const override;
22 
23  int elementCount() const override;
24  bool isEntry(int index) const override;
25  int getEntryIndex(int id) const override;
26  int getEntryId(int index) const override;
27  QSharedPointer<QSettingsEntry> getEntry(int id) const override;
28  QSharedPointer<QSettingsEntry> getEntryFromIndex(int index) const override;
29 
30  bool transferElement(int indexFrom, QSettingsContainer *targetContainer, int indexTo) override;
31 
32 public slots:
33  int appendEntry(QSettingsEntry *entry) override;
34  int prependEntry(QSettingsEntry *entry) override;
35  int insertEntry(int index, QSettingsEntry *entry) override;
36  int insertEntry(int index, QSharedPointer<QSettingsEntry> entry) override;
37  bool removeEntry(int id) override;
38  bool removeElementFromIndex(int index) override;
39  void moveElement(int indexFrom, int indexTo) override;
41  void moveElementAsync(int indexFrom, int indexTo);
42 
44  void appendEntryAsync(QSettingsEntry *entry);
46  void prependEntryAsync(QSettingsEntry *entry);
47 
48 protected:
49  bool acceptEntry(int index, int id, QSharedPointer<QSettingsEntry> entry) override;
50 
51 private:
53 };
54 
55 #endif // QASYNCSETTINGSCONTAINER_H
virtual void moveElement(int indexFrom, int indexTo)=0
Moves the element from the old to the new index.
virtual QSharedPointer< QSettingsEntry > getEntryFromIndex(int index) const =0
Returns the entry at the given index.
virtual bool transferElement(int indexFrom, QSettingsContainer *targetContainer, int indexTo)=0
Tries to transfer the element at index to the target container.
virtual int getEntryId(int index) const =0
Returns the id for the entry at the index.
virtual int appendEntry(QSettingsEntry *entry)=0
Appends the entry to the containers children.
virtual QSharedPointer< QSettingsEntry > getEntry(int id) const =0
Returns the entry with the given id.
virtual bool removeEntry(int id)=0
Removes the entry with the given id.
virtual int insertEntry(int index, QSettingsEntry *entry)=0
Inserts the entry to the containers children at the given index.
virtual int elementCount() const =0
Returns the number of elements in this container.
A generic class the defines methods for settings containers.
Definition: qsettingscontainer.h:13
virtual QSettingsDialog * dialog() const =0
Returns the dialog this container belongs to.
virtual bool isEntry(int index) const =0
Checks whether the element at the given index is an entry or not.
Represents one settings entry within the settings dialog.
Definition: qsettingsentry.h:11
virtual int getEntryIndex(int id) const =0
Searches for entries index.
virtual QString containerPath() const =0
Returns the container path this container has.
virtual bool acceptEntry(int index, int id, QSharedPointer< QSettingsEntry > entry)=0
Will be called to insert the given entry from a transfer.
virtual bool removeElementFromIndex(int index)=0
Removes the element at the given index.
A special class that allows access to the settings dialog from different threads. ...
Definition: qasyncsettingscontainer.h:10
The main class that represents the dialog itself.
Definition: qsettingsdialog.h:16
virtual int prependEntry(QSettingsEntry *entry)=0
Prepends the entry to the containers children.