mode: set tabs moveable
This commit is contained in:
parent
cb9b03e418
commit
77e0d156d0
@ -58,6 +58,15 @@ void ModeHandler::setCurrentIndex(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModeHandler::currentModeMoved(int from, int to)
|
||||||
|
{
|
||||||
|
auto modeFrom = modes.at(from);
|
||||||
|
auto modeTo = modes.at(to);
|
||||||
|
modes[from] = modeTo;
|
||||||
|
modes[to] = modeFrom;
|
||||||
|
setCurrentIndex(to);
|
||||||
|
}
|
||||||
|
|
||||||
int ModeHandler::getCurrentIndex()
|
int ModeHandler::getCurrentIndex()
|
||||||
{
|
{
|
||||||
return currentModeIndex;
|
return currentModeIndex;
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
void shutdown();
|
void shutdown();
|
||||||
int createMode(QString name, Mode::Type t);
|
int createMode(QString name, Mode::Type t);
|
||||||
void closeMode(int index);
|
void closeMode(int index);
|
||||||
|
void currentModeMoved(int from, int to);
|
||||||
void closeModes();
|
void closeModes();
|
||||||
int getCurrentIndex();
|
int getCurrentIndex();
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ ModeWindow::ModeWindow(ModeHandler* handler, AppWindow* aw, QWidget* parent):
|
|||||||
|
|
||||||
connect(tabBar, &QTabBar::currentChanged, handler, &ModeHandler::setCurrentIndex);
|
connect(tabBar, &QTabBar::currentChanged, handler, &ModeHandler::setCurrentIndex);
|
||||||
connect(tabBar, &QTabBar::tabCloseRequested, handler, &ModeHandler::closeMode);
|
connect(tabBar, &QTabBar::tabCloseRequested, handler, &ModeHandler::closeMode);
|
||||||
|
connect(tabBar, &QTabBar::tabMoved, handler, &ModeHandler::currentModeMoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModeWindow::~ModeWindow()
|
ModeWindow::~ModeWindow()
|
||||||
@ -94,7 +95,7 @@ void ModeWindow::ModeCreated(int modeIndex)
|
|||||||
tabBar->blockSignals(true);
|
tabBar->blockSignals(true);
|
||||||
tabBar->insertTab(modeIndex, name);
|
tabBar->insertTab(modeIndex, name);
|
||||||
tabBar->blockSignals(false);
|
tabBar->blockSignals(false);
|
||||||
|
tabBar->setMovable(true);
|
||||||
tabBar->setCurrentIndex(modeIndex);
|
tabBar->setCurrentIndex(modeIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user