[Interest] error connecting signals

Adrian Stern adrian.stern at screenfood.com
Tue May 7 14:52:39 CEST 2013


Hey

I don't understand exactly. But when i put the Q_Object macro in VideoPlayer, I ghet the errors:
...Debug/moc_videoplayer.cpp:70: Fehler:'QObject' is an ambiguous base of 'VideoPlayer'

Shouldn't VideoPlayer inherit this macro from PlayerBase since it is a derived class?

class VideoPlayer : public PlayerBase, public IControllable, public IPlaceable
{
  Q_INTERFACES(PlayerBase IControllable IPlaceable)
  ...
}

class PlayerBase : public QObject
{
  Q_OBJECT
...
}

Freundliche Grüsse / Best Regards / Meilleures salutations
Adrian Stern

______________
-----Original Message-----
From: Giuseppe D'Angelo [mailto:dangelog at gmail.com]
Sent: 07 May 2013 14:46
To: Adrian Stern; interest at qt-project.org
Subject: Re: [Interest] error connecting signals

Hi, please keep the discussion on the list.

On 7 May 2013 14:08, Adrian Stern <adrian.stern at screenfood.com> wrote:
> It was in the VideoPlayer whil it wasn't working. Now that it is in PlayerBase it is working.
> Why?

Because, as you said, VideoPlayer was lacking the Q_OBJECT macro.

Rule of thumb: put Q_OBJECT in each and every QObject subclass.

> And why can I cast a VideoPlayer to a PlayerBase but not in the other direction?

What do you mean? You can always cast "for free" to a base*, but you need an explicit cast to go towards a derived class.

--
Giuseppe D'Angelo

*unless you're inheriting from it multiple times and stuff like this
Diese E-Mail und ihre Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail inklusive Anhänge. Das unerlaubte Kopieren sowie die unbefugte Weitergabe der Inhalte dieser Mail ist nicht gestattet.
This e-mail and any attachments may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail including the attachments. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


More information about the Interest mailing list