Optimize tool box position for big screen resolutions. Closes smart-pattern/valentina#45.

Instead of forcing users to one possible choice add an option to control size policy for the tool box.
This commit is contained in:
Roman Telezhynskyi 2020-06-01 12:21:09 +03:00
parent 813e100bca
commit 2da8f70f86
7 changed files with 52 additions and 3 deletions

View file

@ -47,7 +47,8 @@
- Setting scale factor for export and print.
- New layout generator option: Prefer one sheet solution.
- [smart-pattern/valentina#15] Organization of groups - groups categories
- Improve the property browser. Show full arc name.
- Improve the property browser. Show full arc name.
- [smart-pattern/valentina#45] Optimize tool box position for big screen resolutions.
# Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path.

View file

@ -127,6 +127,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
// Theme
ui->darkModeCheck->setChecked(settings->GetDarkMode());
// Tool panel
ui->checkBoxToolPanelScaling->setChecked(settings->GetToolPanelScaling());
// Tab Scrolling
ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin);
ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax);
@ -178,6 +181,11 @@ QStringList PreferencesConfigurationPage::Apply()
preferences.append(tr("dark mode"));
}
if (settings->GetToolPanelScaling() != ui->checkBoxToolPanelScaling->isChecked())
{
settings->SetToolPanelScaling(ui->checkBoxToolPanelScaling->isChecked());
}
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());

View file

@ -33,9 +33,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-152</y>
<y>-161</y>
<width>624</width>
<height>707</height>
<height>717</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -273,6 +273,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxToolPanelScaling">
<property name="toolTip">
<string>Change the position of the tool panel to optimize for big screen resolutions. By default, the tool panel will take all available space.</string>
</property>
<property name="text">
<string>Tool panel scaling</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View file

@ -4077,6 +4077,9 @@ void MainWindow::ReadSettings()
// Text under tool buton icon
ToolBarStyles();
// Tool box scaling
ToolBoxSizePolicy();
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isEnabled();
isDockGroupsVisible = ui->dockWidgetGroups->isEnabled();
@ -5084,6 +5087,14 @@ void MainWindow::ToolBarStyles()
ToolBarStyle(ui->mainToolBar);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBoxSizePolicy()
{
ui->toolBox->setSizePolicy(ui->toolBox->sizePolicy().horizontalPolicy(),
qApp->ValentinaSettings()->GetToolPanelScaling() ? QSizePolicy::Fixed
: QSizePolicy::Preferred);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ShowPaper(int index)
{
@ -5115,6 +5126,7 @@ void MainWindow::Preferences()
connect(dlg.data(), &DialogPreferences::UpdateProperties, toolOptions,
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBoxSizePolicy);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [this](){emit doc->FullUpdateFromFile();});
connect(dlg.data(), &DialogPreferences::UpdateProperties, ui->view,
&VMainGraphicsView::ResetScrollingAnimation);

View file

@ -122,6 +122,7 @@ private slots:
void PreviousPatternPiece();
void NextPatternPiece();
void ToolBarStyles();
void ToolBoxSizePolicy();
void ShowPaper(int index);
void Preferences();
#if defined(Q_OS_MAC)

View file

@ -73,6 +73,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
(QLatin1String("configuration/label_language")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
(QLatin1String("configuration/autoRefreshPatternMessage")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolPanelScaling,
(QLatin1String("configuration/toolPanelScaling")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
@ -822,6 +824,18 @@ void VSettings::SetWatermarkEditorSize(const QSize &sz)
setValue(*settingWatermarkEditorSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetToolPanelScaling() const
{
return value(*settingToolPanelScaling, false).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetToolPanelScaling(const bool &value)
{
setValue(*settingToolPanelScaling, value);
}
//---------------------------------------------------------------------------------------------------------------------
template<typename T>
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const

View file

@ -206,6 +206,9 @@ public:
QSize GetWatermarkEditorSize() const;
void SetWatermarkEditorSize(const QSize& sz);
bool GetToolPanelScaling() const;
void SetToolPanelScaling(const bool &value);
private:
Q_DISABLE_COPY(VSettings)