przemoc
29th June 2010, 00:44
I have a frameless window widget staying on top and bypassing window managment (Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint). It has reimplemented paintEvent() and it is often resized. Resizing is done from slot (QSocketNotifier::activated(int) signal is connected to it) by calling below resizeMe() method:
void KeyStrokes::resizeMe()
{
QRect r(0, 0, calcWidth(), calcHeight());
if (!r.width())
QWidget::hide();
else {
QWidget::setGeometry(r);
QWidget::show();
}
}
It works fine, but if I move setGeometry() outside of the conditional block (and convert hide()/show() into setVisible() to completely remove if-else), then the widget's paintEvent() is not invoked after changing the width from 0 to previous value (and I get obviously empty rectangle).
Example: 0 - 10 (repaint) - 20 (repaint) 0 - 15 (repaint) - 0 - 15 (NO repaint).
What am I missing here? Isn't it a bug in Qt?
Linux version 2.6.33.4, Debian squeeze, gcc version 4.4.4 (Debian 4.4.4-1), libqt4-* 4.6.3-1
void KeyStrokes::resizeMe()
{
QRect r(0, 0, calcWidth(), calcHeight());
if (!r.width())
QWidget::hide();
else {
QWidget::setGeometry(r);
QWidget::show();
}
}
It works fine, but if I move setGeometry() outside of the conditional block (and convert hide()/show() into setVisible() to completely remove if-else), then the widget's paintEvent() is not invoked after changing the width from 0 to previous value (and I get obviously empty rectangle).
Example: 0 - 10 (repaint) - 20 (repaint) 0 - 15 (repaint) - 0 - 15 (NO repaint).
What am I missing here? Isn't it a bug in Qt?
Linux version 2.6.33.4, Debian squeeze, gcc version 4.4.4 (Debian 4.4.4-1), libqt4-* 4.6.3-1