Results 1 to 8 of 8

Thread: Signals And Slots problem

  1. #1
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question Signals And Slots problem

    I'm trying to send a vector<string> to my GUI using signals and slots. I defined a signal SetWindowList(vector<string>) in class A and a slot SetWindowList(vector<string>) in class B.

    I emit SetWindowList(somevectorhere), but the slot is never executed. If I change all the vectors for int, it works perfectly.

    How do I send my vector to my GUI?


    Thanks!

  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: Signals And Slots problem

    Enable the console and see what error message you get there.

  3. #3
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Signals And Slots problem

    How do I do that?

  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: Signals And Slots problem

    Add "CONFIG+=console" to your project file, rerun qmake and build the project.

  5. #5
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Signals And Slots problem

    Well, I'm using VS integration I got no .pro file

  6. #6
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Signals And Slots problem

    I found something in the output window in debug mode:
    QObject::connect: Cannot queue arguments of type 'std::vector<std::string>'

    However, I had another error that I fixed by adding std:: namespace (eventho im using namespace std already)
    Last edited by ldiamond; 22nd March 2008 at 23:59.

  7. #7
    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: Signals And Slots problem

    Good. Now go and read about Q_DECLARE_METATYPE(). Or better yet, use QStringList instead of std::vector<std::string>.

  8. #8
    Join Date
    Mar 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Signals And Slots problem

    QStringList looks nice, thx

Similar Threads

  1. Memory Problem with SIGNALS and SLOTS
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2007, 20:39
  2. Nested signals and slots
    By vishva in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2006, 09:47
  3. Problem with signals and slots
    By conexion2000 in forum Qt Programming
    Replies: 2
    Last Post: 23rd March 2006, 10:20
  4. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 11:35
  5. Problem with Signal and Slots
    By Kapil in forum Installation and Deployment
    Replies: 2
    Last Post: 10th February 2006, 08:51

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.