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

Focus-in applied on hover for QTreeWidgetItem widget

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.5.3, 6.9.1
    • Widgets: Style Sheets
    • None
    • Windows

      When a specific style sheet is applied to the QTreeWidgetItem, the hover action behaves as the focus-in action for the item's internal widget.

       

      Minimal example:

      #include <QLineEdit>
      #include <QTreeWidget>MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
      {
          const auto rowCount = 10;
          const auto colCount = 5;
          auto treeWidget = new QTreeWidget;
          treeWidget->setColumnCount(colCount);
          setCentralWidget(treeWidget);    for (auto r = 0; r < rowCount; ++r) {
              auto topItem = new QTreeWidgetItem;
              treeWidget->addTopLevelItem(topItem);
              topItem->setExpanded(true);        for (auto c = 0; c < colCount; ++c) {
                  treeWidget->setItemWidget(topItem, c, new QLineEdit);
              }
          }    setStyleSheet(R"(
      QTreeWidget::item {
          border-width: 1px;
          border-style: dashed;
      }
      QTreeWidget::item:hover {}
          )");
      } 

       

      Notes:

      • The same is true for the QTreeView class, but this code is more consistent.
      • When the QTreeWidget::item part is removed, the behavior is still wrong, just slightly different.
      • When the hover part is removed, the behavior is correct.

        1. focusIssue-correct.mp4
          57 kB
          Justyna Hudziak
        2. focusIssue-wrong.mp4
          48 kB
          Justyna Hudziak
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            justynah Justyna Hudziak
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes