PDA

View Full Version : Help with custom widgets!!



superteny
29th April 2009, 11:01
Hi!!!

I am trying to create a custom widget following the example of "World Time Clock Plugin" from the qt5waybutton widget demo provide by with qt. I have compiled and created the .so from the sources, then i have checked if the .so was under /plugins/designer directory and after all, i started qtcreator to use it. When i load a .ui file or create a new qt form, the next error occurs:

/usr/local/Trolltech/qt-creator-1.1.0-src/bin/qtcreator.bin: symbol lookup error: /usr/local/Trolltech/Qt-4.5.1/plugins/designer/libqt5waybutton.so: undefined symbol: _ZN16QtSvgPixmapCacheC1EP7QObject

I dont know if i have to copy the .so library into another directory or if there is another step that i am missing.
i put my .pro file.


CONFIG += designer plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer

HEADERS = qt5waybutton.h \
qt5waybuttonplugin.h
SOURCES = qt5waybutton.cpp \
qt5waybuttonplugin.cpp

# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/qt5waybuttonplugin
INSTALLS += target sources


Thanks for your help and sorry for the nuisance.

e8johan
29th April 2009, 11:16
It seems to me that you are using SVGs?

In that case you need to add a line reading QT += svg to include the QtSvg module.

superteny
29th April 2009, 12:01
Thanks for your fast reply. Yes, the example uses svg and the "qt5waybutton.cpp" includes "qtsvgpixmapcache.h". I have tried to put the line that you told me in the .pro, and the result is the same. ¿Have i do something else with the svg module?The .pro is the next:


CONFIG += designer plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QT += svg
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer


HEADERS = qt5waybutton.h \
qt5waybuttonplugin.h \
SOURCES = qt5waybutton.cpp \
qt5waybuttonplugin.cpp

# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/qt5waybuttonplugin
INSTALLS += target sources


Sorry, i am a bit new in this.

e8johan
29th April 2009, 12:33
I had a look at the embedded widgets demo and it seems that the QtSvgPixmapCache is a part of that package. You will probably have to add those source and header files to your project to get it to work properly.

superteny
29th April 2009, 12:43
hi again, thanks a lot again. i have doing some test and i have got to load the plugin in qt creator. you are right, finally a include QtSvgPixmapCache.h and cpp to my .pro and i thinks it works. The .pro is this:


CONFIG += designer plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QT += svg
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer

HEADERS = qt5waybutton.h \
qt5waybuttonplugin.h qtsvgpixmapcache.h
SOURCES = qt5waybutton.cpp \
qt5waybuttonplugin.cpp qtsvgpixmapcache.cpp

# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/designer/qt5waybuttonplugin
INSTALLS += target sources


Now, i am going to try the plugin in the designer.
Thanks a lot for your help.