aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
commit7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch)
treea35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h b/SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h
new file mode 100644
index 0000000..302186e
--- /dev/null
+++ b/SQLiteStudio3/guiSQLiteStudio/configwidgets/combodatawidget.h
@@ -0,0 +1,35 @@
+#ifndef COMBODATAWIDGET_H
+#define COMBODATAWIDGET_H
+
+#include "customconfigwidgetplugin.h"
+#include "plugins/genericplugin.h"
+#include "guiSQLiteStudio_global.h"
+
+/**
+ * @brief Config entry handler for combo box items with dynamic data set
+ *
+ * This config entry handler runs only for specified "assigned key", so even it's implements CustomConfigWidgetPlugin,
+ * it's created explicitly for each combo.
+ *
+ * It is used to convert CfgEntry value to one of combo's entries and set that value in the combo.
+ * It also works the other way, of course (from combo value to CfgEntry value).
+ *
+ * Currently it is used only by ConfigDialog because of its specific case with custom formatter combo,
+ * which has dynamic contents based on what's added/removed from the combo.
+ */
+class GUI_API_EXPORT ComboDataWidget : public GenericPlugin, public CustomConfigWidgetPlugin
+{
+ public:
+ explicit ComboDataWidget(CfgEntry* key);
+
+ bool isConfigForWidget(CfgEntry* key, QWidget* widget);
+ void applyConfigToWidget(CfgEntry* key, QWidget* widget, const QVariant& value);
+ QVariant getWidgetConfigValue(QWidget* widget, bool& ok);
+ const char*getModifiedNotifier() const;
+ QString getFilterString(QWidget* widget) const;
+
+ private:
+ CfgEntry* assignedKey = nullptr;
+};
+
+#endif // COMBODATAWIDGET_H