[mythtv] MythDialog->AddButton/SLOT Question
Jonatan
mythtv at comhem.se
Fri Mar 26 17:16:32 UTC 2010
Robert McNamara wrote:
> On Fri, Mar 26, 2010 at 9:44 AM, Jonatan <mythtv at comhem.se> wrote:
>> George Galt wrote:
>>> I am banging my head against a wall on this one. I'm creating a
>>> simple dialog box that calls a slot for each button press (a simple
>>> thing that has been done in many of the plugins before me). Code is
>>> below. However, when I press the button, I get "QObject::connect:
>>> Cannot connect MythDialogBox::selected() to
>>> (null)::showPlayerSelectWin()".
>>>
>>> My code is modeled after a number of other plugins that seem to do
>>> this effectively. I've looked everywhere I can think of, but must be
>>> missing something obvious. It's clear that somehow I'm not
>>> effectively telling QObject that the "showPlayerSelectWin()" slot is
>>> owned by the parent window, but I can't think of what I am missing.
>>>
>>> Any help would be greatly appreciated.
>>>
>>> George
>>>
>>> Here is the relevant code:
>>>
>>> void MythSqueezeBox::slotPopupStateSection( void )
>>> {
>>> QString label = tr("Select Action");
>>>
>>> MythDialogBox *m_menuPopup = new MythDialogBox(label,
>>> m_popupStack, "mythsqueezeboxselectactionpopup");
>>>
>>> if (m_menuPopup->Create())
>>> {
>>> m_popupStack->AddScreen(m_menuPopup);
>>>
>> Correct me if I'm wrong, but I think you need to add a
>> m_menuPopup->SetReturnEvent(this, "something");
>> to make it work.
>
> Signals and slots will work fine, using return events is another way
> to do it, but not necessary.
>
> George, presumably showPlayerSelectWin() and others are defined in the
> header specifically as slots?
>
> Robert
Maybe I'm missing something, but I'd still say that the SetReturnEvent
call is needed since it sets m_retObject which is used to connect the
Selected signal to the slot.
/Jonatan
More information about the mythtv-dev
mailing list