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

Paint errors while QGraphicsView scrolling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.6.1
    • 4.6.0, 4.6.1, 4.6.2
    • Widgets: GraphicsView
    • None
    • 0b8639aee92913cdfaa4386aa09dde0f5cb2eaee

    Description

      This bug is new in 4.6.0 and do not appears in 4.5.2. Run application below on Windows:

      #include <QtGui>
      int main(int argc, char *argv[])
      { 
      	QApplication app(argc, argv);
      	QGraphicsView view;
      	QGraphicsScene scene;
      	scene.setSceneRect(0,0,300,200);
      	view.setScene(&scene);
      	QGraphicsTextItem item;
      	item.setPlainText("Bug");
      	scene.addItem(&item);
      	view.scale(10.,10.);
      	view.show();
      	return app.exec();
      }
      

      Wrong QGraphicsTextItem painting appears when scrolling via scrollbars. This bug is not in QGraphicsTextItem only, but in any QGraphicsItem derived class, which uses itemStyle->exposedRect in paint(). itemStyle->exposedRect do not reflects real rect for repainting => wrong item's painting.

      Reopened: This is still broken for QGraphicsWidget which can be seen in the following example:

      #include <QApplication>
      #include <QGroupBox>
      #include <QLabel>
      #include <QLineEdit>
      #include <QFormLayout>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QGraphicsProxyWidget>
      
      int main( int argc, char **argv )
      {
          QApplication app(argc, argv);
      
          QGraphicsScene scene;
      
          QGroupBox *groupBox1 = new QGroupBox("Contact Details");
          QLabel *numberLabel1 = new QLabel("Telephone");
          QLineEdit *numberEdit1 = new QLineEdit;
          QFormLayout *layout1 = new QFormLayout;
          layout1->addRow(numberLabel1, numberEdit1);
          groupBox1->setLayout(layout1);
      
          QGraphicsProxyWidget *proxy1 = scene.addWidget(groupBox1);
      
          QGraphicsView view(&scene);
          view.setDragMode(QGraphicsView::ScrollHandDrag);
          view.scale ( 2, 2 );
      
          view.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
            anri_d Andrey D
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes