[Qt-interest] Qt Designer Custom Widgets
Malyushytsky, Alex
alex at wai.com
Tue Nov 9 00:30:58 CET 2010
>> You want to make a QtDesigner plugin.
Above is wrong. Plug-in is completely different from promotion feature.
All promotion does - it includes header your class is defined in, into
uic generated header and replace widget class name mentioned with operator new with your class name.
plugin makes much more.
As you mentioned you have to make sure that your CustomChatWindow.hpp is found.
What path to specify?
It is up to you, it just has to be correct path either relative or absolute, so that if placed in the
generated by uic file ( for your file it probably will be ui_CustomChatWindow.h ) it will be found by C++ compiler.
I would recommend avoiding absolute path.
If all the files you mentioned (cpp, hpp ) are included in your project already and Include Directories (INCLUDEPATH) contains path to the folder with CustomChatWindow.hpp you can just specify CustomChatWindow.hpp . This will add #include "CustomChatWindow.hpp" to the uic generated header.
Otherwise I would recommend specify relative path (make sure it is valid from the location of uic generated header ).
Regards,
Alex
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Josh Knox
Sent: Monday, November 08, 2010 10:41 AM
To: Alex Ivasyuv
Cc: Qt Interest
Subject: Re: [Qt-interest] Qt Designer Custom Widgets
Alex Ivasyuv wrote:
Hi,
I need to implement customTextEditWidget of QTextEdit.
I created custom class, which implements QTextEdit, called CustomChatWindow (cpp & hpp files).
Now I would like to use this custom class in QT Designer.
I found in docs, that I could use "Promote" feature, but when I do this, I get on app start the following error:
"QFormBuilder was unable to create a custom widget of the class 'CustomChatWindow'; defaulting to base class 'QTextEdit'."
I think issue in name of header file that you have to clarify in popup dialog
http://doc.qt.nokia.com/4.7/images/designer-promoting-widgets.png ("Header file").
I have CustomChatWindow.hpp & CustomChatWindow.cpp. And they lies in some subfolders.
What should I pointed there? Relative or absolute path to header file? Or maybe only here header file name? If so, related of what...
I found here a video http://www.youtube.com/watch?v=Yt-YCxgEnyw, but it's a custom widget created by Designer.
Thanks,
You want to make a QtDesigner plugin.
See this:
http://doc.qt.nokia.com/4.7/designer-creating-custom-widgets.html
and this example:
http://doc.qt.nokia.com/4.7/designer-customwidgetplugin.html
Josh
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list