Results 1 to 20 of 22

Thread: Problems with Q_OBJECT macro

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2008
    Posts
    14
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Problems with Q_OBJECT macro

    i agree with wysota. please make a clean metaobject file which qmake already does,
    start with a new pro file, a new environment .
    moc -o x_moc x.h

    add the moc file in the main cpp file
    #include "x_moc"

    kindly read Q_OBJECT problems due to moc..

    it may not exactly solve the problem but good to give a try.

  2. #2
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    Are you sure it is correct the eclipse configuration? becuase maybe there is a Eclipse problem to find the debugger. Specify the gdb ruth in debug configuration.

    And have you include the QT and the compiler (MinGw) in the CLASS PATH?

    Cheers

  3. #3
    Join Date
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    Hi

    I dont think it is an eclipe/qt problem as I have other qt/qwt projects that work just fine

    If my class inherits from QWidget, I dont have a problem, only when inheriting from QwtPlot

    Thanks
    Last edited by dbrmik; 23rd February 2009 at 09:33. Reason: updated contents

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

    Default Re: Problems with Q_OBJECT macro

    Please provide a minimal compilable example reproducing the problem.
    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
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    I have attached the project as a zip file, hope that OK
    Attached Files Attached Files

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problems with Q_OBJECT macro

    try this
    Qt Code:
    1. class FittingPlot: public QwtPlot
    2. {
    3. Q_OBJECT
    4. public:
    5. FittingPlot(QWidget *parent = 0) ;
    6. ....
    7. };
    8.  
    9. FittingPlot::FittingPlot(QWidget *parent)
    10. : QwtPlot(parent)
    11. {
    12. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    Thanks but I still get the same error

    "You can't do that without a process to debug."

    Grrr

  8. #8
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problems with Q_OBJECT macro

    did you rebuild all project? did you remove old obj-files? did you run qmake after cleaning project dir?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  9. #9
    Join Date
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    Yes, after cleaning the project I checked the files were deleted Ok. I think Eclipse handles the Qmake process, however I did it manually from the command line. But I still get the same error.


    Thanks

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

    Default Re: Problems with Q_OBJECT macro

    Quote Originally Posted by dbrmik View Post
    I have attached the project as a zip file, hope that OK
    It works for me without a problem. A simple qmake && make compiled the project just fine. I have Qwt 5.1.1 installed with Qt 4.4.3.
    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.


  11. #11
    Join Date
    Oct 2008
    Posts
    74
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problems with Q_OBJECT macro

    Thanks wysota, that's good to know. Still not working here, I also have Qwt 5.1.1 installed with Qt 4.4.3 running on xp using eclipse. I get the same problem usng QDevelop. As I metioned earlier I have other projects using the qwt library, however I am not subclassing QwtPlot, I'm adding it as a widget to a MainWindow with no problems, I suppose I'll have to live with it for now

    Thanks once again for your time

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

    Default Re: Problems with Q_OBJECT macro

    Don't use any IDEs if you want to pinpoint a problem. Use plain qmake && make combination, it's the most reliable you can get.
    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.


  13. #13
    Join Date
    May 2008
    Location
    duesseldorf, germany
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problems with Q_OBJECT macro

    First of all:
    The output you're reporting is simply the message of Eclipse complaining that it can't run the debugger after your program crashed, so your Eclipse isn't set up properly.

    So set up your gdb in Eclipse, start the program in debug mode and see where it crashes. Figure out what's wrong (possible not initialized ptr / member) and fix it.

    Aren't you used to work with debuggers

    Another thing:
    It makes perfectly sense that the upd slot isn't available on connection w/o moc generating the meta info for your QObject.
    The other slots you're connecting are already defined in QWidget (which gets inherited by QwtPlot), which has the macro, so they are known.

    Make sure you dig again trough the Qt documentation and get the difference between an C++ object (which you get by subclassing) and Qt META objects (which require an additional Q_OBJECT macro to be created).
    See QObject::staticMetaObject() ...

    Hope this helps somehow to get things together and didn't confuse too much

    regards,
    Bjoern

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
  •  
Qt is a trademark of The Qt Company.