Gui: fix activating of MDI views via menu commands
This commit is contained in:
@@ -229,7 +229,12 @@ StdCmdActivatePrevWindow::StdCmdActivatePrevWindow()
|
||||
sWhatsThis = "Std_ActivatePrevWindow";
|
||||
sStatusTip = QT_TR_NOOP("Activate previous window");
|
||||
sPixmap = "Std_WindowPrev";
|
||||
sAccel = keySequenceToAccel(QKeySequence::PreviousChild);
|
||||
// Depending on the OS 'QKeySequence::PreviousChild' gives
|
||||
// Ctrl+Shift+Backtab instead of Ctrl+Shift+Tab which leads
|
||||
// to a strange behaviour when using it.
|
||||
// A workaround is to create a shortcut as Shift + QKeySequence::NextChild
|
||||
static std::string previousChild = std::string("Shift+") + keySequenceToAccel(QKeySequence::NextChild);
|
||||
sAccel = previousChild.c_str();
|
||||
eType = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,6 +330,9 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(d->windowMapper, qOverload<QWidget*>(&QSignalMapper::mapped),
|
||||
this, &MainWindow::onSetActiveSubWindow);
|
||||
#elif QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
connect(d->windowMapper, &QSignalMapper::mappedWidget,
|
||||
this, &MainWindow::onSetActiveSubWindow);
|
||||
#else
|
||||
connect(d->windowMapper, &QSignalMapper::mappedObject,
|
||||
this, [=](QObject* object) {
|
||||
@@ -709,12 +712,20 @@ bool MainWindow::closeAllDocuments (bool close)
|
||||
|
||||
void MainWindow::activateNextWindow ()
|
||||
{
|
||||
d->mdiArea->activateNextSubWindow();
|
||||
auto tab = d->mdiArea->findChild<QTabBar*>();
|
||||
if (tab && tab->count() > 0) {
|
||||
int index = (tab->currentIndex() + 1) % tab->count();
|
||||
tab->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::activatePreviousWindow ()
|
||||
{
|
||||
d->mdiArea->activatePreviousSubWindow();
|
||||
auto tab = d->mdiArea->findChild<QTabBar*>();
|
||||
if (tab && tab->count() > 0) {
|
||||
int index = (tab->currentIndex() + tab->count() - 1) % tab->count();
|
||||
tab->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::activateWorkbench(const QString& name)
|
||||
|
||||
Reference in New Issue
Block a user