Unsolved How to determine in MainWindow's mouseReleaseEvent() whether mouse is over a specific widget
-
@mrjj
Well the widget objects will come from the same class. What I mean is that I display only widget objects from f.e. MyWidget-class but with different text shown, and a different icon and some more different icons I will add to the widgets in the MyWidget-class, but the class is just one. (Actually I wanted to make two different ones for a QTreeWidget, but I guess I sould avoid that, it seems to be hard...)
Yes, actually I wanted to make it runnable on very slow hardware -
@Niagarer
Then no doubt you should use a delegate.
Also since its only the data that changes, then it wont be so much work
as if many different widgets. -
Do you have a picture of what you want ?
-
@mrjj
Well actually yes, give me a minute, the engine has to start... -
@mrjj
In the end I would really like to have something like this:
With the List I want only to represent the content inside the green rect.
I think I will not need the tree structure, only these widgets with f.e. this f, because once this list gets very big, only the search function will be used anymore (but if it is completele a joke to implement it with a treeList after I get it work with the ListView, I would appreciate it). But I would like to add some more little icons like that at the right side of the widget. -
@Niagarer
So its like a text line with some icons ?What is the "Get BlackBoard thing ?"
-
@mrjj
Thats a tooltip, the mouse was over the Get Blackboard thing and on the left of the widget there is also shown a little pushButton (the little star) to mark it as favourite (because the mouse was over this component). -
Ok. i think a delegate will work super since its relatively simple structure.
We often refer to
http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
for delegate sample -
@mrjj
In the example, a QTableWidget is used. And so it has no model (no QAbstractItemModel, the struct is actually the model). Would all this also work with QListViews or QTableViews? -
@Niagarer
Yes the delegate is the same regardless of the view/widget used.
http://doc.qt.io/qt-5/model-view-programming.htmlThe delegate can be seen as way to custom paint.