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! :)
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! :)