Results 1 to 9 of 9

Thread: Q_OBJECT Problems..

  1. #1
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Q_OBJECT Problems..

    Hello all,

    First of all, I'd like to say hello to all of the members here. This looks like a great resource, and I'm sure I'll be back for more help and to help others. Now down to business - I'm making a plugin for MythTV, and I have to include the Q_OBJECT macro in order to create my own slots (necessary). Anyways, I've posted my code below that I used in my header file...the whole plugin compiles correctly, but when I select the plugin from the menu, it does not go forward and show the new screen. I've debugged to the point that I found it works without the Q_OBJECT macro, but it doesn't if I include it; unfortunately, it is necessary. I was wondering if anyone has any ideas as to why it may not be working, and yes, I am using qmake.

    Qt Code:
    1. #ifndef MYTHTIMERS_H
    2. #define MYTHTIMER_H
    3.  
    4. /* QT includes */
    5. #include <qnamespace.h>
    6. #include <qstringlist.h>
    7. #include <qapplication.h>
    8. #include <qbuttongroup.h>
    9. #include <qtimer.h>
    10. #include <qwidget.h>
    11.  
    12. /* MythTV includes */
    13. #include <mythtv/mythcontext.h>
    14. #include <mythtv/mythdialogs.h>
    15.  
    16. /* Script includes */
    17. #include <mythdb.h>
    18.  
    19. class QTimer;
    20.  
    21. class MythTimers : public QObject
    22. {
    23. Q_OBJECT;
    24.  
    25. public:
    26. struct t_remaining
    27. {
    28. int months, days, years, hours, minutes, seconds;
    29. };
    30. MythTimers(QObject * parent=0, const char * name=0);
    31. ~MythTimers();
    32.  
    33. public slots:
    34. void SetAlarmTimer();
    35.  
    36. private:
    37. QTimer *mytimer;
    38. };
    39.  
    40.  
    41. #endif
    To copy to clipboard, switch view to plain text mode 
    Last edited by mkoehle1; 22nd June 2007 at 07:50. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Q_OBJECT Problems..

    it does not go forward and show the new screen.
    Please note that we have no idea what your plugin is supposed to do.
    So what does the text in the quote mean?

    Why are you using Qt3 headers with Qt4?
    We probably will have to see the implementation as well, there is nothing wrong with the header you posted as far as I can see.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Hello,

    Thank you for your reply. The plugin which I am creating will essentially add an alarm feature to the MythTV application. Obviously, in order to implement a QTimer, the QObject macro needs to be included (for event handling). Now to a more precise description of the problem. When you open up mythtv, you navigate via a menu, and you can create a link to your plugin by editing the menu's XML files. When you select your plugin from the menu, the plugin's "main.cpp" file is executed, and so on and so forth. The problem is this - When I do NOT include the QObject macro, my plugin loads properly (except for I do not have the functionality to use event handling). On the other hand, when I include the QObject macro and try to select the plugin from the menu, nothing happens (the program does not freeze, but it continues like nothing happened). Therefore, through debugging, I've found that the problem lies with the QObject macro. In addition, I've put together a .tar file with all of the source files included (it isn't that big as of yet), and I would appreciate if someone could help me understand why the QObject macro isn't working as it is a major part of the QT language.

    Thanks,

    Michael Koehler

  4. #4
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Unfortunately my internet is a tad bit slow at the moment, so I cannot upload the .tar.gz file anywhere, but when it is working again, I will post the location of the source files. In addition, to clarify, I'm using QT3, sorry for the confusion.

    Cheers!

  5. #5
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Here is the link to the source tarball: http://volunteercoders.com/mythalarm.tar.gz I appreciate everyone's help.

  6. #6
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Good morning...can anyone help me out with this issue? Thanks.

  7. #7
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Hey there,

    Although I'm not a QT3 expert I'm interested in the idea and so am offering to help.

    I've downloaded the code however I'm working on a gentoo linux box so I'm still trying to get this to compile ...

    I'll write more tomorrow.

  8. #8
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    ok so I've gotten it to compile. Just looking at what files I need to move over and what files i need to edit to add this in ...

    did you follow there instructions on setting up your plugin?

    http://www.mythtv.org/wiki/index.php...gins:HelloMyth

  9. #9
    Join Date
    Jul 2007
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Q_OBJECT Problems..

    Hi Again,

    I got your stuff up and running - and didn't see anything as you mentioned - then I looked at your code and there is nothing there - what did you expect would happen? Not much code - no output - not even a print statement.

Similar Threads

  1. Problems customizing QSlider
    By Antrax in forum Qt Programming
    Replies: 13
    Last Post: 20th December 2011, 07:00
  2. Replies: 2
    Last Post: 8th March 2007, 22:22
  3. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 19:11
  4. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 15:39
  5. problems with Opengl
    By SlawQ in forum Qt Programming
    Replies: 4
    Last Post: 12th February 2006, 22:49

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.