Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6682

Shortcuts for QToolButton are not displayed properly on Windows OS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.5.3
    • GUI: Look'n'Feel
    • None
    • Windows Vista and Windows XP

    Description

      When you press Alt key the shortcuts are displayed but after that are never hided.

      I investigated my self, and it seems to be a problem in the QWindowsStyle::eventFilter method - the QWindowsStylePrivate seenAlt member is never cleared and is continuously growing on each Alt key press. I think it should be cleared on Alt key release.

      bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
      {
      // Records Alt- and Focus events
      if (!o->isWidgetType())
      return QObject::eventFilter(o, e);

      QWidget widget = qobject_cast<QWidget>(o);
      Q_D(QWindowsStyle);
      switch(e->type()) {
      case QEvent::KeyPress:
      if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Alt) {
      widget = widget->window();

      // Alt has been pressed - find all widgets that care
      QList<QWidget *> l = qFindChildren<QWidget *>(widget);
      for (int pos=0 ; pos < l.size() ; ++pos)

      { QWidget *w = l.at(pos); if (w->isWindow() || !w->isVisible() || w->style()->styleHint(SH_UnderlineShortcut, 0, w)) l.removeAt(pos); }

      // Update states before repainting
      d->seenAlt.append(widget);
      d->alt_down = true;

      // Repaint all relevant widgets
      for (int pos = 0; pos < l.size(); ++pos)
      l.at(pos)->update();
      }
      break;
      case QEvent::KeyRelease:
      if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Alt)

      { widget = widget->window(); // Update state and repaint the menu bars. d->alt_down = false; here maybe should clear the d->seenAlt list also... #ifndef QT_NO_MENUBAR QList<QMenuBar *> l = qFindChildren<QMenuBar *>(widget); for (int i = 0; i < l.size(); ++i) l.at(i)->update(); #endif }

      break;

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            cogr Costel Grecu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes