diff options
Diffstat (limited to 'client/widgets/common.cc')
-rw-r--r-- | client/widgets/common.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/client/widgets/common.cc b/client/widgets/common.cc index 2262074..3cf0d54 100644 --- a/client/widgets/common.cc +++ b/client/widgets/common.cc @@ -31,6 +31,8 @@ #include <QDomElement> #include <QString> +#include <stdio.h> + //#define LINEWIDTH 80 static QString reformatHelpString(QString help) @@ -74,6 +76,31 @@ void setCommonAttributes(QWidget *widget, QDomNode &node) widget->setWhatsThis(helptext); // widget->setToolTip(helptext); } + + if(elem.hasAttribute("colour") && + elem.attribute("colour").length() == 6) { + unsigned int r, g, b; + sscanf(elem.attribute("colour").toStdString().c_str(), + "%02x%02x%02x", &r, &g, &b); + + char style[128]; + sprintf(style, "* { color: #%02x%02x%02x; }", + r, g, b); + widget->setStyleSheet(style); + } + + if(elem.hasAttribute("bgcolour") && + elem.attribute("bgcolour").length() == 6) { + unsigned int r, g, b; + sscanf(elem.attribute("bgcolour").toStdString().c_str(), + "%02x%02x%02x", &r, &g, &b); + + char style[128]; + sprintf(style, "* { background-color: #%02x%02x%02x; }", + r, g, b); + widget->setStyleSheet(style); + } + } void setCommonLayout(QWidget *widget, QDomNode &node) |