Qt-interest Archive, April 2007
How to trigger update/repaint of a QWidget?
Message 1 in thread
Hi,
I have two image labels next each other in one widget.
layout = new QHBoxLayout;
layout->addWidget(imgLabel[0]); // first one first
layout->addWidget(imgLabel[1]);
this->setLayout(layout);
If I make a switch --- delete the old layout and create a new layout,
then add them in a different order.
QLayout *layout = this->layout();
if(layout) delete layout;
layout = new QHBoxLayout;
layout->addWidget(imgLabel[1]); // different order
layout->addWidget(imgLabel[0]);
this->setLayout(layout);
Question is how to make the widget update/repaint?
I had tested repaint, update and updateGeometry, unfortunately, NONE of
them work!
// this->updateGeometry();
// this->update();
// this->update(this->rect());
// this->repaint();
// this->resize(this->size());
// this->adjustSize();
???
Thanks,
Lingfa
--
[ signature omitted ]
Message 2 in thread
BTY, call layout->update(); does not work either.
--
[ signature omitted ]
Message 3 in thread
If I drag and change the size of the widget, I do see location of the
two images are switched.
--
[ signature omitted ]