Tab with options to control Scrolling settings. ref #831.
Empiric settings do not work for all. --HG-- branch : develop
This commit is contained in:
parent
1e0b777bd6
commit
2ee75fdbab
|
@ -45,6 +45,10 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
m_labelLangChanged(false)
|
m_labelLangChanged(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
|
// Tab General
|
||||||
ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
ui->autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
|
||||||
|
|
||||||
InitLanguages(ui->langCombo);
|
InitLanguages(ui->langCombo);
|
||||||
|
@ -107,11 +111,34 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
|
||||||
settings->SetConfirmFormatRewriting(true);
|
settings->SetConfirmFormatRewriting(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
ui->checkBoxFreeCurve->setChecked(qApp->ValentinaSettings()->IsFreeCurveMode());
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
ui->checkBoxZoomFitBestCurrentPP->setChecked(qApp->ValentinaSettings()->IsDoubleClickZoomFitBestCurrentPP());
|
|
||||||
|
ui->checkBoxFreeCurve->setChecked(settings->IsFreeCurveMode());
|
||||||
|
ui->checkBoxZoomFitBestCurrentPP->setChecked(settings->IsDoubleClickZoomFitBestCurrentPP());
|
||||||
|
|
||||||
//----------------------- Toolbar
|
//----------------------- Toolbar
|
||||||
ui->toolBarStyleCheck->setChecked(qApp->ValentinaSettings()->GetToolBarStyle());
|
ui->toolBarStyleCheck->setChecked(settings->GetToolBarStyle());
|
||||||
|
|
||||||
|
// Tab Scrolling
|
||||||
|
ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin);
|
||||||
|
ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax);
|
||||||
|
ui->spinBoxDuration->setValue(settings->GetScrollingDuration());
|
||||||
|
|
||||||
|
ui->spinBoxUpdateInterval->setMinimum(VSettings::scrollingUpdateIntervalMin);
|
||||||
|
ui->spinBoxUpdateInterval->setMaximum(VSettings::scrollingUpdateIntervalMin);
|
||||||
|
ui->spinBoxUpdateInterval->setValue(settings->GetScrollingUpdateInterval());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxSensor->setMinimum(VSettings::sensorMouseScaleMin);
|
||||||
|
ui->doubleSpinBoxSensor->setMaximum(VSettings::sensorMouseScaleMax);
|
||||||
|
ui->doubleSpinBoxSensor->setValue(settings->GetSensorMouseScale());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxWheel->setMinimum(VSettings::wheelMouseScaleMin);
|
||||||
|
ui->doubleSpinBoxWheel->setMaximum(VSettings::wheelMouseScaleMax);
|
||||||
|
ui->doubleSpinBoxWheel->setValue(settings->GetWheelMouseScale());
|
||||||
|
|
||||||
|
ui->doubleSpinBoxAcceleration->setMinimum(VSettings::scrollingAccelerationMin);
|
||||||
|
ui->doubleSpinBoxAcceleration->setMaximum(VSettings::scrollingAccelerationMax);
|
||||||
|
ui->doubleSpinBoxAcceleration->setValue(settings->GetScrollingAcceleration());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -123,6 +150,7 @@ PreferencesConfigurationPage::~PreferencesConfigurationPage()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList PreferencesConfigurationPage::Apply()
|
QStringList PreferencesConfigurationPage::Apply()
|
||||||
{
|
{
|
||||||
|
// Tab General
|
||||||
QStringList preferences;
|
QStringList preferences;
|
||||||
VSettings *settings = qApp->ValentinaSettings();
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
|
settings->SetAutosaveState(ui->autoSaveCheck->isChecked());
|
||||||
|
@ -163,6 +191,14 @@ QStringList PreferencesConfigurationPage::Apply()
|
||||||
settings->SetLabelLanguage(locale);
|
settings->SetLabelLanguage(locale);
|
||||||
m_labelLangChanged = false;
|
m_labelLangChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab Scrolling
|
||||||
|
settings->SetScrollingDuration(ui->spinBoxDuration->value());
|
||||||
|
settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value());
|
||||||
|
settings->SetSensorMouseScale(ui->doubleSpinBoxSensor->value());
|
||||||
|
settings->SetWheelMouseScale(ui->doubleSpinBoxWheel->value());
|
||||||
|
settings->SetScrollingAcceleration(ui->doubleSpinBoxAcceleration->value());
|
||||||
|
|
||||||
return preferences;
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,245 +6,442 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>501</width>
|
<width>516</width>
|
||||||
<height>611</height>
|
<height>691</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">Configuration</string>
|
<string notr="true">Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="saveGroup">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="title">
|
<property name="currentIndex">
|
||||||
<string>Save</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QWidget" name="tabGeneral">
|
||||||
<item>
|
<attribute name="title">
|
||||||
<widget class="QCheckBox" name="autoSaveCheck">
|
<string>General</string>
|
||||||
<property name="text">
|
</attribute>
|
||||||
<string>Auto-save modified pattern</string>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
</property>
|
<item>
|
||||||
<property name="checked">
|
<widget class="QGroupBox" name="saveGroup">
|
||||||
<bool>true</bool>
|
<property name="title">
|
||||||
</property>
|
<string>Save</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QCheckBox" name="autoSaveCheck">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Interval:</string>
|
<string>Auto-save modified pattern</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="checked">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QSpinBox" name="autoTime">
|
</widget>
|
||||||
<property name="sizePolicy">
|
</item>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<item>
|
||||||
<horstretch>0</horstretch>
|
<widget class="QLabel" name="label">
|
||||||
<verstretch>0</verstretch>
|
<property name="text">
|
||||||
</sizepolicy>
|
<string>Interval:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="suffix">
|
</widget>
|
||||||
<string>min</string>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="minimum">
|
<widget class="QSpinBox" name="autoTime">
|
||||||
<number>1</number>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<property name="maximum">
|
<horstretch>0</horstretch>
|
||||||
<number>60</number>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="suffix">
|
||||||
</layout>
|
<string>min</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>60</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>GUI language:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="langCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Decimal separator parts:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="osOptionCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">< With OS options ></string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default unit:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Label language:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="unitCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="labelCombo"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Pattern making system</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pattern making system:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="systemCombo"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Author:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="systemAuthorValueLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">author</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="systemBookValueLabel">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Pattern editing</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetWarningsButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset warnings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxFreeCurve">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Update a pattern only after a curve release</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Free curve mode</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxZoomFitBestCurrentPP">
|
||||||
|
<property name="text">
|
||||||
|
<string>Double click calls Zoom fit best for current pattern piece</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>Toolbar</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toolBarStyleCheck">
|
||||||
|
<property name="text">
|
||||||
|
<string>The text appears under the icon (recommended for beginners).</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabScrolling">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Scrolling</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Animation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Duration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxDuration">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scrolling animation duration</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string comment="milliseconds">ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Update interval:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxUpdateInterval">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Time in milliseconds between each animation update</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string comment="milliseconds">ms</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>Mouse scale</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_4">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="sensor mouse">Sensor:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSensor">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scale scrolling sensitivity for mouse with sensor</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>2.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="mouse wheel">Wheel:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxWheel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Scale scrolling sensitivity for mouse with wheel</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>45.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>Scrolling</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Acceleration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxAcceleration">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.300000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Language</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>GUI language:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="langCombo"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Decimal separator parts:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QCheckBox" name="osOptionCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">< With OS options ></string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Default unit:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Label language:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="unitCombo"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QComboBox" name="labelCombo"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
|
||||||
<property name="title">
|
|
||||||
<string>Pattern making system</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Pattern making system:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="systemCombo"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Author:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="systemAuthorValueLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">author</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Book:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QPlainTextEdit" name="systemBookValueLabel">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_5">
|
|
||||||
<property name="title">
|
|
||||||
<string>Pattern editing</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="resetWarningsButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Reset warnings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxFreeCurve">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Update a pattern only after a curve release</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Free curve mode</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxZoomFitBestCurrentPP">
|
|
||||||
<property name="text">
|
|
||||||
<string>Double click calls Zoom fit best for current pattern piece</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_6">
|
|
||||||
<property name="title">
|
|
||||||
<string>Toolbar</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="toolBarStyleCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>The text appears under the icon (recommended for beginners).</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -4739,6 +4739,8 @@ void MainWindow::Preferences()
|
||||||
&VToolOptionsPropertyBrowser::RefreshOptions);
|
&VToolOptionsPropertyBrowser::RefreshOptions);
|
||||||
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
|
||||||
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [this](){emit doc->FullUpdateFromFile();});
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [this](){emit doc->FullUpdateFromFile();});
|
||||||
|
connect(dlg.data(), &DialogPreferences::UpdateProperties, ui->view,
|
||||||
|
&VMainGraphicsView::ResetScrollingAnimation);
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
if (guard->exec() == QDialog::Accepted)
|
if (guard->exec() == QDialog::Accepted)
|
||||||
|
|
|
@ -46,6 +46,26 @@
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMarginsF)
|
Q_DECLARE_METATYPE(QMarginsF)
|
||||||
|
|
||||||
|
const int VSettings::defaultScrollingDuration = 300;
|
||||||
|
const int VSettings::scrollingDurationMin = 100;
|
||||||
|
const int VSettings::scrollingDurationMax = 1000;
|
||||||
|
|
||||||
|
const int VSettings::defaultScrollingUpdateInterval = 30;
|
||||||
|
const int VSettings::scrollingUpdateIntervalMin = 10;
|
||||||
|
const int VSettings::scrollingUpdateIntervalMax = 100;
|
||||||
|
|
||||||
|
const qreal VSettings::defaultSensorMouseScale = 2.0;
|
||||||
|
const qreal VSettings::sensorMouseScaleMin = 1.0;
|
||||||
|
const qreal VSettings::sensorMouseScaleMax = 10.0;
|
||||||
|
|
||||||
|
const qreal VSettings::defaultWheelMouseScale = 45.0;
|
||||||
|
const qreal VSettings::wheelMouseScaleMin = 1.0;
|
||||||
|
const qreal VSettings::wheelMouseScaleMax = 100.0;
|
||||||
|
|
||||||
|
const qreal VSettings::defaultScrollingAcceleration = 1.3;
|
||||||
|
const qreal VSettings::scrollingAccelerationMin = 1.0;
|
||||||
|
const qreal VSettings::scrollingAccelerationMax = 10.0;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
|
||||||
|
@ -79,6 +99,19 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFMargins, (QLatin1String(
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperHeight, (QLatin1String("tiledPDF/paperHeight")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFPaperWidth, (QLatin1String("tiledPDF/paperWidth")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1String("tiledPDF/orientation")))
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, (QLatin1String("scrolling/sensorMouseScale")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
||||||
|
|
||||||
|
// Reading settings file is very expensive, cache values to speed up getting a value
|
||||||
|
int scrollingDurationCached = -1;
|
||||||
|
int scrollingUpdateIntervalCached = -1;
|
||||||
|
qreal scrollingSensorMouseScaleCached = -1;
|
||||||
|
qreal scrollingWheelMouseScaleCached = -1;
|
||||||
|
qreal scrollingAccelerationCached = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -638,3 +671,85 @@ void VSettings::SetTiledPDFOrientation(PageOrientation value)
|
||||||
setValue(*settingTiledPDFOrientation, static_cast<bool> (value));
|
setValue(*settingTiledPDFOrientation, static_cast<bool> (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VSettings::GetScrollingDuration() const
|
||||||
|
{
|
||||||
|
return GetCachedValue(scrollingDurationCached, *settingScrollingDuration, defaultScrollingDuration,
|
||||||
|
scrollingDurationMin, scrollingDurationMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetScrollingDuration(int duration)
|
||||||
|
{
|
||||||
|
scrollingDurationCached = qBound(scrollingDurationMin, duration, scrollingDurationMax);
|
||||||
|
setValue(*settingScrollingDuration, scrollingDurationCached);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VSettings::GetScrollingUpdateInterval() const
|
||||||
|
{
|
||||||
|
return GetCachedValue(scrollingUpdateIntervalCached, *settingScrollingUpdateInterval,
|
||||||
|
defaultScrollingUpdateInterval, scrollingUpdateIntervalMin, scrollingUpdateIntervalMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetScrollingUpdateInterval(int updateInterval)
|
||||||
|
{
|
||||||
|
scrollingUpdateIntervalCached = qBound(scrollingUpdateIntervalMin, updateInterval, scrollingUpdateIntervalMax);
|
||||||
|
setValue(*settingScrollingUpdateInterval, scrollingUpdateIntervalCached);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VSettings::GetSensorMouseScale() const
|
||||||
|
{
|
||||||
|
return GetCachedValue(scrollingSensorMouseScaleCached, *settingScrollingSensorMouseScale, defaultSensorMouseScale,
|
||||||
|
sensorMouseScaleMin, sensorMouseScaleMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetSensorMouseScale(qreal scale)
|
||||||
|
{
|
||||||
|
scrollingSensorMouseScaleCached = qBound(sensorMouseScaleMin, scale, sensorMouseScaleMax);
|
||||||
|
setValue(*settingScrollingSensorMouseScale, scrollingSensorMouseScaleCached);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VSettings::GetWheelMouseScale() const
|
||||||
|
{
|
||||||
|
return GetCachedValue(scrollingWheelMouseScaleCached, *settingScrollingWheelMouseScale, defaultWheelMouseScale,
|
||||||
|
wheelMouseScaleMin, wheelMouseScaleMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetWheelMouseScale(qreal scale)
|
||||||
|
{
|
||||||
|
scrollingWheelMouseScaleCached = qBound(wheelMouseScaleMin, scale, wheelMouseScaleMax);
|
||||||
|
setValue(*settingScrollingWheelMouseScale, scrollingWheelMouseScaleCached);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VSettings::GetScrollingAcceleration() const
|
||||||
|
{
|
||||||
|
return GetCachedValue(scrollingAccelerationCached, *settingScrollingAcceleration, defaultScrollingAcceleration,
|
||||||
|
scrollingAccelerationMin, scrollingAccelerationMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetScrollingAcceleration(qreal acceleration)
|
||||||
|
{
|
||||||
|
scrollingAccelerationCached = qBound(scrollingAccelerationMin, acceleration, scrollingAccelerationMax);
|
||||||
|
setValue(*settingScrollingAcceleration, scrollingAccelerationCached);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename T>
|
||||||
|
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
||||||
|
{
|
||||||
|
if (cache < 0)
|
||||||
|
{
|
||||||
|
const QVariant val = value(setting, defValue);
|
||||||
|
cache = val.canConvert<T>() ? qBound(valueMin, val.value<T>(), valueMax) : defValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
|
@ -148,8 +148,41 @@ public:
|
||||||
PageOrientation GetTiledPDFOrientation() const;
|
PageOrientation GetTiledPDFOrientation() const;
|
||||||
void SetTiledPDFOrientation(PageOrientation value);
|
void SetTiledPDFOrientation(PageOrientation value);
|
||||||
|
|
||||||
|
static const int defaultScrollingDuration;
|
||||||
|
static const int scrollingDurationMin;
|
||||||
|
static const int scrollingDurationMax;
|
||||||
|
int GetScrollingDuration() const;
|
||||||
|
void SetScrollingDuration(int duration);
|
||||||
|
|
||||||
|
static const int defaultScrollingUpdateInterval;
|
||||||
|
static const int scrollingUpdateIntervalMin;
|
||||||
|
static const int scrollingUpdateIntervalMax;
|
||||||
|
int GetScrollingUpdateInterval() const;
|
||||||
|
void SetScrollingUpdateInterval(int updateInterval);
|
||||||
|
|
||||||
|
static const qreal defaultSensorMouseScale;
|
||||||
|
static const qreal sensorMouseScaleMin;
|
||||||
|
static const qreal sensorMouseScaleMax;
|
||||||
|
qreal GetSensorMouseScale() const;
|
||||||
|
void SetSensorMouseScale(qreal scale);
|
||||||
|
|
||||||
|
static const qreal defaultWheelMouseScale;
|
||||||
|
static const qreal wheelMouseScaleMin;
|
||||||
|
static const qreal wheelMouseScaleMax;
|
||||||
|
qreal GetWheelMouseScale() const;
|
||||||
|
void SetWheelMouseScale(qreal scale);
|
||||||
|
|
||||||
|
static const qreal defaultScrollingAcceleration;
|
||||||
|
static const qreal scrollingAccelerationMin;
|
||||||
|
static const qreal scrollingAccelerationMax;
|
||||||
|
qreal GetScrollingAcceleration() const;
|
||||||
|
void SetScrollingAcceleration(qreal acceleration);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VSettings)
|
Q_DISABLE_COPY(VSettings)
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSETTINGS_H
|
#endif // VSETTINGS_H
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
#include "../vmisc/vsettings.h"
|
#include "../vmisc/vsettings.h"
|
||||||
#include "vabstractmainwindow.h"
|
#include "vabstractmainwindow.h"
|
||||||
|
|
||||||
const int GraphicsViewZoom::duration = 350;
|
|
||||||
const int GraphicsViewZoom::updateInterval = 30;
|
|
||||||
|
|
||||||
const qreal maxSceneSize = ((20.0 * 1000.0) / 25.4) * PrintDPI; // 20 meters in pixels
|
const qreal maxSceneSize = ((20.0 * 1000.0) / 25.4) * PrintDPI; // 20 meters in pixels
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -77,15 +74,16 @@ qreal ScrollingSteps(QWheelEvent* wheel_event)
|
||||||
const QPoint numPixels = wheel_event->pixelDelta();
|
const QPoint numPixels = wheel_event->pixelDelta();
|
||||||
const QPoint numDegrees = wheel_event->angleDelta() / 8;
|
const QPoint numDegrees = wheel_event->angleDelta() / 8;
|
||||||
qreal numSteps = 0;
|
qreal numSteps = 0;
|
||||||
|
VSettings *settings = qobject_cast<VSettings *>(qApp->Settings());
|
||||||
|
|
||||||
if (not numPixels.isNull())
|
if (not numPixels.isNull())
|
||||||
{
|
{
|
||||||
const qreal mouseScale = 2.;
|
const qreal mouseScale = settings->GetSensorMouseScale();
|
||||||
numSteps = (wheel_event->orientation() == Qt::Vertical ? numPixels.y() : numPixels.x()) / mouseScale;
|
numSteps = (wheel_event->orientation() == Qt::Vertical ? numPixels.y() : numPixels.x()) / mouseScale;
|
||||||
}
|
}
|
||||||
else if (not numDegrees.isNull())
|
else if (not numDegrees.isNull())
|
||||||
{
|
{
|
||||||
const qreal mouseScale = 45.;
|
const qreal mouseScale = settings->GetWheelMouseScale();
|
||||||
numSteps = (wheel_event->orientation() == Qt::Vertical ? numDegrees.y() : numDegrees.x()) / 15. * mouseScale;
|
numSteps = (wheel_event->orientation() == Qt::Vertical ? numDegrees.y() : numDegrees.x()) / 15. * mouseScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +109,7 @@ qreal PrepareScrolling(qreal scheduledScrollings, QWheelEvent *wheel_event)
|
||||||
scheduledScrollings += numSteps;
|
scheduledScrollings += numSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduledScrollings *= 1.3;
|
scheduledScrollings *= qobject_cast<VSettings *>(qApp->Settings())->GetScrollingAcceleration();
|
||||||
|
|
||||||
return scheduledScrollings;
|
return scheduledScrollings;
|
||||||
}
|
}
|
||||||
|
@ -123,24 +121,18 @@ GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view)
|
||||||
_view(view),
|
_view(view),
|
||||||
_modifiers(Qt::ControlModifier),
|
_modifiers(Qt::ControlModifier),
|
||||||
_zoom_factor_base(1.0015),
|
_zoom_factor_base(1.0015),
|
||||||
target_scene_pos(QPointF()),
|
target_scene_pos(),
|
||||||
target_viewport_pos(QPointF()),
|
target_viewport_pos(),
|
||||||
verticalScrollAnim(new QTimeLine(duration, this)),
|
verticalScrollAnim(),
|
||||||
_numScheduledVerticalScrollings(0),
|
_numScheduledVerticalScrollings(0),
|
||||||
horizontalScrollAnim(new QTimeLine(duration, this)),
|
horizontalScrollAnim(),
|
||||||
_numScheduledHorizontalScrollings(0)
|
_numScheduledHorizontalScrollings(0)
|
||||||
{
|
{
|
||||||
_view->viewport()->installEventFilter(this);
|
_view->viewport()->installEventFilter(this);
|
||||||
_view->viewport()->grabGesture(Qt::PinchGesture);
|
_view->viewport()->grabGesture(Qt::PinchGesture);
|
||||||
_view->setMouseTracking(true);
|
_view->setMouseTracking(true);
|
||||||
|
|
||||||
verticalScrollAnim->setUpdateInterval(updateInterval);
|
InitScrollingAnimation();
|
||||||
connect(verticalScrollAnim, &QTimeLine::valueChanged, this, &GraphicsViewZoom::VerticalScrollingTime);
|
|
||||||
connect(verticalScrollAnim, &QTimeLine::finished, this, &GraphicsViewZoom::animFinished);
|
|
||||||
|
|
||||||
horizontalScrollAnim->setUpdateInterval(updateInterval);
|
|
||||||
connect(horizontalScrollAnim, &QTimeLine::valueChanged, this, &GraphicsViewZoom::HorizontalScrollingTime);
|
|
||||||
connect(horizontalScrollAnim, &QTimeLine::finished, this, &GraphicsViewZoom::animFinished);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -186,6 +178,34 @@ void GraphicsViewZoom::set_zoom_factor_base(double value)
|
||||||
_zoom_factor_base = value;
|
_zoom_factor_base = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void GraphicsViewZoom::InitScrollingAnimation()
|
||||||
|
{
|
||||||
|
VSettings *settings = qobject_cast<VSettings *>(qApp->Settings());
|
||||||
|
|
||||||
|
if (not verticalScrollAnim.isNull())
|
||||||
|
{
|
||||||
|
delete verticalScrollAnim;
|
||||||
|
}
|
||||||
|
|
||||||
|
verticalScrollAnim = new QTimeLine(settings->GetScrollingDuration(), this);
|
||||||
|
verticalScrollAnim->setUpdateInterval(settings->GetScrollingUpdateInterval());
|
||||||
|
|
||||||
|
connect(verticalScrollAnim, &QTimeLine::valueChanged, this, &GraphicsViewZoom::VerticalScrollingTime);
|
||||||
|
connect(verticalScrollAnim, &QTimeLine::finished, this, &GraphicsViewZoom::animFinished);
|
||||||
|
|
||||||
|
if (not horizontalScrollAnim.isNull())
|
||||||
|
{
|
||||||
|
delete horizontalScrollAnim;
|
||||||
|
}
|
||||||
|
|
||||||
|
horizontalScrollAnim = new QTimeLine(settings->GetScrollingDuration(), this);
|
||||||
|
horizontalScrollAnim->setUpdateInterval(settings->GetScrollingUpdateInterval());
|
||||||
|
|
||||||
|
connect(horizontalScrollAnim, &QTimeLine::valueChanged, this, &GraphicsViewZoom::HorizontalScrollingTime);
|
||||||
|
connect(horizontalScrollAnim, &QTimeLine::finished, this, &GraphicsViewZoom::animFinished);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void GraphicsViewZoom::VerticalScrollingTime(qreal x)
|
void GraphicsViewZoom::VerticalScrollingTime(qreal x)
|
||||||
{
|
{
|
||||||
|
@ -490,6 +510,12 @@ void VMainGraphicsView::ZoomFitBest()
|
||||||
emit ScaleChanged(this->transform().m11());
|
emit ScaleChanged(this->transform().m11());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMainGraphicsView::ResetScrollingAnimation()
|
||||||
|
{
|
||||||
|
zoom->InitScrollingAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief mousePressEvent handle mouse press events.
|
* @brief mousePressEvent handle mouse press events.
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* This class adds ability to zoom QGraphicsView using mouse wheel. The point under cursor
|
* This class adds ability to zoom QGraphicsView using mouse wheel. The point under cursor
|
||||||
|
@ -77,6 +78,7 @@ public:
|
||||||
void gentle_zoom(double factor);
|
void gentle_zoom(double factor);
|
||||||
void set_modifiers(Qt::KeyboardModifiers modifiers);
|
void set_modifiers(Qt::KeyboardModifiers modifiers);
|
||||||
void set_zoom_factor_base(double value);
|
void set_zoom_factor_base(double value);
|
||||||
|
void InitScrollingAnimation();
|
||||||
signals:
|
signals:
|
||||||
void zoomed();
|
void zoomed();
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -92,16 +94,13 @@ private:
|
||||||
double _zoom_factor_base;
|
double _zoom_factor_base;
|
||||||
QPointF target_scene_pos;
|
QPointF target_scene_pos;
|
||||||
QPointF target_viewport_pos;
|
QPointF target_viewport_pos;
|
||||||
QTimeLine *verticalScrollAnim;
|
QPointer<QTimeLine> verticalScrollAnim;
|
||||||
/** @brief _numScheduledVerticalScrollings keep number scheduled vertical scrollings. */
|
/** @brief _numScheduledVerticalScrollings keep number scheduled vertical scrollings. */
|
||||||
qreal _numScheduledVerticalScrollings;
|
qreal _numScheduledVerticalScrollings;
|
||||||
QTimeLine *horizontalScrollAnim;
|
QPointer<QTimeLine> horizontalScrollAnim;
|
||||||
/** @brief _numScheduledHorizontalScrollings keep number scheduled horizontal scrollings. */
|
/** @brief _numScheduledHorizontalScrollings keep number scheduled horizontal scrollings. */
|
||||||
qreal _numScheduledHorizontalScrollings;
|
qreal _numScheduledHorizontalScrollings;
|
||||||
|
|
||||||
static const int duration;
|
|
||||||
static const int updateInterval;
|
|
||||||
|
|
||||||
void FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view);
|
void FictiveSceneRect(QGraphicsScene *sc, QGraphicsView *view);
|
||||||
|
|
||||||
void StartVerticalScrollings(QWheelEvent* wheel_event);
|
void StartVerticalScrollings(QWheelEvent* wheel_event);
|
||||||
|
@ -154,6 +153,7 @@ public slots:
|
||||||
void ZoomOut();
|
void ZoomOut();
|
||||||
void ZoomOriginal();
|
void ZoomOriginal();
|
||||||
void ZoomFitBest();
|
void ZoomFitBest();
|
||||||
|
void ResetScrollingAnimation();
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user