thats what i tought its qt3 but.. thank you for the link . I want some more examples or explainations , hoping a way to solve this problem.
baray98
thats what i tought its qt3 but.. thank you for the link . I want some more examples or explainations , hoping a way to solve this problem.
baray98
If you like the approach then simply port the code. It should take no more than 10 minutes to do it.
What i would like to do is to draw a widget in tree like fashion ie:
The user can click on the "device widget" and another widget will pop-up showing its signature and some other info that is neccessary. All this widget and the poping widget should all be dynamically build according to the info in my models , by the way i can adjust the data in my model to hold more info to build my widgets.Device1
----------
| |
| |----------Device 2
| |
| |-------------Device 3
|
|
Device 4
|_______Device5
|_______Device 5
Is there any more idea on how to do implement this , I've been reading a lot today and still no idea how will i implement this.
I dont even know how to draw those device widget in a tree like fashion.
I am super tired now I have to sleep, talk you later guys
baray98
Can't you implement it like in the example I gave you? It's all there - the "attributes" are your tree items. Simply fetch data from the tree and fill in the dialog. Is there a specific implementation problem you are facing or a simple lack of concept?
As for the tree - use a tree view with a model that will map devices to nodes. Everything else will be handled by the architecture.
I have both problems. yes, I can implement it with the "attributes" style and this will serve as my popping widget everytime my user click on a dvice widget.
Now, my specific problem for now is that how can i insert a widget as a node in treeview? I wanted it to be a widget so that i can implement the right and left click if I want. I tried the treeview->style()->drawControl() but there is no signal out from widget that i have drawn, where i can connect my showing of my "attributes" widget slot.
thank you for your insights wyosota...
baray98
It doesn't have to be a widget. You can do it though signals or delegates. See docs for QAbstractItemDelegate and friends.
all i can see in the delegate is
Qt Code:
QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) constTo copy to clipboard, switch view to plain text mode
if i will use this then everytim my user trigger the edit then i will pop-up my "attribute" window correct?
I was thinking of giving my user contextMenu on right click of widget devices and there will be an option like "properties" then show the attribute window. is this doable? is there something i miss on delegates?
baray98
QAbstractItemDelegate::paint() and QAbstractItemDelegate::editorEvent() are the things to look at.
As for the menu, you can always subclass the widget and reimplement its context menu event, but going through the delegate is fine too.
Bookmarks