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

QTreeView and Inactive highlight

    XMLWordPrintable

Details

    Description

      The following example reproduces some strange behavior with QTreeView.

      start app
      click on the second item in the second column
      this will start renaming
      click on the lineedit under the tree widget
      notice that only the recently renamed column is painted in the inactive Highlight color.

      One would at the very least expect the columns to be painted in the same color.

      Another question is why it's painted with the Inactive role at all since the window still is active. This is not in accordance with the documentation though it seems to be what Microsoft Explorer does.

      http://doc.trolltech.com/4.3/qpalette.html#details

      #include <QtGui>
      class MainWindow : public QMainWindow
      {
      Q_OBJECT
      public:
      MainWindow(QWidget *parent = 0)
      : QMainWindow(parent)

      { QWidget *w = new QWidget(this); QVBoxLayout *l = new QVBoxLayout(w); QTreeWidget *tw = new QTreeWidget(w); tw->setColumnCount(2); QTreeWidgetItem *it = new QTreeWidgetItem(QStringList() << "rename this item" << "then while renaming click on the lineedit"); it->setFlags(it->flags() | Qt::ItemIsEditable); tw->addTopLevelItem(new QTreeWidgetItem); tw->addTopLevelItem(it); tw->setEditTriggers(QTreeWidget::CurrentChanged); l->addWidget(tw); l->addWidget(new QLineEdit(w)); setCentralWidget(w); }

      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      QPalette pal = a.palette();
      pal.setColor(QPalette::Inactive, QPalette::Highlight, Qt::green);
      a.setPalette(pal);
      MainWindow w;
      w.show();
      return a.exec();
      }

      Attachments

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

        Activity

          People

            monsen Marius Bugge Monsen
            rve Anders Bakken
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes