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

QStyle::PM_TextCursorWidth reports incorrect values when an input mask is set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 4.8.7, 5.5.1
    • None
    • Kubuntu 16.04, Qt packages from Ubuntu repositories.

    Description

      According to the documentation QStyle::PM_TextCursorWidth is supposed to report the width of the text cursor in QLineEdit and QTextEdit widgets.

      It appears to report the width of a normal cursor, even when you set an input mask. When an input mask is set, the cursor grows wider. On my system it's 5 pixels instead of 1.

      Repro:

      1. Place the below code in another widget, e.g. QMainWindow
      2. Run program
      3. Observe cursor is wider than usual, even when the cursor is at EOL
      4. Observe "1" in the debug output
        QLineEdit* line_edit = new QLineEdit;
        layout()->addWidget(line_edit);
        line_edit->setInputMask("HHHHHHHH");
        QStyleOption option;
        option.initFrom(line_edit);
        qDebug() << line_edit->style()->pixelMetric(QStyle::PM_TextCursorWidth, &option, line_edit);
        

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            victorw Victor Wåhlström
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes