void QueueMusicWidget::show() { // but when you delete a layout, it does not delete its widgets. So we need to: // 1. Create a layout QVBoxLayout * mainLayout = new QVBoxLayout(); setLayout( mainLayout ); // 2. Create a widget which would own the UI widgets (so when we delete it, they all got deleted) m_contentWidget = new QWidget(); mainLayout->addWidget( m_contentWidget ); // Call UIC-generated code ui = new Ui::QueueMusicWidget(); ui->setupUi(m_contentWidget); // Dialog controls connect( ui->btnAdd, SIGNAL(clicked()), this, SLOT(buttonAddMusic()) ); connect( ui->btnRemove, SIGNAL(clicked()), this, SLOT(buttonRemoveMusic()) ); connect( ui->leFilterSingers, SIGNAL(textEdited(QString)), this, SLOT(findTextChanged(QString)) ); // Add the player window QVBoxLayout * l = new QVBoxLayout( 0 ); m_player = new PlayerWidget(0); m_player->hideCapabilities(); l->addWidget( m_player ); ui->groupPlayerControl->setLayout( l ); // Player buttons connect( m_player, &PlayerWidget::buttonNext, this, &QueueMusicWidget::clickedPlayerNext ); connect( m_player, &PlayerWidget::buttonPlayPause, this, &QueueMusicWidget::clickedPlayerPlayPause ); connect( m_player, &PlayerWidget::buttonPrev, this, &QueueMusicWidget::clickedPlayerPrev ); connect( m_player, &PlayerWidget::buttonStop, this, &QueueMusicWidget::clickedPlayerStop ); connect( m_player, &PlayerWidget::volumeSliderMoved, this, &QueueMusicWidget::movedPlayerVolumeSlider ); // Add the music files model m_model = new TableModelMusic(); connect( pEventor, &Eventor::musicQueueChanged, this, &QueueMusicWidget::updateCollection ); ui->tableQueue->setModel( m_model ); // And fill it up m_model->updateCollection(); // If we're playing, set the update for the player m_player->setText( m_playText ); m_player->setStatus( m_playerStatus ); m_player->setEnabled( !m_karaokePlaying ); // If we're playing, arm the timer if ( m_playerStatus == PlayerWidget::PLAYER_PLAYING ) m_updateTimer.start(); // Restore the window size resize( pCurrentState->windowSizeMusicQueue ); // Base class QWidget::show(); }
SCgWindow::SCgWindow(const QString& _windowTitle, QWidget *parent) : QWidget(parent) , mView(0) , mScene(0) , mZoomFactorLine(0) , mMinimap(0) , mUndoView(0) , mFindWidget(0) , mToolBar(0) , mUndoStack(0) , mEditMenu(0) , mActionUndo(0) , mActionRedo(0) , mActionFind(0) , mActionPrinterGrid(0) , mPrinterGridDialog(0) { Q_UNUSED(_windowTitle); mUndoStack = new QUndoStack(this); ///////////////////////////////////////////////// //Creating main environment mView = new SCgView(0, this); mScene = new SCgScene(mUndoStack, mView); mView->setScene(mScene); mView->setSceneRect(0, 0, 1000, 1000); mFindWidget = new SCgFindWidget(this); connect(mFindWidget, SIGNAL(findNext()), this, SLOT(findNext())); connect(mFindWidget, SIGNAL(findPrevious()), this, SLOT(findPrevious())); connect(mFindWidget, SIGNAL(find(QString)), this, SLOT(findTextChanged(QString))); mPrinterGridDialog = new SCgPrinterGridDialog(this); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(mView); layout->addWidget(mFindWidget); setLayout(layout); setAttribute(Qt::WA_DeleteOnClose); connect(mUndoStack, SIGNAL(cleanChanged(bool)), this, SLOT(stackCleanStateChanged(bool))); ///////////////////////////////////////////////// // Create widgets, which will be added into dock area of main window. createWidgetsForDocks(); createActions(); createToolBar(); }
/** * @brief FindBar::emitFindTextChangedSignal Emits the text changed signal */ void FindBar::emitFindTextChangedSignal(){ emit findTextChanged(this->getFindText()); }