mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Add a new button in the display tool bar to switch the background color in white or grey on the fly.
The check box for this functionality in the DiagramProporties window was deleted. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4022 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
BIN
ico/22x22/diagram_bg.png
Normal file
BIN
ico/22x22/diagram_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 359 B |
@@ -244,5 +244,6 @@
|
||||
<file>ico/16x16/folio-new.png</file>
|
||||
<file>ico/48x48/document-print-frame.png</file>
|
||||
<file>ico/22x22/Actions-player-time-icon.png</file>
|
||||
<file>ico/22x22/diagram_bg.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -349,6 +349,16 @@ void DiagramView::setSelectionMode() {
|
||||
emit(modeChanged());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::refreshBg
|
||||
* Workaround to refresh the background color
|
||||
*/
|
||||
void DiagramView::refreshBg() {
|
||||
scale(2, 2);
|
||||
scale(0.5, 0.5);
|
||||
adjustGridToZoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::zoomIn
|
||||
* Zoom in the current folio
|
||||
|
||||
@@ -135,6 +135,7 @@ class DiagramView : public QGraphicsView {
|
||||
void rotateTexts();
|
||||
void setVisualisationMode();
|
||||
void setSelectionMode();
|
||||
void refreshBg();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void zoomInSlowly();
|
||||
|
||||
@@ -210,6 +210,13 @@ void QETDiagramEditor::setUpActions() {
|
||||
m_auto_conductor -> setDisabled (true);
|
||||
connect(m_auto_conductor, SIGNAL(triggered(bool)), this, SLOT(slot_autoConductor(bool)));
|
||||
|
||||
m_grey_background = new QAction (QET::Icons::DiagramBg, tr("Couleur de fond blanc/gris","Tool tip of white/grey background button"), this);
|
||||
m_grey_background -> setStatusTip (tr("Affiche la couleur de fond du folio en blanc ou en gris", "Status tip of white/grey background button"));
|
||||
m_grey_background -> setCheckable (true);
|
||||
m_grey_background -> setDisabled (true);
|
||||
connect(m_grey_background, SIGNAL(triggered(bool)), this, SLOT(slot_whgyBackground(bool)));
|
||||
connect(m_grey_background, SIGNAL(triggered(bool)), this, SLOT(slot_refreshBg()));
|
||||
|
||||
infos_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||
@@ -439,6 +446,22 @@ void QETDiagramEditor::setUpActions() {
|
||||
connect(infos_diagram, SIGNAL(triggered()), this, SLOT(editCurrentDiagramProperties()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::slot_whgyBackground
|
||||
* @param checked
|
||||
*/
|
||||
|
||||
void QETDiagramEditor::slot_whgyBackground(bool checked) {
|
||||
if (checked)
|
||||
{
|
||||
Diagram::background_color = Qt::darkGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
Diagram::background_color = Qt::white;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QETDiagramEditor::setUpToolBar
|
||||
*/
|
||||
@@ -468,6 +491,8 @@ void QETDiagramEditor::setUpToolBar() {
|
||||
// Modes selection / visualisation et zoom
|
||||
view_bar -> addAction(mode_selection);
|
||||
view_bar -> addAction(mode_visualise);
|
||||
view_bar -> addSeparator();
|
||||
view_bar -> addAction (m_grey_background);
|
||||
view_bar -> addSeparator();
|
||||
view_bar -> addActions(m_zoom_action_toolBar);
|
||||
|
||||
@@ -1068,6 +1093,13 @@ void QETDiagramEditor::slot_paste() {
|
||||
if(currentDiagram()) currentDiagram() -> paste();
|
||||
}
|
||||
|
||||
/**
|
||||
Do action "refresh background" on the current diagram
|
||||
*/
|
||||
void QETDiagramEditor::slot_refreshBg() {
|
||||
if(currentDiagram()) currentDiagram() -> refreshBg();
|
||||
}
|
||||
|
||||
/**
|
||||
Effectue l'action "zoom avant" sur le diagram en cours
|
||||
*/
|
||||
@@ -1310,9 +1342,11 @@ void QETDiagramEditor::slot_updateModeActions() {
|
||||
if (!dv)
|
||||
{
|
||||
grp_visu_sel -> setEnabled(false);
|
||||
m_grey_background -> setDisabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_grey_background -> setEnabled(true);
|
||||
switch((int)(dv -> dragMode()))
|
||||
{
|
||||
case QGraphicsView::NoDrag:
|
||||
|
||||
@@ -118,6 +118,8 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
void editSelectionProperties();
|
||||
void slot_resetConductors();
|
||||
void slot_autoConductor(bool ac);
|
||||
void slot_whgyBackground(bool checked);
|
||||
void slot_refreshBg();
|
||||
void slot_addText();
|
||||
void slot_addImage();
|
||||
void slot_addLine();
|
||||
@@ -186,6 +188,7 @@ class QETDiagramEditor : public QETMainWindow {
|
||||
QAction *conductor_reset; ///< Reset paths of selected conductors
|
||||
QAction *m_auto_conductor; ///< Enable/Disable the use of auto conductor
|
||||
QAction *conductor_default; ///< Show a dialog to edit default conductor properties
|
||||
QAction *m_grey_background; ///< Switch the background color in white or grey
|
||||
QAction *infos_diagram; ///< Show a dialog to edit diagram properties
|
||||
QAction *prj_edit_prop; ///< Edit the properties of the current project.
|
||||
QAction *prj_add_diagram; ///< Add a diagram to the current project.
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace QET {
|
||||
QIcon DefaultConductor;
|
||||
QIcon DiagramAdd;
|
||||
QIcon Diagram;
|
||||
QIcon DiagramBg;
|
||||
QIcon DiagramDelete;
|
||||
QIcon DialogCancel;
|
||||
QIcon DialogInformation;
|
||||
@@ -219,6 +220,7 @@ void QET::Icons::initIcons() {
|
||||
DefaultConductor .addFile(":/ico/22x22/conductor3.png");
|
||||
DiagramAdd .addFile(":/ico/22x22/diagram_add.png");
|
||||
Diagram .addFile(":/ico/diagram.png");
|
||||
DiagramBg .addFile(":/ico/22x22/diagram_bg.png");
|
||||
DiagramDelete .addFile(":/ico/22x22/diagram_del.png");
|
||||
DialogCancel .addFile(":/ico/16x16/dialog-cancel.png");
|
||||
DialogCancel .addFile(":/ico/22x22/dialog-cancel.png");
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace QET {
|
||||
extern QIcon DefaultConductor;
|
||||
extern QIcon DiagramAdd;
|
||||
extern QIcon Diagram;
|
||||
extern QIcon DiagramBg;
|
||||
extern QIcon DiagramDelete;
|
||||
extern QIcon DialogCancel;
|
||||
extern QIcon DialogInformation;
|
||||
|
||||
@@ -55,7 +55,6 @@ void BorderPropertiesWidget::setProperties(const BorderProperties &bp) {
|
||||
ui -> m_rows_count_sp ->setValue (m_properties.rows_count);
|
||||
ui -> m_rows_height_sp ->setValue (m_properties.rows_height);
|
||||
ui -> m_display_rows_cb ->setChecked (m_properties.display_rows);
|
||||
ui -> m_grey_bg_cb ->setChecked (Diagram::background_color != Qt::white);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,14 +79,3 @@ const BorderProperties &BorderPropertiesWidget::properties () {
|
||||
void BorderPropertiesWidget::setReadOnly(const bool &ro) {
|
||||
ui->border_gb->setDisabled(ro);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BorderPropertiesWidget::on_m_grey_bg_cb_clicked
|
||||
* @param checked
|
||||
*/
|
||||
void BorderPropertiesWidget::on_m_grey_bg_cb_clicked(bool checked) {
|
||||
if (checked)
|
||||
Diagram::background_color = Qt::gray;
|
||||
else
|
||||
Diagram::background_color = Qt::white;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ class BorderPropertiesWidget : public QWidget
|
||||
void setReadOnly (const bool &ro);
|
||||
|
||||
private slots:
|
||||
void on_m_grey_bg_cb_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::BorderPropertiesWidget *ui;
|
||||
|
||||
Reference in New Issue
Block a user