mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-24 13:18:29 -04:00
Massive UI revamping (v7): Renumerate workspaces and workspace index in sub windows after empty workspace trimmin. Fixes #1212
This commit is contained in:
parent
1855e9afe7
commit
dc303cdd7d
@ -215,6 +215,19 @@ Workspace::~Workspace()
|
||||
qDebug("Workspace::~Workspace: end");
|
||||
}
|
||||
|
||||
void Workspace::setIndex(int index)
|
||||
{
|
||||
m_index = index;
|
||||
setWindowTitle(tr("W%1").arg(m_index));
|
||||
setObjectName(tr("W%1").arg(m_index));
|
||||
m_titleLabel->setText(windowTitle());
|
||||
}
|
||||
|
||||
QList<QMdiSubWindow *> Workspace::getSubWindowList() const
|
||||
{
|
||||
return m_mdi->subWindowList();
|
||||
}
|
||||
|
||||
void Workspace::toggleFloating()
|
||||
{
|
||||
setFloating(!isFloating());
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
~Workspace();
|
||||
|
||||
int getIndex() const { return m_index; }
|
||||
void setIndex(int index);
|
||||
void resetAvailableFeatures() { m_featureAddDialog.resetFeatureNames(); }
|
||||
void addAvailableFeatures(const QStringList& featureNames) { m_featureAddDialog.addFeatureNames(featureNames); }
|
||||
void addToMdiArea(QMdiSubWindow *sub);
|
||||
@ -47,6 +48,7 @@ public:
|
||||
int getNumberOfSubWindows() const;
|
||||
QByteArray saveMdiGeometry();
|
||||
void restoreMdiGeometry(const QByteArray& blob);
|
||||
QList<QMdiSubWindow *> getSubWindowList() const;
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
|
@ -1830,6 +1830,33 @@ void MainWindow::removeEmptyWorkspaces()
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// Renumerate
|
||||
for (int i = 0; i < m_workspaces.size(); i++)
|
||||
{
|
||||
Workspace *workspace = m_workspaces[i];
|
||||
workspace->setIndex(i);
|
||||
QList<QMdiSubWindow *> subWindows = workspace->getSubWindowList();
|
||||
|
||||
for (auto& subWindow : subWindows)
|
||||
{
|
||||
if (qobject_cast<DeviceGUI*>(subWindow)) {
|
||||
qobject_cast<DeviceGUI*>(subWindow)->setWorkspaceIndex(i);
|
||||
}
|
||||
|
||||
if (qobject_cast<MainSpectrumGUI*>(subWindow)) {
|
||||
qobject_cast<MainSpectrumGUI*>(subWindow)->setWorkspaceIndex(i);
|
||||
}
|
||||
|
||||
if (qobject_cast<ChannelGUI*>(subWindow)) {
|
||||
qobject_cast<ChannelGUI*>(subWindow)->setWorkspaceIndex(i);
|
||||
}
|
||||
|
||||
if (qobject_cast<FeatureGUI*>(subWindow)) {
|
||||
qobject_cast<FeatureGUI*>(subWindow)->setWorkspaceIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_View_Fullscreen_toggled(bool checked)
|
||||
|
Loading…
Reference in New Issue
Block a user