View Full Version : about custom widget plugins
hesummar
28th November 2006, 03:45
Hello,everyone. My Qt version is Qt3.3 . I have a problem,when I copy the "filechooser" example in Qt designer manual , run on my machine . I can find "libfilechooser.so" plugin in my /usr/lib/qt3/plugins/designer directory . but in Qt designer, I can't find that widget . Help me please , thank you!
wysota
28th November 2006, 06:17
You have probably built it against a debug version of Qt and Designer uses release version of the library. Rebuild the plugin in release mode.
hesummar
28th November 2006, 06:46
Hello wysota,How to build Qt sources in release mode ?
wysota
28th November 2006, 06:55
Add CONFIG+=release to the project file and make sure there is no CONFIG+=debug there. As for Qt itself, if you didn't compile it from scratch it should already be in release mode. If not, pass -release to configure and recompile.
hesummar
28th November 2006, 07:52
Hello wysota . This is my *.pro file:
INCLUDEPATH += .
# Input
HEADERS += filechooser.h plugin.h
SOURCES += filechooser.cpp plugin.cpp
TEMPLATE = lib
LANGUAGE = C++
TARGET = filechooser
DESTDIR = $(QTDIR)/plugins/designer
target.path=$(QTDIR)/plugins/designer
INSTALLS += target
CONFIG += qt warn_on release plugin
DBFILE = plugin.db
I don't know why ,as if my Qt designer can't see the "/usr/lib/qt3/plugins/designer/libfilechooser.so" plugin,can you tell me how can I do?
jacek
28th November 2006, 09:57
Try adding CONFIG += thread to your .pro file.
hesummar
29th November 2006, 00:26
It is still have this problem,Can someone give me a example? Thank you! hesummar@126.com
jacek
29th November 2006, 00:50
It is still have this problem
Did you add "CONFIG += thread" to your plugin's .pro file and recompiled it?
hesummar
29th November 2006, 04:00
Yes , really . My operation system is suse linux 10.1 .
jacek
29th November 2006, 15:40
Maybe Qt Designer doesn't look for plugins in that directory? Check "Plugin Paths" in Edit -> Preferences.
hesummar
30th November 2006, 01:33
I found that the Qt designer didn't look for plugins in that directory , after I edited the plugins paths , The Qt designer still didn't see that plugins , Please give me an example .
jacek
30th November 2006, 02:09
Add Q_OBJECT macro to CustomWidgetPlugin definition.
hesummar
30th November 2006, 04:02
In my file ,it already had this macro , but i found that in the Qt designer manual the example about create custom widget example is different from the one in <<c++ programming with Qt3>>. In the Qt designer manual the example has QT_WIDGET_PLUGIN_EXPORT macro , but the one in <<c++ programming with Qt3>> doesn't have . Can you tell me why? and please give me an example whitch one can work very well in your machine .
sunil.thaha
30th November 2006, 09:10
Well to give you a simple answer !!
This is a link (http://www.wysota.eu.org/wwwidgets/ ) to the widget made by wysota. Why don't you try downloading those and see if it loads properly in designer ? And if it does, You can compare and see what is wrong.
jacek
30th November 2006, 09:48
In my file ,it already had this macro , but i found that in the Qt designer manual the example about create custom widget example is different from the one in <<c++ programming with Qt3>>.
The code for that example is available in $QTDIR/tools/designer/examples/filechooser/. To make it work on my system I had to add CONFIG += thread to plugin.pro file, Q_OBJECT macro to CustomWidgetPlugin class and a proper path to Qt Designer (note that if you add /some/path/plugins to "Plugin Paths" in Qt Designer, it will look for the plugin in /some/path/plugins/designer). Also try running Qt Designer from the console --- it might output some message explaining what's wrong.
In the Qt designer manual the example has QT_WIDGET_PLUGIN_EXPORT macro , but the one in <<c++ programming with Qt3>> doesn't have . Can you tell me why?
It's only relevant on windows where you have to export classes explicitly. Ask Google about __declspec(dllimport) and __declspec(dllexport).
arnaiz
30th November 2006, 16:14
Hi hesummar:
I have a similar problem in qt 3.3.4 with designer 3.3.4. Even when the path was added with qtconfig, and apparently accepted by designer, my plugins did'nt work.
I found out that, at least with my version of qt, if the plugin lib was in a directory different from the one in qt3 tree (/usr/lib/qt3/plugins/designer/), the plugin was not recognized by designer.
¿Have you tried puting the plugin in that directory?
Bye.
hesummar
1st December 2006, 01:59
Thank you ! I found that the plugins in http://www.wysota.eu.org/wwwidgets/ could work very well in my machine . I will check where was wrong .
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.