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

Wrong position of QLineEdit action when RTL-interface used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.6.3, 5.10.0
    • None
    • Windows 8.1 x64

    Description

      Code to reproduce:

      #include <QApplication>
      #include <QWidget>
      #include <QVBoxLayout>
      #include <QCheckBox>
      #include <QLineEdit>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          // Setup window layout
      
          QWidget widget;
          QVBoxLayout layout;
          QCheckBox chkRtl("RTL interface");
          QLineEdit lineEdit;
          widget.setLayout(&layout);
          layout.addWidget(&chkRtl);
          layout.addWidget(&lineEdit);
          widget.show();
      
          // Setup rtl checkbox
      
          QObject::connect(&chkRtl, &QCheckBox::stateChanged, [=](int state) {
              Qt::LayoutDirection dir = Qt::LeftToRight;
              if (state == Qt::Checked)
                  dir = Qt::RightToLeft;
              QApplication::setLayoutDirection(dir);
          });
      
          // Setup lineedit
      
          lineEdit.setClearButtonEnabled(true);
      
          return a.exec();
      }
      

      Result:

      Once you change entered text in RTL-mode 'clear' action changes its position.

      Also may work with:

      1. Actions added with QLineEdit::addAction;
      2. QComboBox (which contains QLineEdit inside).

      Attachments

        1. main.cpp
          0.8 kB
        2. QAction_RTL_bug.png
          QAction_RTL_bug.png
          11 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            yuri_q Yuri M
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes