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

QTextEdit::createStandardContextMenu(QPoint) inconsistency

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.0.0
    • None

    Description

      QTextEdit::createStandardContextMenu(QPoint) takes the coordinates in document coordinates which is completely inconsistent:

      • no other function takes a point in document coordinates (e.g. anchorAt(), cursorForPosition())
      • there is no public api to get the document coordinates from the QTextEdit

      The only workaround which emulates the anchorAt/cursorForPosition behavior is

       

      void MainWindow::OnShowContextMenu(const QPoint& pos)
      {
          QPoint p = pos + QPoint(ui->textBrowser->horizontalScrollBar()->value(), ui->textBrowser->verticalScrollBar()->value());
          QMenu* menu = ui->textBrowser->createStandardContextMenu(p);
         ...
      

      I see two options here:

      • break SC in Qt6 and syn it with the other functions
      • document this strange behavior and live with it until Qt7

      Attachments

        Issue Links

          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
              chehrlic Christian Ehrlicher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes