Results 1 to 8 of 8

Thread: Reg: Qt Metatypes and their use in Plugins

  1. #1
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Reg: Qt Metatypes and their use in Plugins

    Hi,

    I am trying to create a plugin from a widget that can be used through qt designer. The widget has a slot which receives a QList<QString>Names as one of the conditions. I have used typedef QList <QString > Names at the start of the widget header file and used qregistermetatype in the .cpp of the widget and it compiles fine but when I try to run qt designer with the plugin added, it doesnt open. Is there some sort of setting that I would have to change in the .cpp , .hpp files of the widget or the plugin.cpp /hpp files to allow for this to work with Qt Designer..,.

  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: Reg: Qt Metatypes and their use in Plugins

    Why don't you just use QStringList instead?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: Reg: Qt Metatypes and their use in Plugins

    Hi Wyotsa,

    I was actually looking at old threads , and I was using QStringList but I was getting empty lists in this attempt and the reason I was taking this path was because the next thing I want to do is pass List of QImages as well.

  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: Reg: Qt Metatypes and their use in Plugins

    If you were getting empty lists with QStringList, why do you expect to get populated lists with QList<QString>? It seems your code is flawed somewhere. As for the original issue, you're crashing Designer with your plugin. Debug it and trace the crash, the plugin is probably incorrectly implemented (some dangling pointer somewhere?) regardless of the type you use.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: Reg: Qt Metatypes and their use in Plugins

    Yeah, my code was a little buggy with regards to QStringList and I was able to fix it and get the plugin up and running but now I still have the issue of using QList with QImages could you please point me in the right direction with regards to Metatypes, i have never used it before and the documentation was also unclear to me. I tried some stuff and was getting template errors. Is there an example which it was used in for Qt or are there any tutorials regarding the metatypes.

  6. #6
    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: Reg: Qt Metatypes and their use in Plugins

    Ok, but what exactly do you want to do with QList<QImage>? You want the user to be able to select a number of images from within Designer and store those pictures in the ui file along the form info? If so, then in simple words this is not possible, at least not directly. Or do you want something else?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2011
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: Reg: Qt Metatypes and their use in Plugins

    Wyotsa,

    No thats not what I wanted , I was able to figure out how to send the QList <QImage> as a signal. I just wanted to send a list of images on the fly without storing them on the drive to another plugin and connect these 2 plugins. Anyway thanks for your help...

    Cheers

  8. #8
    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: Reg: Qt Metatypes and their use in Plugins

    That's not a problem, just Q_DECLARE_METATYPE(QList<QImage>) and qRegisterMetaType<QList<QImage> >("QList<QImage>")
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 17
    Last Post: 2nd January 2011, 17:11
  2. Mac OS, plugins that user designer plugins
    By Royceybaby in forum Qt Programming
    Replies: 0
    Last Post: 9th May 2010, 01:40
  3. How to use plugins in Qt?
    By kremuwa in forum Newbie
    Replies: 1
    Last Post: 27th February 2010, 09:13
  4. QT 4.2.2 and Ico plugins
    By Placido Currò in forum Qt Programming
    Replies: 2
    Last Post: 24th January 2007, 15:13
  5. Qt4 Plugins How-to
    By Chaid in forum Qt Programming
    Replies: 4
    Last Post: 8th July 2006, 08:32

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.