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

[REG->5.5.1] QLineEdit: side widgets overlapped

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 5.5.1
    • GUI: Look'n'Feel
    • None
    • 13b1c23f8b2cdf283703a75f475ddcf06653bf7e (qtbase/5.5, 23.10.2015)

    Description

      QLineEdit side action widgets overlaps each other until I resize the QLineEdit.

      Looks like the bug related with QTBUG-39660:
      after this fix QLineEditPrivate::positionSideWidgets() isn't working properly.

      Complete example:

      #include <QLineEdit>
      #include <QIcon>
      #include <QApplication>
      
      int main(int argc, char *argv[])
      {   
          QApplication a(argc, argv);
      
          QLineEdit lineEdit;
          QPixmap pixmap(16, 16);
      
          pixmap.fill(Qt::red);
          lineEdit.addAction(QIcon(pixmap), QLineEdit::TrailingPosition);
      
          pixmap.fill(Qt::green);
          lineEdit.addAction(QIcon(pixmap), QLineEdit::TrailingPosition);
      
          lineEdit.setClearButtonEnabled(true);
          lineEdit.setText("resize me please");
          lineEdit.show();
      
          return a.exec();
      }
      

      Seat of the trouble:

      QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition position, int flags)
      {
          ...
          positionSideWidgets(); //side widget still hidden
          w->show();
          ...
      }
      
      void QLineEditPrivate::positionSideWidgets()
      {
          ...
          if (e.widget->isVisible()) // QTBUG-39660
              widgetGeometry.moveLeft(widgetGeometry.left() + delta);
          ...
      

      Attachments

        1. qtbug48806.zip
          1 kB
        2. before.png
          before.png
          10 kB
        3. after.png
          after.png
          7 kB

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              octobergun Evgeny Soglaev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes