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

Status tips are not shown for QHeaderView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.10.0 Alpha
    • 4.3.4, 5.4.0
    • Widgets: Itemviews
    • None
    • d67410c61560e2728396ab49b799425d29cf6f6e

    Description

      A model can return data for headers with the headerData() function. However, if a string is returned for StatusTipRole for this function, a status tip is not shown in the status bar.

      Test case main.cpp to reproduce
      ===============================

      #include <QtGui>
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
      
          QMainWindow w;
      
          QTreeView tree;
      
          QStandardItemModel model(4, 2);
          for(int x = 0; x < model.rowCount(); ++x) {
              for(int y = 0; y < model.columnCount(); ++y) {
                  QStandardItem *item = new QStandardItem(QString("item %0 %1").arg(x).arg(y));
                  item->setData(QString("status tip for item %0 %1").arg(x).arg(y), Qt::StatusTipRole);
                  model.setItem(x, y, item);
              }
          }
      
          for(int i = 0; i < model.columnCount(); ++i) {
              model.setHeaderData(i, Qt::Horizontal, QString("column %0").arg(i));
              model.setHeaderData(i, Qt::Horizontal, QString("status tip for column %0").arg(i), Qt::StatusTipRole);
          }
      
          tree.setModel(&model);
          tree.viewport()->setMouseTracking(true);
      
          w.statusBar();
          w.setCentralWidget(&tree);
          w.show();
      
          return app.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              andysh Andy Shaw
              sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes