Results 1 to 10 of 10

Thread: Problem passing QVector containing QPointF through signal-slot

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem passing QVector containing QPointF through signal-slot

    The first error seems to be a missing #include <QPointF> statement.
    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.


  2. #2
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem passing QVector containing QPointF through signal-slot

    Quote Originally Posted by wysota View Post
    The first error seems to be a missing #include <QPointF> statement.
    Right, I missed that but I still get a bunch of errors. Below is the new compile output. (had to zip it because textfile was to large)
    compileoutput2.txt.zip

    Or does anyone know a better way to pass a number of points from one thread to another?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem passing QVector containing QPointF through signal-slot

    Still seems to be a missing include in samplingthread.h.

    I can tell you in aedvance that once you solve these problems you will have to use qRegisterMetaType.
    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.


  4. #4
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem passing QVector containing QPointF through signal-slot

    Quote Originally Posted by wysota View Post
    Still seems to be a missing include in samplingthread.h.

    I can tell you in aedvance that once you solve these problems you will have to use qRegisterMetaType.
    Do you have any idea on what's missing? Because before when I forgot the includes I got errors in my own files but now they are somewhere else. And aren't I already using qRegisterMetaType (in the first post in main.cpp)?

    Also, a more general question so I dont waste time on this problem if it's a bad/inefficient solution; do I have the right approach to what I'm trying to achieve?

    What I'm doing is that I want to have a worker thread reading sensor data and at some times I want to append some of the collected samples to a plot. Would it be better to use sared memory or something between the two threads? Seems harder though...

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem passing QVector containing QPointF through signal-slot

    Quote Originally Posted by Mindstormer View Post
    Do you have any idea on what's missing?
    Based on the first error posted, seems a missing #include <QPointF>

    And aren't I already using qRegisterMetaType (in the first post in main.cpp)?
    You are using it for QVector<int> and not QVector<QPointF>.

    Also, a more general question so I dont waste time on this problem if it's a bad/inefficient solution; do I have the right approach to what I'm trying to achieve?
    Well... it depends what you want to achieve. Most probably you can replace the thread with a timer. Of course this won't cause your missing include problem to disappear
    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.


  6. The following user says thank you to wysota for this useful post:

    Mindstormer (27th March 2014)

  7. #6
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem passing QVector containing QPointF through signal-slot

    Quote Originally Posted by wysota View Post
    Based on the first error posted, seems a missing #include <QPointF>
    Finally was able to solve the problem! It turns out that I was looking in the wrong file, I had QpointF included in my samplingthread.cpp but I had forgot to include it in my samplingthread.h file!

    You know why I had to include QpointF when Qvector in the header file? I'm just curious... :P

    Quote Originally Posted by wysota View Post
    You are using it for QVector<int> and not QVector<QPointF>.
    I was using QVector<QPointF> in the registermetatype but the error was in the header file as I just discovered.

    Thanks for all the help guys, problem solved and I'm happy to move on!

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem passing QVector containing QPointF through signal-slot

    Quote Originally Posted by Mindstormer View Post
    You know why I had to include QpointF when Qvector in the header file? I'm just curious... :P
    Because you had a declaration of a QVector<QPointF> object in the header file.
    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: 5
    Last Post: 2nd September 2011, 23:11
  2. Passing data via signal/slot
    By gib in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2010, 05:49
  3. Problem with passing Pointers to a Slot
    By Basti300 in forum Newbie
    Replies: 2
    Last Post: 26th May 2010, 14:45
  4. signal-slot problem with QVector
    By stefan in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2008, 13:58
  5. Passing a pointer in Signal/Slot Connection
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 6th November 2007, 19:04

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.