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

When clicking on an index widget in an itemview that takes focus while another indexwidget has focus then it will not pass the focus on

    XMLWordPrintable

Details

    Description

      When clicking on an index widget in an itemview that takes focus while another indexwidget has focus then it will not pass the focus on.

      To reproduce with the following example, click on the first label, then click on the second label.

      #include <QtGui>
      
      class ListWidget : public QTreeWidget
      {
      public:
          ListWidget()
          {
              setAcceptDrops(true);
              setDragEnabled(true);
              QTreeWidgetItem *tmp2 = new QTreeWidgetItem(this);
              tmp2->setText(0, "A QTreeWidgetItem");
              addTopLevelItem(tmp2);
              QTreeWidgetItem *widgetContainer = new QTreeWidgetItem(this);
              addTopLevelItem(widgetContainer);
              QLabel *label = new QLabel("<a href=#>this is a link</a>", this);
              label->setFocusPolicy(Qt::ClickFocus);
              setItemWidget(widgetContainer, 0, label);
              QTreeWidgetItem *tmp3 = new QTreeWidgetItem(this);
              tmp3->setText(0, "A QTreeWidgetItem");
              addTopLevelItem(tmp3);
              QTreeWidgetItem *widgetContainer2 = new QTreeWidgetItem(this);
              addTopLevelItem(widgetContainer2);
              QLabel *label2 = new QLabel("<a href=#>this is another link</a>", this);
              label2->setFocusPolicy(Qt::ClickFocus);
              setItemWidget (widgetContainer2, 0, label2);
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          QApplication::setAttribute(Qt::AA_NativeWindows);
          ListWidget box;
          box.setFocus();
          box.show();
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes