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

QLineEdit does not properly handle trailing actions when there is the clear button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.0 RC
    • 5.5.1
    • None
    • Archlinux, Qt 5.5.1
    • 13b1c23f8b2cdf283703a75f475ddcf06653bf7e (qtbase/5.5, 23.10.2015)

    Description

      The fix for bug 39660 (which landed on Qt 5.5.1) was (also) supposed to correctly hide a trailing hidden QAction in a QLineEdit. However, I've just upgraded my system to Qt 5.5.1 and the issue is only partially fixed.

      Steps to reproduce:

      1. Open a KDE application which uses a KPasswordDialog (with KF5 >= 5.15), e.g. Ark with a password-protected zip archive.
      2. Make the application open the KPasswordDialog
      3. There is a greyed-out icon with eye shape (let's call it "visibility action") -> Expected result: there should be no icon, since the visibility action is initially hidden.
      4. Type a password. The visibility action is now visible, but so is the clearButton action. The QLineEdit displays the visibilty action on top of the clearButton action, which cannot be triggered. -> Expected result: the visibility action should be displayed on the left of the clearButton action.
      5. Delete the password typed. Both the actions disappear, and this is fine.
      6. Type again a password. Now the visibility action is shown on the left of the clearButton action, as expected.

      So, the issue is about steps 3 and 4.

      UPDATE:
      Step 4 is probably a duplicate of QTBUG-48806

      For step 3, the following is a minimal code example to reproduce the issue:

      #include <QAction>
      #include <QApplication>
      #include <QIcon>
      #include <QLineEdit>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QLineEdit lineEdit;
          QPixmap pixmap(16, 16);
      
          pixmap.fill(Qt::red);
          QAction *action = lineEdit.addAction(QIcon(pixmap), QLineEdit::TrailingPosition);
          action->setVisible(false);
      
          lineEdit.setText("Hidden action is greyed-out.");
          lineEdit.show();
      
          return a.exec();
      }
      

      In the attached screenshot, you can see that the trailing action looks like disabled, while should not be visible at all.

      Attachments

        1. greyed_out_hidden_action.png
          greyed_out_hidden_action.png
          6 kB
        2. qtbug48899_diag.diff
          5 kB
        3. qtbug48899_log.txt
          0.6 kB
        4. qtbug48899_toolbar.zip
          1 kB
        5. qtbug48899.zip
          1 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
              elvisangelaccio Elvis Angelaccio
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes