Merge pull request #126 from sophiekovalevsky/mode-tabs-movable

mode: set tabs movable
This commit is contained in:
jankae 2022-07-09 15:51:13 +02:00 committed by GitHub
commit c21f51bf46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,12 +87,19 @@ Mode::Mode(AppWindow *window, QString name, QString SCPIname)
connect(tabbar, &QTabBar::tabCloseRequested, [=](int index){
delete modes[index];
});
connect(tabbar, &QTabBar::tabMoved, [=](int from, int to){
auto modeFrom = modes.at(from);
auto modeTo = modes.at(to);
modes[from] = modeTo;
modes[to] = modeFrom;
});
}
connect(this, &Mode::statusbarMessage, window, &AppWindow::setModeStatus);
modes.push_back(this);
tabbar->blockSignals(true);
tabbar->insertTab(tabbar->count(), name);
tabbar->blockSignals(false);
tabbar->setMovable(true);
window->getSCPI()->add(this);
}