quantumpilgim
27th March 2017, 20:01
Hi all,
I am struggling somehow with the MV framework in the past month or so. As the topic suggest what I want to do is place widgets (actuals QWidget s not QTreewidgetitems and so on) on a tree-style view. I followed the SpinBoxDelegate example and managed to get any custom widget i create as and editor. But that works only if i double click on an entry. Maybe I could get the thing to "look like" my custom widget if i use a paint event but even that is not good because i want that at each place of the treeview thing the actual widget will be placed, so for example it can receive keyboard shortcuts, mouse events, right clicks and so on. Is it possible and how? I dont need a complete answer but maybe some hints.
I ll give a short explanation of what i am trying to do. I want each entry on the tree to represent an "entity" of some programming language, e.g. packages and classes in java; libraries, headers, source files in C/C++ and so on. Usually those things are structured in some tree-like structure. I want to use QT's MV framework to work with and represent them. So at each case say i have a default widget which receives right clicks (with say Qt::CustomContextMenu) and shows a list of pissibilities for each entry (say compile everything in a package of java, or put together the package in some java, put together a shared library of C and so on). Of course I can easily create such a widget the problem i have is
"How do I put it in a tree view form USING the MV framework?"
(cleary i can do it by hand without the MV framework but its rather annoying haveing to rewrite all the functionality of the MV that I need like collapsing, showing and so on)
I have got as far as installing such a widget as an editor, so if i double click at an entry i can then use it my custom widget. Apart from the annoyance of having to double click, it is also wrong in a principle, I DO NOT WANT to have some special editor for each entry i want to have the widgets placed in a tree view.
I am sorry for the long exmplanation. I thank you for your answer in advance.
I am struggling somehow with the MV framework in the past month or so. As the topic suggest what I want to do is place widgets (actuals QWidget s not QTreewidgetitems and so on) on a tree-style view. I followed the SpinBoxDelegate example and managed to get any custom widget i create as and editor. But that works only if i double click on an entry. Maybe I could get the thing to "look like" my custom widget if i use a paint event but even that is not good because i want that at each place of the treeview thing the actual widget will be placed, so for example it can receive keyboard shortcuts, mouse events, right clicks and so on. Is it possible and how? I dont need a complete answer but maybe some hints.
I ll give a short explanation of what i am trying to do. I want each entry on the tree to represent an "entity" of some programming language, e.g. packages and classes in java; libraries, headers, source files in C/C++ and so on. Usually those things are structured in some tree-like structure. I want to use QT's MV framework to work with and represent them. So at each case say i have a default widget which receives right clicks (with say Qt::CustomContextMenu) and shows a list of pissibilities for each entry (say compile everything in a package of java, or put together the package in some java, put together a shared library of C and so on). Of course I can easily create such a widget the problem i have is
"How do I put it in a tree view form USING the MV framework?"
(cleary i can do it by hand without the MV framework but its rather annoying haveing to rewrite all the functionality of the MV that I need like collapsing, showing and so on)
I have got as far as installing such a widget as an editor, so if i double click at an entry i can then use it my custom widget. Apart from the annoyance of having to double click, it is also wrong in a principle, I DO NOT WANT to have some special editor for each entry i want to have the widgets placed in a tree view.
I am sorry for the long exmplanation. I thank you for your answer in advance.