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

setText() function overwrites the already defined shortcut

    XMLWordPrintable

Details

    Description

      In the following example, shortcut is not working because setText() function overwrites the already defined shortcut:

      QToolButton *pToolButton = new QToolButton; 
      pToolButton->setShortcut(QKeySequence::Find); 
      pToolButton->setText("Test"); 

      Can be reproduced at least with QToolButton and QPushButton.

      The following works as setShortcut() function is used after setText() function:

      QToolButton *pToolButton = new QToolButton; 
      pToolButton->setText("Test"); 
      pToolButton->setShortcut(QKeySequence::Find);

      This is a problem when the button texts are translated dynamically because the already defined shortcut is removed.

      Please see the attached zip file for an example project.

      Attachments

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

        Activity

          People

            e0101981 Janne Anttila
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes