mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Add Erik path : User can Diagram grid layout and keys
Left,Right,Up,Down stepsize git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5744 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -38,8 +38,10 @@
|
|||||||
#include "undocommand/addelementtextcommand.h"
|
#include "undocommand/addelementtextcommand.h"
|
||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
|
|
||||||
const int Diagram::xGrid = 10;
|
int Diagram::xGrid = 10;
|
||||||
const int Diagram::yGrid = 10;
|
int Diagram::yGrid = 10;
|
||||||
|
int Diagram::xKeyGrid = 10;
|
||||||
|
int Diagram::yKeyGrid = 10;
|
||||||
const qreal Diagram::margin = 5.0;
|
const qreal Diagram::margin = 5.0;
|
||||||
|
|
||||||
// static variable to keep track of present background color of the diagram.
|
// static variable to keep track of present background color of the diagram.
|
||||||
@@ -150,6 +152,8 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
|||||||
|
|
||||||
//If user allow zoom out beyond of folio, we draw grid outside of border.
|
//If user allow zoom out beyond of folio, we draw grid outside of border.
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
int xGrid = settings.value("DiagramEditor_xGrid_sb", Diagram::xGrid).toInt();
|
||||||
|
int yGrid = settings.value("DiagramEditor_yGrid_sb", Diagram::yGrid).toInt();
|
||||||
QRectF rect = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ?
|
QRectF rect = settings.value("diagrameditor/zoom-out-beyond-of-folio", false).toBool() ?
|
||||||
r :
|
r :
|
||||||
border_and_titleblock.insideBorderRect().intersected(r);
|
border_and_titleblock.insideBorderRect().intersected(r);
|
||||||
@@ -278,6 +282,10 @@ void Diagram::wheelEvent(QGraphicsSceneWheelEvent *event)
|
|||||||
*/
|
*/
|
||||||
void Diagram::keyPressEvent(QKeyEvent *event)
|
void Diagram::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
|
int xKeyGrid = settings.value("DiagramEditor_xKeyGrid_sb", Diagram::xKeyGrid).toInt();
|
||||||
|
int yKeyGrid = settings.value("DiagramEditor_yKeyGrid_sb", Diagram::yKeyGrid).toInt();
|
||||||
|
|
||||||
event->setAccepted(false);
|
event->setAccepted(false);
|
||||||
|
|
||||||
if (m_event_interface) {
|
if (m_event_interface) {
|
||||||
@@ -295,7 +303,7 @@ void Diagram::keyPressEvent(QKeyEvent *event)
|
|||||||
DiagramContent dc(this);
|
DiagramContent dc(this);
|
||||||
if (!dc.items(DiagramContent::All).isEmpty())
|
if (!dc.items(DiagramContent::All).isEmpty())
|
||||||
{
|
{
|
||||||
//Move item with the keyborb arrow
|
//Move item with the keyboard arrow
|
||||||
if(event->modifiers() == Qt::NoModifier)
|
if(event->modifiers() == Qt::NoModifier)
|
||||||
{
|
{
|
||||||
switch(event->key())
|
switch(event->key())
|
||||||
@@ -307,10 +315,10 @@ void Diagram::keyPressEvent(QKeyEvent *event)
|
|||||||
if(left_position <= 5)
|
if(left_position <= 5)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
movement = QPointF(-xGrid, 0.0);
|
movement = QPointF(-xKeyGrid, 0.0);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
movement = QPointF(+xGrid, 0.0);
|
movement = QPointF(+xKeyGrid, 0.0);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Up:
|
case Qt::Key_Up:
|
||||||
for(Element *item : dc.m_elements)
|
for(Element *item : dc.m_elements)
|
||||||
@@ -319,10 +327,10 @@ void Diagram::keyPressEvent(QKeyEvent *event)
|
|||||||
if(top_position <= 5)
|
if(top_position <= 5)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
movement = QPointF(0.0, -yGrid);
|
movement = QPointF(0.0, -yKeyGrid);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Down:
|
case Qt::Key_Down:
|
||||||
movement = QPointF(0.0, +yGrid);
|
movement = QPointF(0.0, +yKeyGrid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,12 +73,17 @@ class Diagram : public QGraphicsScene
|
|||||||
/// Diagram dimensions and title block
|
/// Diagram dimensions and title block
|
||||||
BorderTitleBlock border_and_titleblock;
|
BorderTitleBlock border_and_titleblock;
|
||||||
/// abscissa grid step size
|
/// abscissa grid step size
|
||||||
static const int xGrid;
|
static int xGrid;
|
||||||
/// ordinate grid step size
|
/// ordinate grid step size
|
||||||
static const int yGrid;
|
static int yGrid;
|
||||||
|
/// Key grid x step size
|
||||||
|
static int xKeyGrid;
|
||||||
|
/// Key grid y step size
|
||||||
|
static int yKeyGrid;
|
||||||
/// margin around the diagram
|
/// margin around the diagram
|
||||||
static const qreal margin;
|
static const qreal margin;
|
||||||
/// background color of diagram
|
/// background color of diagram
|
||||||
|
|
||||||
static QColor background_color;
|
static QColor background_color;
|
||||||
/// Hash containing max values for folio sequential autonums in this diagram
|
/// Hash containing max values for folio sequential autonums in this diagram
|
||||||
QHash <QString, QStringList> m_elmt_unitfolio_max;
|
QHash <QString, QStringList> m_elmt_unitfolio_max;
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
|||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
|
ui->DiagramEditor_xGrid_sb->setValue(settings.value("DiagramEditor_xGrid_sb", 10).toInt());
|
||||||
|
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->m_use_system_color_cb->setChecked(settings.value("usesystemcolors", "true").toBool());
|
||||||
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
bool tabbed = settings.value("diagrameditor/viewmode", "tabbed") == "tabbed";
|
||||||
if(tabbed)
|
if(tabbed)
|
||||||
@@ -137,6 +141,10 @@ void GeneralConfigurationPage::applyConf()
|
|||||||
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
|
||||||
settings.setValue("dynamic_rotation", ui->m_rotation->value());
|
settings.setValue("dynamic_rotation", ui->m_rotation->value());
|
||||||
settings.setValue("dynamic_with", ui->m_text_width_sb->value());
|
settings.setValue("dynamic_with", ui->m_text_width_sb->value());
|
||||||
|
settings.setValue("DiagramEditor_xGrid_sb", ui->DiagramEditor_xGrid_sb->value());
|
||||||
|
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());
|
||||||
|
|
||||||
QString path = settings.value("elements-collections/common-collection-path").toString();
|
QString path = settings.value("elements-collections/common-collection-path").toString();
|
||||||
if (ui->m_common_elmt_path_cb->currentIndex() == 1)
|
if (ui->m_common_elmt_path_cb->currentIndex() == 1)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1958</width>
|
<width>998</width>
|
||||||
<height>1438</height>
|
<height>518</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_3">
|
<widget class="QWidget" name="tab_3">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -464,6 +464,148 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="Grid">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Grille</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QLabel" name="Label_Diagram_xGrid">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>191</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DiagramEditor xGrid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="Label_Diagram_yGrid">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>191</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DiagramEditor yGrid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="DiagramEditor_xGrid_sb">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>55</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="DiagramEditor_yGrid_sb">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>55</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="Label_Diagram_Key_xGrid">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>321</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DiagramEditor Key Left/Right xGrid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="DiagramEditor_xKeyGrid_sb">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>55</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="Label_Diagram_Key_yGrid">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>321</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DiagramEditor Key Up/Down yGrid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="DiagramEditor_yKeyGrid_sb">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>55</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user