Fixed issue with tab deletion and Issue #58.

- MainWindow::mainTabContainerClosedRequested would remove the given
tab from the container, but would not delete the tab. (removeTab does
not delete the object) The tab is now deleted.
- CasterPlayerWidget 's player is not attached to the object tree. Added
a deconstructor and manuelly deletes the player when the CasterPlayerWidget
object is deleted
This commit is contained in:
Quinton Schwagle 2017-06-07 12:11:58 -04:00
parent f9e30e0d64
commit 40bcc0c2a9
3 changed files with 11 additions and 2 deletions

View File

@ -224,6 +224,10 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
connect(player,SIGNAL(metaDataChanged()),this,SLOT(playerMetaDataChanged()));
connect(player,SIGNAL(durationChanged(qint64)),this,SLOT(playerDurationChanged(qint64)));
}
CasterPlayerWidget::~CasterPlayerWidget(void)
{
delete player;
}
//Set Properties
void CasterPlayerWidget::setHotKeyLetter(QString hotKey)

View File

@ -46,6 +46,7 @@ class CasterPlayerWidget : public QWidget //inherit from QWidget
public:
//Constructor
CasterPlayerWidget(QWidget* parent = 0); //don't forget to pass the parent
~CasterPlayerWidget();
//Set Properties
void setHotKeyLetter(QString hotKey);

View File

@ -187,10 +187,14 @@ void MainWindow::mainTabContainerTabClosedRequested(int tabIndex)
msgBox.setModal(true);
if(msgBox.exec() == QMessageBox::Yes)
{
CasterBoard *toBeDeleted = dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex));
//CLOSE REQUESTED TAB
disconnect(dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex)), SIGNAL(globalHotKeyReleasedEvent(QKeyEvent*)),this,SLOT(handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent*)));
disconnect(dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex)), SIGNAL(_updateOSCClient(OscMessageComposer)),this,SLOT(sendOSCMessageToClient(OscMessageComposer)));
disconnect(toBeDeleted, SIGNAL(globalHotKeyReleasedEvent(QKeyEvent*)),this,SLOT(handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent*)));
disconnect(toBeDeleted, SIGNAL(_updateOSCClient(OscMessageComposer)),this,SLOT(sendOSCMessageToClient(OscMessageComposer)));
mainTabContainer->removeTab(tabIndex);
if(toBeDeleted) {
delete toBeDeleted;
}
}
}