Results 1 to 17 of 17

Thread: about custom widget plugins

  1. #1
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default about custom widget plugins

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: about custom widget plugins

    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.

  3. #3
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    Hello wysota,How to build Qt sources in release mode ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: about custom widget plugins

    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.

  5. #5
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    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?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    Try adding CONFIG += thread to your .pro file.

  7. #7
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    It is still have this problem,Can someone give me a example? Thank you! hesummar@126.com

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    Quote Originally Posted by hesummar View Post
    It is still have this problem
    Did you add "CONFIG += thread" to your plugin's .pro file and recompiled it?

  9. #9
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    Yes , really . My operation system is suse linux 10.1 .

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    Maybe Qt Designer doesn't look for plugins in that directory? Check "Plugin Paths" in Edit -> Preferences.

  11. #11
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    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 .

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    Add Q_OBJECT macro to CustomWidgetPlugin definition.

  13. #13
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    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 .

  14. #14
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    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.
    We can't solve problems by using the same kind of thinking we used when we created them

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    Quote Originally Posted by hesummar View Post
    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.

    Quote Originally Posted by hesummar View Post
    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).

  16. #16
    Join Date
    Mar 2006
    Location
    Mexico City
    Posts
    31
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: about custom widget plugins

    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.

  17. #17
    Join Date
    Oct 2006
    Posts
    20
    Thanks
    2

    Default Re: about custom widget plugins

    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 .

Similar Threads

  1. Replies: 1
    Last Post: 5th November 2006, 23:50
  2. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 10:05
  3. Replies: 3
    Last Post: 12th April 2006, 08:20
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. How to reload widget plugins?
    By victorng in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2006, 23:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.