improvement: ajust size of grid-dots with zoom-factor

Introduced additional spinboxes in config-page for
setting min- and max-size of grid-dots separately for
diagram- and element-editor.
That assures maximal flexibility for setting the grids.
Don't want the grid-dots to change over zooming-levels?
Set min- and max-values to the same number.
Preset-values for all min-/max-values is "1".
If the adjustable range of 1 to 5 is not sufficient, it
can be easily adjusted. Only need feedback for this.
This commit is contained in:
plc-user
2025-03-07 20:16:21 +01:00
parent 2b0dd1b188
commit 0804d3524a
38 changed files with 2224 additions and 1596 deletions

View File

@@ -71,7 +71,8 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->DiagramEditor_yKeyGrid_sb->setValue(settings.value("diagrameditor/key_Ygrid", 10).toInt());
ui->DiagramEditor_xKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Xgrid", 1).toInt());
ui->DiagramEditor_yKeyGridFine_sb->setValue(settings.value("diagrameditor/key_fine_Ygrid", 1).toInt());
ui->DiagramEditor_Grid_PointSize_sb->setValue(settings.value("diagrameditor/grid_pointsize", 1).toInt());
ui->DiagramEditor_Grid_PointSize_min_sb->setValue(settings.value("diagrameditor/grid_pointsize_min", 1).toInt());
ui->DiagramEditor_Grid_PointSize_max_sb->setValue(settings.value("diagrameditor/grid_pointsize_max", 1).toInt());
ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
if(tabbed)
@@ -129,7 +130,9 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
et que la liste ne sera donc pas mise a jour.
*/
ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt());
ui->ElementEditor_Grid_PointSize_min_sb->setValue(settings.value("elementeditor/grid_pointsize_min", 1).toInt());
ui->ElementEditor_Grid_PointSize_max_sb->setValue(settings.value("elementeditor/grid_pointsize_max", 1).toInt());
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
if (path != "default")
{
@@ -211,6 +214,8 @@ void GeneralConfigurationPage::applyConf()
//ELEMENT EDITOR
settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value());
settings.setValue("elementeditor/grid_pointsize_min", ui->ElementEditor_Grid_PointSize_min_sb->value());
settings.setValue("elementeditor/grid_pointsize_max", ui->ElementEditor_Grid_PointSize_max_sb->value());
//DIAGRAM VIEW
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
@@ -238,7 +243,8 @@ void GeneralConfigurationPage::applyConf()
settings.setValue("diagrameditor/key_Ygrid", ui->DiagramEditor_yKeyGrid_sb->value());
settings.setValue("diagrameditor/key_fine_Xgrid", ui->DiagramEditor_xKeyGridFine_sb->value());
settings.setValue("diagrameditor/key_fine_Ygrid", ui->DiagramEditor_yKeyGridFine_sb->value());
settings.setValue("diagrameditor/grid_pointsize", ui->DiagramEditor_Grid_PointSize_sb->value());
settings.setValue("diagrameditor/grid_pointsize_min", ui->DiagramEditor_Grid_PointSize_min_sb->value());
settings.setValue("diagrameditor/grid_pointsize_max", ui->DiagramEditor_Grid_PointSize_max_sb->value());
//Dynamic text item
settings.setValue("diagrameditor/dynamic_text_rotation", ui->m_dyn_text_rotation_sb->value());
settings.setValue("diagrameditor/dynamic_text_width", ui->m_dyn_text_width_sb->value());
@@ -531,3 +537,25 @@ void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int
ui->MaxPartsElementEditorList_sb->setStyleSheet("");
}
}
/**
@brief GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged
the min-value of the max-SpinBox has to be limited:
may not be smaller than current value of min-SpinBox
@param value - the new value of the min-SpinBox
*/
void GeneralConfigurationPage::on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value)
{
ui->DiagramEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
}
/**
@brief GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged
the min-value of the max-SpinBox has to be limited:
may not be smaller than current value of min-SpinBox
@param value - the new value of the min-SpinBox
*/
void GeneralConfigurationPage::on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value)
{
ui->ElementEditor_Grid_PointSize_max_sb->setMinimum(std::max(1, value));
}

View File

@@ -48,6 +48,8 @@ class GeneralConfigurationPage : public ConfigPage
void on_m_custom_tbt_path_cb_currentIndexChanged(int index);
void on_m_indi_text_font_pb_clicked();
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
void on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value);
void on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value);
private:
void fillLang();

View File

@@ -887,11 +887,25 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="DiagramEditor_Grid_PointSize_sb">
<item row="0" column="4">
<widget class="QLabel" name="label_18">
<property name="text">
<string>max:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Label_Diagram_Grid_PointSize">
<property name="text">
<string>Taille des points de la grille de Diagram-Editor : 1 - 5</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QSpinBox" name="DiagramEditor_Grid_PointSize_max_sb">
<property name="minimumSize">
<size>
<width>80</width>
<width>60</width>
<height>0</height>
</size>
</property>
@@ -903,10 +917,79 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="Label_Diagram_Grid_PointSize">
<item row="0" column="2">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Taille du point Grille : 1 - 5</string>
<string>min:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="DiagramEditor_Grid_PointSize_min_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Taille des points de la grille de l'éditeur d'éléments : 1 - 5</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QSpinBox" name="ElementEditor_Grid_PointSize_max_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label_21">
<property name="text">
<string>max:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="ElementEditor_Grid_PointSize_min_sb">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_22">
<property name="text">
<string>min:</string>
</property>
</widget>
</item>