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

QTableWidget line edit cell widget will have wrong focus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.11.0 Alpha
    • 4.8.3, 5.0.0 Beta 2
    • Widgets: Itemviews
    • None
    • efec288f58dc18f6a571bfedf9d19e3fbf12a18f

    Description

      Setting QLineEdit items to a table with setCellWidget() will result wrong tab focus if focus is also changed with mouse.

      The code below reproduces the issue with the following steps:

      • change the focus first with tabulator to the middle line edit
      • set the focus with mouse to the first line edit
      • use the tabulator again
        -> the third line edit will have focus instead of the second/middle one.
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QTableWidget table;
          table.setRowCount(3);
          table.setColumnCount(3);
      
          QLineEdit *lineEdit;
          lineEdit = new QLineEdit;
          table.setCellWidget(1, 0, lineEdit);
      
          lineEdit = new QLineEdit;
          table.setCellWidget(1, 1, lineEdit);
      
          lineEdit = new QLineEdit;
          table.setCellWidget(1, 2, lineEdit);
      
          table.resize(400, 200);
          table.show();
          
          return a.exec();
      }
      

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes