Re: i am new... please help
Quote:
Originally Posted by
Slewman
I am trying to make a simple RGB value setter with some Spin Boxes and Vertical Scrolls... but i want it to be more interactive than just that. I want there to be a color box... or something that's actual color value (R,G,B) will change with the changes from the vertical scrolls... how can i do this? Again I am very very new at this stuff so please, any help is greatly appreciated. Basically, Im looking for something to set the color of a form or whatever that can call a "getValue" or something similar from the spin box or scroll
- learn basic C++
- have a look at the signal slot mechanism of Qt
Quote:
thanks again.
also, to take this one step further... is there a way, in QT designer, to create a window or widget, and, while in the designer, look at the actual code that is being created and edit it?
No, the c++-code is created via uic. so you can't see the code inside the designer. The designer is only for GUI modeling, not for coding.
Re: i am new... please help
Its not that I dont know c++, i do, Im trying to do this in the QT Designer before i try to do this simply by programming it. i know there is a function in the spinBox class "int value()" that will return the value in the spinBox, is there anyway to set a background color corresponding to that value?
i treid addying a style sheet and using spinBox->value() but its not giving me any result. any suggestions?
Re: i am new... please help
you can't do it in the designer. because there is no slot called setRValue() or setGValue() for any widget.
So you have to manipulate the palette of your "color-widget" by your own. Or write your own widget, providing these slots and write a designer plugin for that color-widget.
Code:
connect(slider1, SIGNAL(valueChanged(int)), this, slider1changed(int));
//...
...::slider1changed(int i)
{
c.setRed(i);
colorwidget->setPalette(p);
}
You can use QSignalMapper to simplyfiy.