[mythtv] MythDialog->AddButton/SLOT Question
George Galt
george.galt at gmail.com
Fri Mar 26 15:55:29 UTC 2010
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);
m_menuPopup->AddButton(tr("Select Player to Manage"), SLOT(
showPlayerSelectWin() ), true);
m_menuPopup->AddButton(tr("Select Music by Artist"),
SLOT(showArtistSelectWin()), true);
m_menuPopup->AddButton(tr("Select Music by Album"),
SLOT(showAlbumSelectWin()), true);
m_menuPopup->AddButton(tr("Select Music by Genre"),
SLOT(showGenreSelectWin()), true);
m_menuPopup->AddButton(tr("Select Music by Year"),
SLOT(showYearSelectWin()), true);
}
else
{
delete m_menuPopup;
}
}
void MythSqueezeBox::showPlayerSelectWin()
{
QString label = tr("Select Player to Control");
MythDialogBox *m_menuPopup = new MythDialogBox(label, m_popupStack,
"mythsqueezeboxSelectPlayer");
if (m_menuPopup->Create())
{
m_menuPopup->SetReturnEvent(this, "selectplayer");
QHashIterator< QString, SlimDevice* > i(
slimCLI->GetData()->GetDeviceList() );
m_popupStack->AddScreen(m_menuPopup);
while( i.hasNext() ) {
i.next();
m_menuPopup->AddButton( i.value()->getDeviceName(),
QVariant( i.key() ), false );
}
}
else
{
delete m_menuPopup;
}
}
More information about the mythtv-dev
mailing list