New feature: Always keep on top.

This commit is contained in:
Roman Telezhynskyi 2023-11-15 09:04:50 +02:00
parent 9178456a9f
commit bf4942e316
7 changed files with 47 additions and 0 deletions

View File

@ -53,6 +53,7 @@
- Shortcuts manager.
- Support for custom known measurements.
- Allow negative values.
- Tape app. New feature: Always keep on top.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View File

@ -2129,6 +2129,10 @@ void TKMMainWindow::CreateWindowMenu(QMenu *menu)
QAction *action = menu->addAction(tr("&New Window"));
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainKMWindow()->activateWindow(); });
action->setMenuRole(QAction::NoRole);
menu->addAction(ui->actionAlwaysOnTop);
connect(ui->actionAlwaysOnTop, &QAction::triggered, this, &TKMMainWindow::AlwaysOnTop);
menu->addSeparator();
const QList<TKMMainWindow *> windows = MApplication::VApp()->MainKMWindows();

View File

@ -1203,6 +1203,20 @@
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionAlwaysOnTop">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Always on top</string>
</property>
<property name="toolTip">
<string>Keep window always on top</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -4227,6 +4227,10 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
QAction *action = menu->addAction(tr("&New Window"));
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainTapeWindow()->activateWindow(); });
action->setMenuRole(QAction::NoRole);
menu->addAction(ui->actionAlwaysOnTop);
connect(ui->actionAlwaysOnTop, &QAction::triggered, this, &TMainWindow::AlwaysOnTop);
menu->addSeparator();
const QList<TMainWindow *> windows = MApplication::VApp()->MainTapeWindows();

View File

@ -1726,6 +1726,20 @@
<string>Edit current Known Measurements</string>
</property>
</action>
<action name="actionAlwaysOnTop">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Always on top</string>
</property>
<property name="toolTip">
<string>Keep window always on top</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -411,6 +411,15 @@ void VAbstractMainWindow::ExportDataToCSV()
}
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractMainWindow::AlwaysOnTop(bool state)
{
setWindowFlag(Qt::WindowStaysOnTopHint, state);
destroy();
create();
setVisible(true);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractMainWindow::UpdateVisibilityGroups()
{

View File

@ -61,6 +61,7 @@ public slots:
protected slots:
void ExportDataToCSV();
void AlwaysOnTop(bool state);
protected:
unsigned m_curFileFormatVersion;