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. - Shortcuts manager.
- Support for custom known measurements. - Support for custom known measurements.
- Allow negative values. - Allow negative values.
- Tape app. New feature: Always keep on top.
# Valentina 0.7.52 September 12, 2022 # Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru. - 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")); QAction *action = menu->addAction(tr("&New Window"));
connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainKMWindow()->activateWindow(); }); connect(action, &QAction::triggered, this, []() { MApplication::VApp()->NewMainKMWindow()->activateWindow(); });
action->setMenuRole(QAction::NoRole); action->setMenuRole(QAction::NoRole);
menu->addAction(ui->actionAlwaysOnTop);
connect(ui->actionAlwaysOnTop, &QAction::triggered, this, &TKMMainWindow::AlwaysOnTop);
menu->addSeparator(); menu->addSeparator();
const QList<TKMMainWindow *> windows = MApplication::VApp()->MainKMWindows(); const QList<TKMMainWindow *> windows = MApplication::VApp()->MainKMWindows();

View File

@ -1203,6 +1203,20 @@
<enum>QAction::NoRole</enum> <enum>QAction::NoRole</enum>
</property> </property>
</action> </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> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

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

View File

@ -1726,6 +1726,20 @@
<string>Edit current Known Measurements</string> <string>Edit current Known Measurements</string>
</property> </property>
</action> </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> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <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() void VAbstractMainWindow::UpdateVisibilityGroups()
{ {

View File

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