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:
Qt Code:
  1. void KeyStrokes::resizeMe()
  2. {
  3. QRect r(0, 0, calcWidth(), calcHeight());
  4. if (!r.width())
  5. QWidget::hide();
  6. else {
  7. QWidget::setGeometry(r);
  8. QWidget::show();
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 
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