PDA

View Full Version : Leaving an empty space around a widget



moatilliatta
8th October 2010, 10:10
Hello everyone,

i'm having a problem with a 2x2 GridLayout. In it, i aligned 4 Lables. They all have the fixed size of 200x200 Pixels. On click i want to draw a QFrame around them, what works well because i fixed the maximum size to 200x200 pixels. That causes the Frame to be drawn on the edges of the Widgets. But as soon as the frame is drawn, the pic shifts to the right what looks pretty ugly. Is there a way to tell Qt that he should not move the picture itself but just to draw the frame on the given image?

Here is the code where i draw the frame around the Label.


(....)
QPalette p = sender->palette();
p.setColor(foregroundRole(), QColor(255,100,0));
sender->setMaximumSize(200,200); // the size of the Pixmap
sender->setPalette(p);
sender->setFrameStyle(QFrame::Box | QFrame::Plain);
sender->setLineWidth(6);
(...)

Thanks in advance! :)

moatilliatta
11th October 2010, 16:03
Maybe it hasn't become clear at all. In the attachments you can now find the inactive, non-selected button and the one where a orange frame is drawn around. As you can see the picture is slightly shifted to the right.

I hope it has become clearer.
Thanks!