Results 1 to 3 of 3

Thread: Why cellWidgets in a QTableWidget can not scroll when it's in a QGraphicsScene?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Why cellWidgets in a QTableWidget can not scroll when it's in a QGraphicsScene?

    I need some animation with QTableWidget, so using QGraphicsScene and QGraphicsView.
    When I scroll the table's scrollbar, the cellWidgets can not scroll or update at all but the QTableWidgetItem can!

    Please see the attachment for my screenshot: The first picture Screenshot.png is not correctly scroll.
    The second picture Screenshot-1.png is correctly scroll. This table shown correct when there's no view/scene.

    Below is my code:

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6. scene.setSceneRect(0, 0, 400, 200);
    7.  
    8. QTableWidget *table = new QTableWidget;
    9. table->setColumnCount(2);
    10. table->setRowCount(10);
    11.  
    12. for (int i=0; i<10; i++) {
    13. QString str;
    14. str.setNum(i);
    15. table->setItem(i, 0, new QTableWidgetItem(str));
    16. table->setCellWidget(i, 1, new QPushButton(str));
    17. }
    18.  
    19. scene.addWidget(table);
    20.  
    21. QGraphicsView *view = new QGraphicsView(&scene);
    22. view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    23. view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    24. view->show();
    25.  
    26. return app.exec();
    27. }
    To copy to clipboard, switch view to plain text mode 

    Is it a bug of QT4.6?
    Can anyone tell me the reason? Thanks.
    Attached Images Attached Images
    Last edited by Mavis; 19th July 2010 at 09:23.

  2. #2
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Why cellWidgets in QTableWidget can not scroll when it's in a QGraphicsWidget?

    Version: qt4.6, pyqt4.7

  3. #3
    Join Date
    Feb 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Why cellWidgets in QTableWidget can not scroll when it's in a QGraphicsWidget?

    Hi there... did you found a solution for that problem,, I'm having the same issue here....

    Thanks

Similar Threads

  1. QScrollArea -- Scroll to widget problem
    By qlands in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2011, 13:16
  2. How to disable vertical scroll bar in QTableWidget
    By grsandeep85 in forum Qt Programming
    Replies: 2
    Last Post: 14th October 2009, 11:07
  3. Custom Scroll Widget Sizing Problem
    By sepehr in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2008, 11:42
  4. Stacked Widget Scroll
    By csvivek in forum Qt Programming
    Replies: 6
    Last Post: 27th May 2008, 11:36
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.