C++ (Qt)void MainWindow::checkForActionsAvailable()
C++ (Qt)ui->mdiArea->isActiveWindow()
C++ (Qt)void MainWindow::checkForActionsAvailable(){ if( !ui->mdiArea->isActiveWindow() ) { qDebug() << "Error: isActiveWindow() is false"; return; } DocWindow *widget = qobject_cast<DocWindow*>( ui->mdiArea->activeSubWindow()->widget() ); if( !widget ) { qDebug() << "Error: activeSubWindow() is not DocWindow"; return; } ui->actionUndo->setEnabled( widget->document()->isUndoAvailable() ); ui->actionRedo->setEnabled( widget->document()->isRedoAvailable() ); ui->actionPaste->setEnabled( widget->canPaste() );}
void MainWindow::checkForActionsAvailable(){ if (ui->mdiArea->subWindowList().count() != 0) { DocWindow *pDoc = qobject_cast<DocWindow*>(ui->mdiArea->activeSubWindow()->widget()); if (pDoc != 0) { ui->actionUndo->setEnabled(pDoc->document()->isUndoAvailable()); ui->actionRedo->setEnabled(pDoc->document()->isRedoAvailable()); ui->actionPaste->setEnabled(pDoc->canPaste()); } }}