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

QGraphicsProxyWidget tooltips appear in wrong location

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.3
    • 4.4.2
    • Widgets: GraphicsView
    • None

    Description

      Tooltips set on embedded widgets do not appear at the correct location. To reproduce:

      1. Build the code below
      2. Run the program and move the application window to the center of the screen.
      3. Position the mouse cursor over the description label and note where the tooltip appears (i.e. just below and to the right of the mouse cursor.)
      4. Position the mouse cursor over the QLineEdit widget that says "Where's my tooltip?" and note where the tooltip appears. On Windows, it appears near the upper left corner of the screen, far from the mouse cursor. On X11, it appears below and to the right of the cursor, but causes the size of the view to be changed.

      Code:

      #include <QtGui>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      QWidget *panel = new QWidget();
      QVBoxLayout *layout = new QVBoxLayout(panel);
      panel->resize(100,100);
      QLabel *ql = new QLabel("Hover over the QLineEdit "
      "and watch where the tooltip appears.\n"
      "It should appear near the mouse cursor, "
      "but it doesn't.\n Instead, it appears near the "
      "upper left corner of the screen.");
      ql->setToolTip("This tooltip looks OK");
      layout->addWidget(ql);

      QGraphicsScene *scene = new QGraphicsScene(panel);
      QGraphicsView *view = new QGraphicsView(scene);
      layout->addWidget(view);

      QLineEdit *lineEdit1 = new QLineEdit("Where's my tooltip?");
      lineEdit1->setToolTip(QString("This tooltip is in the wrong place"));
      QGraphicsProxyWidget *item1 = new QGraphicsProxyWidget();
      item1->setWidget(lineEdit1);
      item1->setPos(10, 10);
      scene->addItem(item1);

      panel->show();
      return app.exec();
      }

      Attachments

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

        Activity

          People

            ylopes Yoann Lopes
            admin Administrator
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes