QTableView in QGraphicsScene too slow
-
Hello,
I put an QTableView with the help of a QGraphicsProxyWidget into my QGraphicsScene...
The TableView is rendered extremely slow. For my QGraphicsView i use an OpenGL Render Context. The Model is a SQLTableModel. The screen renders at about 2 frames per second, which is too slow for my realtime application! Any tips?Greetings
Matthias -
[quote author="zweistein" date="1346855989"]Hello,
Any tips?[/quote]
Yeah: don't use QGraphicsProxyWidget. Putting widgets inside a QGraphicsView is basically a failed experiment. It only soft-of works, and as you noticed, has performance issues. -
Ok, but what is an easy way to use the normal TableView, when my Application is a Fullscreen QGraphicsview? So i have to put the QTableView inside of that QGraphicsview.
-
There is no easy way for that. Not really.
What you could investigate, is using QML to render a table view on your QGraphicsView. I think it is possible to mix QML and normal QGraphicsItems in the same view, as long as you use Quick 1. I don't know of the Components (that has a table view for QML) works with Quick 1 though. Note that I have not tried any of this myself.
-
No, in my opinion, I will not call QGraphicsProxyWidget a failed experiment. I have had a fairly complex TableView and TreeView implemented via GraphicsView framework. And it worked alright. But they were not using SQL tables. And no GL context either. It didn't have delegates either. But they were as great as the widget itself.
Have you tried working with it as just a widget. May be, the widget itself is taking time to process data from tables? -
Hello,
i did the following which was very easy. But i dont know if that is a good solution:
I gave my QApplication to the constructor of QTableView. This way, my QTableView is a child of my MainWindow. Then i said:
@m_TableView.setWindowFlags(Qt::Tool | Qt::FramelessWindowHint );
m_TableView.show( );@This works very good so far! The Window is not moveable and on top of my GraphicsView. It doesnt even show up in my Taskbar... My GraphicsView is the centralWidget of my QApplication.
-
Use this document to further increase efficiency.
"Cost of convenience":http://swik.net/Trolltech/Trolltech+Labs+Blogs/Qt+Graphics+and+Performance+-+The+Cost+of+Convenience/djej7