1

So, situation:

Qt 4.8.4, MSVS 2012.

I have six QToolButton inside QWidget (this QWidget is inside another QWidget ), QToolButtons located in QHBoxLayout.

When I quickly press left mouse button on one of QToolButton, then move mouse out of QToolButton and release mouse button on top parent QWidget 5 or more times. With some probability QToolButton look normal, but in other states(hover, press) it's not repainted.

Searching QTBUG - no result.

QToolButton still emit clicked, pressed, released and else signals, but not repainted. Some searching in Qt source code and debugging give some information:

I inherit QToolButton, reimlement enterEvent, leaveEvent, mousePressEvent, mouseReleaseEvent, paintEvent.

enterEvent, leaveEvent, mousePressEvent, mouseReleaseEvent - still working. paintEvent - ignored.

Adding update or repaint in enterEvent, leaveEvent, mousePressEvent, mouseReleaseEvent: no effect.

Then I use break pintsm, and find: in QWidget::repaint(const QRect &rect) checking flags and updatesEnabled() is return false then called return from repaint !!! O_O ok, go inside updatesEnabled().

inline bool QWidget::updatesEnabled() const
{ return !testAttribute(Qt::WA_UpdatesDisabled); }

This is mean Qt::WA_UpdatesDisabled is set true.

Qt Assistant : Qt::WA_UpdatesDisabled Indicates that updates are blocked (including the system background). This flag is set or cleared by the Qt kernel.

Hmmmmm... We have another flag Qt::WA_ForceUpdatesDisabled and it we can change:

Indicates that updates are explicitly disabled for the widget; i.e. It will remain disabled even when all its ancestors are set to the updates-enabled state. This implies WA_UpdatesDisabled. This is set/cleared by QWidget::setUpdatesEnabled().

Inside setUpdatesEnabled() attribute Qt::WA_UpdatesDisabled is changing

Using QWidget::setUpdatesEnabled() still has no effect.

I know, this use-case not usual for QToolButton, and I don't try drag and drop. I mean simple sequence: mousePress - mouseMove - mouseRelease.

What some advice?

analyticalpicasso
  • 1,993
  • 8
  • 26
  • 45
user3302274
  • 252
  • 2
  • 6
  • You'd need to prepare a self-contained test case for this using the Qt test framework, so that no human has to click anywhere, and submit it as a Qt bug - assuming that you succeed in reproducing this problem. – Kuba hasn't forgotten Monica Feb 12 '14 at 18:33

0 Answers0