summaryrefslogtreecommitdiff
path: root/gui_item_delegate.cpp
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2014-04-18 18:30:52 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2014-04-18 18:30:52 +0200
commitd834eba65c2c65c1540d13c9c39ced51bd87cf83 (patch)
tree68c0533b668545cbfb0b0d556ac7ebf9bf8d3e97 /gui_item_delegate.cpp
parent0969e7a24c0ae2a0cc9c5bd4be0d18c29bfe7f30 (diff)
downloadgeneric-gui-d834eba65c2c65c1540d13c9c39ced51bd87cf83.tar.gz
generic-gui-d834eba65c2c65c1540d13c9c39ced51bd87cf83.tar.bz2
generic-gui-d834eba65c2c65c1540d13c9c39ced51bd87cf83.zip
First working prototype
Diffstat (limited to 'gui_item_delegate.cpp')
-rw-r--r--gui_item_delegate.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/gui_item_delegate.cpp b/gui_item_delegate.cpp
new file mode 100644
index 0000000..aba0727
--- /dev/null
+++ b/gui_item_delegate.cpp
@@ -0,0 +1,21 @@
+#include "meta_types.hpp"
+
+#include "gui_item_delegate.hpp"
+
+GuiItemDelegate::GuiItemDelegate(QObject *parent) :
+QStyledItemDelegate(parent)
+{
+}
+
+QString GuiItemDelegate::displayText(const QVariant &value, const QLocale &locale) const
+{
+ QString ret;
+ static int string_id = qMetaTypeId<std::string>();
+
+ if(string_id == value.userType()) {
+ ret = QString::fromStdString(value.value<std::string>());
+ } else {
+ ret = QStyledItemDelegate::displayText(value, locale);
+ }
+ return ret;
+}