# HG changeset patch # User unc0rr # Date 1350074120 -14400 # Node ID edad8a7bcaeadae0fbc6f3a3f2542310c393df85 # Parent f160fbc139b1b13e83fc315f3f612d5778e3f436 Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet diff -r f160fbc139b1 -r edad8a7bcaea QTfrontend/ui/widget/colorwidget.cpp --- a/QTfrontend/ui/widget/colorwidget.cpp Sat Oct 13 00:07:46 2012 +0400 +++ b/QTfrontend/ui/widget/colorwidget.cpp Sat Oct 13 00:35:20 2012 +0400 @@ -1,17 +1,17 @@ #include #include #include +#include #include "colorwidget.h" #include "hwconsts.h" ColorWidget::ColorWidget(QStandardItemModel *colorsModel, QWidget *parent) : - QWidget(parent) + QFrame(parent) { m_colorsModel = colorsModel; setColor(0); - setStyleSheet(""); setAutoFillBackground(true); connect(m_colorsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataChanged(QModelIndex,QModelIndex))); @@ -30,9 +30,12 @@ QStandardItem * item = m_colorsModel->item(m_color); + setStyleSheet(QString("border: 2px solid orange; border-radius: 8px; background: %1").arg(item->data().value().name())); + /* QPalette p = palette(); p.setColor(QPalette::Window, item->data().value()); setPalette(p); + */ emit colorChanged(m_color); } diff -r f160fbc139b1 -r edad8a7bcaea QTfrontend/ui/widget/colorwidget.h --- a/QTfrontend/ui/widget/colorwidget.h Sat Oct 13 00:07:46 2012 +0400 +++ b/QTfrontend/ui/widget/colorwidget.h Sat Oct 13 00:35:20 2012 +0400 @@ -1,7 +1,7 @@ #ifndef COLORWIDGET_H #define COLORWIDGET_H -#include +#include #include namespace Ui { @@ -10,7 +10,7 @@ class QStandardItemModel; -class ColorWidget : public QWidget +class ColorWidget : public QFrame { Q_OBJECT