Table editor for my own widget
-
Hello!
In the form's editor QtCreator at double click on QTableWidget there is form Edit Table Widget (on a screenshot) in which it is possible to set columns, rows, their values, headers, etc.
How it is possible to make for own widget the similar form (Edit My Widget for example) which is caused from the editor? To set number of columns and other...!http://img-fotki.yandex.ru/get/5700/lenvampir.2/0_4cd62_1bc903fd_L(Screenshot)!
-
I have never tried this, but a quick look through the documentation suggests that perhaps QDesignerTaskMenuExtension can help you. It allows you to add actions to the task menu (design context menu) of your widget. That is just a QAction. I would think, that you can pop up any form from your plugin code to configure your widget that you can dream up. I don't know how to store that additional data in your .ui file however, but I guess that's a different topic :-)
-
Thanks for the answer, Andre, but I think that it not absolutely that is necessary.
-
There is a complete "Task Menu Extension Example":http://doc.trolltech.com/4.7/designer-taskmenuextension.html in the Qt docs on how to do this.
-
Thanks for the answer, we'll see how to use it :)
-
I'll try to explain what I meant. How can I implement "edit items" in my widget the same way as in QTableWidget (via context menu in some complex dialog)? Here is some screenshots.
!http://img526.imageshack.us/img526/5402/edititems1j.png(Step1)!
!http://img827.imageshack.us/img827/9596/edititems2.png(Step2)!
-
Thanks, Andre! And what if we need this widget available in Qt Designer?
-
Did you actually read and understand anything of all the messages above?
I mean, the whole point of creating a designer plugin, is to make your widget available in Qt Designer. Do you at least have that part working? Can you see your own widget appearing in Designer?If not, I suggest you take a look at the example on how to do it. "This page":http://doc.qt.nokia.com/4.7/designer-creating-custom-widgets.html would be the place to start.
-
You have to implement the editor yourself. The code must go into the Qt Designer plugin. You also must must add some code to put the data you added to your widget into the generated .ui file and there must be some means to generate the C++ code to populate your widget once uic generates the ui_xxx.h file. I don't know if the latter is possible. Designer's source might be a good point to start of - just look at the editors for the table widgets that are provided there.
-
To Andre:
Yes, i have already my own widget, and it's working in some programms. And i would like to crate editor for this widget.
Thank you for showing me to QDesignerTaskMenuExtension? it may be one of the start point.To Volker:
Thank you for your thorough answer. The problem is I do not know where to get that source of editor for Table-Widget. I know where is QtDesigner's source, but i can't find folder exactly with Table Widget's source. -
Oh, Volker, thank you very mach! It's exactly, what i need.
I'm happy :-)