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

QAction added to QToolBar ignores setIconText();

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.5.0
    • None
    • Windows 7 32 bit msvs 2013 U4 or QtCreators
    • a09b41bc9fc2bc6c837057f303fd82b19c6f5413

    Description

      Start new QWidgets project in QtCreator without form.
      Change files:

      //------------------- mainwindow.h
      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QMainWindow>
      
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      
      public:
          MainWindow(QWidget *parent = 0);
          ~MainWindow();
      
      private:
          QAction* act;             //
          QMenu* menu;         //
          QToolBar* toolBar;   //
      };
      #endif // MAINWINDOW_H
      // ---------------- end mainwindow.h
      
      //---------------- mainwindow.cpp
      #include "mainwindow.h"
      
      #include <qmenu.h>
      #include <qaction.h>
      #include <qmenubar.h>
      #include <qtoolbar.h>
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
      {
          menu = new QMenu();
          menu->setTitle("Menu");
          act = new QAction(menu);
          act->setText("normal text");
          act->setIconText("short text");
      
          menu->addAction(act);
      
          menuBar()->addMenu(menu);
      
          toolBar = new QToolBar;
          toolBar->addAction(act);
          addToolBar(toolBar);
      }
      
      MainWindow::~MainWindow(){
      }
      // ----------------- end mainwindow.cpp
      

      Output in toolBarButton text:
      for Qt 5.4.0 short text
      for Qt 5.5.0 normal text

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            roman_kriven Roman Kriven
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes