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

Qt::Popup windows mess up coordinate system depending on margins

    XMLWordPrintable

Details

    Description

      Running the following code shows that there is something wrong with coordinate mapping when using a widget as Qt::Popup. Setting the margins to (0,0,0,0) solves the problem. To verify, right-click on a word: some other word below will be selected instead.

      //-------------------------------------------------------
      #include <QtGui>
      #include <QtWebKit>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QWidget parent;
      QVBoxLayout lay(&parent);
      QWebView view(&parent);
      view.setHtml("<html><body>"
      "Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. "
      "Nam bibendum. In nulla tortor, elementum vel, tempor at, "
      "varius non, purus. Mauris vitae nisl nec metus placerat "
      "consectetuer. Donec ipsum. Proin imperdiet est. Phasellus "
      "dapibus semper urna. Pellentesque ornare, orci in "
      "consectetuer hendrerit, urna elit eleifend nunc, ut "
      "consectetuer nisl felis ac diam. Etiam non felis. Donec ut "
      "ante. In id eros. Suspendisse lacus turpis, cursus egestas "
      "at sem. Phasellus pellentesque. Mauris quam enim, molestie "
      "in, rhoncus ut, lobortis a, est."
      "</body></html>");
      lay.addWidget(&view);
      lay.setContentsMargins(20,20,20,20); // SETTING ALL TO ZERO SOLVES THE ISSUE
      parent.setWindowFlags(Qt::Popup);
      parent.show();
      return app.exec();
      }
      //-------------------------------------------------------

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes