PDA

View Full Version : Q_OBJECT Problems..



mkoehle1
22nd June 2007, 07:45
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.


#ifndef MYTHTIMERS_H
#define MYTHTIMER_H

/* QT includes */
#include <qnamespace.h>
#include <qstringlist.h>
#include <qapplication.h>
#include <qbuttongroup.h>
#include <qtimer.h>
#include <qwidget.h>

/* MythTV includes */
#include <mythtv/mythcontext.h>
#include <mythtv/mythdialogs.h>

/* Script includes */
#include <mythdb.h>

class QTimer;

class MythTimers : public QObject
{
Q_OBJECT;

public:
struct t_remaining
{
int months, days, years, hours, minutes, seconds;
};
MythTimers(QObject * parent=0, const char * name=0);
~MythTimers();

public slots:
void SetAlarmTimer();

private:
QTimer *mytimer;
};


#endif

high_flyer
22nd June 2007, 08:57
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.

mkoehle1
9th July 2007, 17:51
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

mkoehle1
9th July 2007, 17:55
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!

mkoehle1
19th July 2007, 11:39
Here is the link to the source tarball: http://volunteercoders.com/mythalarm.tar.gz I appreciate everyone's help.

mkoehle1
26th July 2007, 11:13
Good morning...can anyone help me out with this issue? Thanks.

ptorben
29th July 2007, 09:44
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.

ptorben
29th July 2007, 18:43
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/Building_Plugins:HelloMyth

ptorben
31st July 2007, 18:26
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.