Custom Qt Table Widget

Jeremiah Goerdt  —  3 months, 1 week ago [Edited 0 minutes later]
Working on the watch window has been pretty simple so far. I tried out an idea for tables-within-tables, but it doesn't look like it's going to pan out.

If you know Qt well or have any insight into creating a custom watch window in Qt, lemme know. I'm on a mission to make this watch window a key aspect of Lysa, so it has to be good.

Casey's video about what he wants in a debugger is a sort of "North Star" for Lysa, and he has some great ideas about how to structure the code behind the watch window, as well as how the window should behave. I'm experimenting with some of those ideas and trying to come up with the best solution.

Thoughts? Advice? Etc?
#14480 ratchetfreak  —  3 months, 1 week ago
If going Qt table then go with the QTreeView (so you can expand structs out) and implement a QAbstractItemModel that you give it.

Then when the values change after stepping you can emit dataChanged with just the column of the variable data in the QModelIndex arguments. Qt will then take care of calling data() only for those values. And won't call them for rows that are scrolled offscreen.

Adding a new watch variable is done by first calling beginInsertRows, then updating the internal data structure that data() relies on and then calling endInsertRows.
#14481 Jeremiah Goerdt  —  3 months, 1 week ago
ratchetfreak
If going Qt table then go with the QTreeView (so you can expand structs out) and implement a QAbstractItemModel that you give it.

Then when the values change after stepping you can emit dataChanged with just the column of the variable data in the QModelIndex arguments. Qt will then take care of calling data() only for those values. And won't call them for rows that are scrolled offscreen.

Adding a new watch variable is done by first calling beginInsertRows, then updating the internal data structure that data() relies on and then calling endInsertRows.


Awesome. This should give me a different route to go down.

Thanks!
#14482 Mārtiņš Možeiko  —  3 months, 1 week ago [Edited 1 minute later]
I did QTreeView approach in my RcloneBrowser: https://github.com/mmozeiko/RcloneBrowser/

It queries data dynamically from remote (for example Google Drive). ItemModel is the class where all the magic happens. UI is in RemoteWidget.
#14483 Jeremiah Goerdt  —  3 months, 1 week ago
mmozeiko
I did QTreeView approach in my RcloneBrowser: https://github.com/mmozeiko/RcloneBrowser/

It queries data dynamically from remote (for example Google Drive). ItemModel is the class where all the magic happens. UI is in RemoteWidget.


Ooh, some concrete code. Thanks a ton. I'll definitely be perusing this.
#14486 Mārtiņš Možeiko  —  3 months, 1 week ago [Edited 0 minutes later]

Btw you don't need to start with QAbstractItemModel and QTreeView. That's required only to have maximum flexibility. You can as easily start with QStandardItemModel and QTreeView. That will be middle ground between complete abstract item model and just using widget tree control. Read the Qt docs on "Model/View Programming", its pretty comprehensive on how to implement this functionality.
#14488 Jeremiah Goerdt  —  3 months, 1 week ago
mmozeiko

Btw you don't need to start with QAbstractItemModel and QTreeView. That's required only to have maximum flexibility. You can as easily start with QStandardItemModel and QTreeView. That will be middle ground between complete abstract item model and just using widget tree control. Read the Qt docs on "Model/View Programming", its pretty comprehensive on how to implement this functionality.


Great. I'll start with those docs and see where I can go from there. I'm new at gui programming in general, so the first hurdles are just understanding how to approach the design of this window and then how to accomplish that in Qt.
Log in to comment