[Qt-interest] changing colors in spin box
Jason H
scorp1us at yahoo.com
Fri Aug 19 20:25:13 CEST 2011
I took a quick look, but I didn't see anything derived from QAbstractSpinBox.
All you have to do is on the proper event or signal, do something like: (I can't remember if you need pointers or not, I'll assume not)
MySpinBox::MySpinBox() { connect(this, SIGNAL(valueChanged(QString)), this, SLOT(valueChangedSlot(QString)));
//Initialize a QMap<QString, QColor> colorMap //e.g. colorMap["blue"]=QColor(QColor::blue);
}
void MySpinBox::valueChangedSlot(QString text) {
QPallette p=pallete();
p.setColor (QPalette::Background, colorMap[text]);
setPallette(p);
}
________________________________
From: Doug Stewart <doug.dastew at gmail.com>
To: Jason H <scorp1us at yahoo.com>
Cc: André Somers <andre at familiesomers.nl>; "qt-interest at qt.nokia.com" <qt-interest at qt.nokia.com>
Sent: Friday, August 19, 2011 2:07 PM
Subject: Re: [Qt-interest] changing colors in spin box
2011/8/19 Jason H <scorp1us at yahoo.com>
I was hoping he would elaborate on what part he didn't udnerstand. Like the changing the color for the background role of the widget's palette or what not. Did I just say too much? ;-)
>
>
>
>
No you did not say too much ;-)
I am a very beginner at QT, so if you would elaborate I will be eternally grateful :-)
the code is at
http://code.google.com/p/fuzzy-teaching-demo/
If you look you will see that we have learnt a lot but we are stumped on this one.
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110819/0c9aa5a3/attachment.html
More information about the Qt-interest-old
mailing list