Hi,
I wanted to create an LED widget. Something very
simple that I could drag from my QT Designer
widget Box.
I created a widget form and placed a QLabel
on it. This Qlabel has a stylesheet associated
with it that gives it the look and feel that I
want. I have constrained it to be of fixed size
20 X 12.
If I preview it in QT Designer it looks fine.
I built my plugin and copied the necessary
files to the necessary places and I see my
custom widget in the toolbox.
I now create a new form and drag my custom
widget onto the form. It appears but...
1. The initially displayed rectangle size is not what I wanted - 20 X 16
and the sizePolicy is shown as Preferred,Preferred.
I don't see the actual LED unless I increase
the size to about 51 X 31. At that point
the LED appears but is not centered. At a
size of 41 X 51 the LED is centered.
I cannot get the size of the control down
to where I want it.
I also have specified an initial size in my domXml() file:
QString OvalLEDPlugin::domXml() const
{
return "<widget class=\"OvalLED\" name=\"ovalLED\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>11</x>\n"
" <y>14</y>\n"
" <width>20</width>\n"
" <height>12</height>\n"
" </rect>\n"
" </property>\n"
"</widget>\n";
}
Why can't I get this seemingly simple widget to be sized as I specified in the .ui file?
Mark
Bookmarks