[qet] qet/qet: [5749] Add two speedsize for displacing items when working with a keyboard on |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5749
Author: scorpio810
Date: 2019-02-24 16:44:47 +0100 (Sun, 24 Feb 2019)
Log Message:
-----------
Add two speedsize for displacing items when working with a keyboard on
diagram editor :
normal displacement "adjustable from 1 to 30"
(keys : Left,Right,Up,Down)
fine displacement "adjustable from 1 to 10"
(ALT + keys : Left,Right,Up,Down ), thanks Erik for his patch
Modified Paths:
--------------
trunk/sources/diagram.cpp
trunk/sources/diagram.h
trunk/sources/ui/configpage/generalconfigurationpage.cpp
trunk/sources/ui/configpage/generalconfigurationpage.ui
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2019-02-21 21:57:35 UTC (rev 5748)
+++ trunk/sources/diagram.cpp 2019-02-24 15:44:47 UTC (rev 5749)
@@ -42,6 +42,8 @@
int Diagram::yGrid = 10;
int Diagram::xKeyGrid = 10;
int Diagram::yKeyGrid = 10;
+int Diagram::xKeyGridFine = 1;
+int Diagram::yKeyGridFine = 1;
const qreal Diagram::margin = 5.0;
// static variable to keep track of present background color of the diagram.
@@ -285,7 +287,8 @@
QSettings settings;
int xKeyGrid = settings.value("DiagramEditor_xKeyGrid_sb", Diagram::xKeyGrid).toInt();
int yKeyGrid = settings.value("DiagramEditor_yKeyGrid_sb", Diagram::yKeyGrid).toInt();
-
+ int xKeyGridFine = settings.value("DiagramEditor_xKeyGridFine_sb", Diagram::xKeyGridFine).toInt();
+ int yKeyGridFine = settings.value("DiagramEditor_yKeyGridFine_sb", Diagram::yKeyGridFine).toInt();
event->setAccepted(false);
if (m_event_interface) {
@@ -342,7 +345,46 @@
return;
}
}
- else if(event->modifiers() == Qt::ControlModifier)
+ else if(event->modifiers() == Qt::AltModifier)
+
+ {
+ switch(event->key())
+ {
+ case Qt::Key_Left:
+ for (Element *item : dc.m_elements)
+ {
+ left_position = item->sceneBoundingRect().x();
+ if(left_position <= 5)
+ return;
+ }
+ movement = QPointF(-xKeyGridFine, 0.0);
+ break;
+ case Qt::Key_Right:
+ movement = QPointF(+xKeyGridFine, 0.0);
+ break;
+ case Qt::Key_Up:
+ for(Element *item : dc.m_elements)
+ {
+ top_position = item->sceneBoundingRect().y();
+ if(top_position <= 5)
+ return;
+ }
+ movement = QPointF(0.0, -yKeyGridFine);
+ break;
+ case Qt::Key_Down:
+ movement = QPointF(0.0, +yKeyGridFine);
+ break;
+ }
+
+ if (!movement.isNull() && !focusItem())
+ {
+ m_elements_mover.beginMovement(this);
+ m_elements_mover.continueMovement(movement);
+ event->accept();
+ return;
+ }
+ }
+ else if(event->modifiers() == Qt::ControlModifier)
{
//Adjust the alignment of a texts group
if(selectedItems().size() == 1 && selectedItems().first()->type() == QGraphicsItemGroup::Type)
Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h 2019-02-21 21:57:35 UTC (rev 5748)
+++ trunk/sources/diagram.h 2019-02-24 15:44:47 UTC (rev 5749)
@@ -80,6 +80,10 @@
static int xKeyGrid;
/// Key grid y step size
static int yKeyGrid;
+ /// Key grid fine x step size
+ static int xKeyGridFine;
+ /// Key grid fine y step size
+ static int yKeyGridFine;
/// margin around the diagram
static const qreal margin;
/// background color of diagram
Modified: trunk/sources/ui/configpage/generalconfigurationpage.cpp
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.cpp 2019-02-21 21:57:35 UTC (rev 5748)
+++ trunk/sources/ui/configpage/generalconfigurationpage.cpp 2019-02-24 15:44:47 UTC (rev 5749)
@@ -39,7 +39,9 @@
ui->DiagramEditor_yGrid_sb->setValue(settings.value("DiagramEditor_yGrid_sb", 10).toInt());
ui->DiagramEditor_xKeyGrid_sb->setValue(settings.value("DiagramEditor_xKeyGrid_sb", 10).toInt());
ui->DiagramEditor_yKeyGrid_sb->setValue(settings.value("DiagramEditor_yKeyGrid_sb", 10).toInt());
- ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
+ ui->DiagramEditor_xKeyGridFine_sb->setValue(settings.value("DiagramEditor_xKeyGridFine_sb", 1).toInt());
+ ui->DiagramEditor_yKeyGridFine_sb->setValue(settings.value("DiagramEditor_yKeyGridFine_sb", 1).toInt());
+ ui->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
if(tabbed)
ui->m_use_tab_mode_rb->setChecked(true);
@@ -145,7 +147,9 @@
settings.setValue("DiagramEditor_yGrid_sb", ui->DiagramEditor_yGrid_sb->value());
settings.setValue("DiagramEditor_xKeyGrid_sb", ui->DiagramEditor_xKeyGrid_sb->value());
settings.setValue("DiagramEditor_yKeyGrid_sb", ui->DiagramEditor_yKeyGrid_sb->value());
-
+ settings.setValue("DiagramEditor_xKeyGridFine_sb", ui->DiagramEditor_xKeyGridFine_sb->value());
+ settings.setValue("DiagramEditor_yKeyGridFine_sb", ui->DiagramEditor_yKeyGridFine_sb->value());
+
QString path = settings.value("elements-collections/common-collection-path").toString();
if (ui->m_common_elmt_path_cb->currentIndex() == 1)
{
Modified: trunk/sources/ui/configpage/generalconfigurationpage.ui
===================================================================
--- trunk/sources/ui/configpage/generalconfigurationpage.ui 2019-02-21 21:57:35 UTC (rev 5748)
+++ trunk/sources/ui/configpage/generalconfigurationpage.ui 2019-02-24 15:44:47 UTC (rev 5749)
@@ -464,15 +464,15 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="Grid">
+ <widget class="QWidget" name="GrilleClavier">
<attribute name="title">
- <string>Grille</string>
+ <string>Grille + Clavier</string>
</attribute>
<widget class="QLabel" name="Label_Diagram_xGrid">
<property name="geometry">
<rect>
- <x>20</x>
- <y>10</y>
+ <x>90</x>
+ <y>50</y>
<width>191</width>
<height>30</height>
</rect>
@@ -484,8 +484,8 @@
<widget class="QLabel" name="Label_Diagram_yGrid">
<property name="geometry">
<rect>
- <x>20</x>
- <y>50</y>
+ <x>90</x>
+ <y>90</y>
<width>191</width>
<height>30</height>
</rect>
@@ -497,8 +497,8 @@
<widget class="QSpinBox" name="DiagramEditor_xGrid_sb">
<property name="geometry">
<rect>
- <x>350</x>
- <y>10</y>
+ <x>540</x>
+ <y>50</y>
<width>55</width>
<height>30</height>
</rect>
@@ -519,8 +519,8 @@
<widget class="QSpinBox" name="DiagramEditor_yGrid_sb">
<property name="geometry">
<rect>
- <x>350</x>
- <y>50</y>
+ <x>540</x>
+ <y>90</y>
<width>55</width>
<height>30</height>
</rect>
@@ -538,21 +538,21 @@
<widget class="QLabel" name="Label_Diagram_Key_xGrid">
<property name="geometry">
<rect>
- <x>20</x>
- <y>180</y>
- <width>321</width>
+ <x>90</x>
+ <y>280</y>
+ <width>431</width>
<height>30</height>
</rect>
</property>
<property name="text">
- <string>DiagramEditor Key Left/Right xGrid</string>
+ <string>DiagramEditor (touche : gauche / droite) xGrid</string>
</property>
</widget>
<widget class="QSpinBox" name="DiagramEditor_xKeyGrid_sb">
<property name="geometry">
<rect>
- <x>350</x>
- <y>180</y>
+ <x>540</x>
+ <y>280</y>
<width>55</width>
<height>30</height>
</rect>
@@ -573,21 +573,21 @@
<widget class="QLabel" name="Label_Diagram_Key_yGrid">
<property name="geometry">
<rect>
- <x>20</x>
- <y>220</y>
- <width>321</width>
+ <x>90</x>
+ <y>320</y>
+ <width>431</width>
<height>30</height>
</rect>
</property>
<property name="text">
- <string>DiagramEditor Key Up/Down yGrid</string>
+ <string>DiagramEditor (touche : haut / bas) yGrid</string>
</property>
</widget>
<widget class="QSpinBox" name="DiagramEditor_yKeyGrid_sb">
<property name="geometry">
<rect>
- <x>350</x>
- <y>220</y>
+ <x>540</x>
+ <y>320</y>
<width>55</width>
<height>30</height>
</rect>
@@ -605,6 +605,128 @@
<number>10</number>
</property>
</widget>
+ <widget class="QLabel" name="Label_Grid">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>121</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Grille : 1 - 30</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="Label_Keys">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>240</y>
+ <width>281</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Déplacement au clavier : 1 - 30</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="Label_Keys_ALT">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>360</y>
+ <width>421</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Déplacement au clavier avec la touche ALT : 1 - 9</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="Label_Diagram_Key_xGrid_ALT">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>400</y>
+ <width>431</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>DiagramEditor (touche : gauche / droite ) xGrid</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="Label_Diagram_Key_yGrid_ALT">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>440</y>
+ <width>431</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>DiagramEditor (touche : haut / bas) yGrid</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="DiagramEditor_xKeyGridFine_sb">
+ <property name="geometry">
+ <rect>
+ <x>540</x>
+ <y>400</y>
+ <width>55</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="DiagramEditor_yKeyGridFine_sb">
+ <property name="geometry">
+ <rect>
+ <x>540</x>
+ <y>440</y>
+ <width>55</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="Label_Grid_Tip">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>130</y>
+ <width>481</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>La Grille doite etre active pour pouvoir voir les modifications.</string>
+ </property>
+ </widget>
</widget>
</widget>
</item>