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:
nuri
2015-06-21 11:00:08 +00:00
parent 8e977ef476
commit ab1d558f61
10 changed files with 56 additions and 17 deletions

BIN
ico/22x22/diagram_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

View File

@@ -244,5 +244,6 @@
<file>ico/16x16/folio-new.png</file> <file>ico/16x16/folio-new.png</file>
<file>ico/48x48/document-print-frame.png</file> <file>ico/48x48/document-print-frame.png</file>
<file>ico/22x22/Actions-player-time-icon.png</file> <file>ico/22x22/Actions-player-time-icon.png</file>
<file>ico/22x22/diagram_bg.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -349,6 +349,16 @@ void DiagramView::setSelectionMode() {
emit(modeChanged()); 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 * @brief DiagramView::zoomIn
* Zoom in the current folio * Zoom in the current folio

View File

@@ -135,6 +135,7 @@ class DiagramView : public QGraphicsView {
void rotateTexts(); void rotateTexts();
void setVisualisationMode(); void setVisualisationMode();
void setSelectionMode(); void setSelectionMode();
void refreshBg();
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
void zoomInSlowly(); void zoomInSlowly();

View File

@@ -210,6 +210,13 @@ void QETDiagramEditor::setUpActions() {
m_auto_conductor -> setDisabled (true); m_auto_conductor -> setDisabled (true);
connect(m_auto_conductor, SIGNAL(triggered(bool)), this, SLOT(slot_autoConductor(bool))); 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); 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_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); 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())); 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 * @brief QETDiagramEditor::setUpToolBar
*/ */
@@ -469,6 +492,8 @@ void QETDiagramEditor::setUpToolBar() {
view_bar -> addAction(mode_selection); view_bar -> addAction(mode_selection);
view_bar -> addAction(mode_visualise); view_bar -> addAction(mode_visualise);
view_bar -> addSeparator(); view_bar -> addSeparator();
view_bar -> addAction (m_grey_background);
view_bar -> addSeparator();
view_bar -> addActions(m_zoom_action_toolBar); view_bar -> addActions(m_zoom_action_toolBar);
diagram_bar -> addAction (infos_diagram); diagram_bar -> addAction (infos_diagram);
@@ -1068,6 +1093,13 @@ void QETDiagramEditor::slot_paste() {
if(currentDiagram()) currentDiagram() -> 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 Effectue l'action "zoom avant" sur le diagram en cours
*/ */
@@ -1310,10 +1342,12 @@ void QETDiagramEditor::slot_updateModeActions() {
if (!dv) if (!dv)
{ {
grp_visu_sel -> setEnabled(false); grp_visu_sel -> setEnabled(false);
m_grey_background -> setDisabled(true);
} }
else else
{ {
switch((int)(dv -> dragMode())) m_grey_background -> setEnabled(true);
switch((int)(dv -> dragMode()))
{ {
case QGraphicsView::NoDrag: case QGraphicsView::NoDrag:
grp_visu_sel -> setEnabled(false); grp_visu_sel -> setEnabled(false);

View File

@@ -118,6 +118,8 @@ class QETDiagramEditor : public QETMainWindow {
void editSelectionProperties(); void editSelectionProperties();
void slot_resetConductors(); void slot_resetConductors();
void slot_autoConductor(bool ac); void slot_autoConductor(bool ac);
void slot_whgyBackground(bool checked);
void slot_refreshBg();
void slot_addText(); void slot_addText();
void slot_addImage(); void slot_addImage();
void slot_addLine(); void slot_addLine();
@@ -186,7 +188,8 @@ class QETDiagramEditor : public QETMainWindow {
QAction *conductor_reset; ///< Reset paths of selected conductors QAction *conductor_reset; ///< Reset paths of selected conductors
QAction *m_auto_conductor; ///< Enable/Disable the use of auto conductor QAction *m_auto_conductor; ///< Enable/Disable the use of auto conductor
QAction *conductor_default; ///< Show a dialog to edit default conductor properties QAction *conductor_default; ///< Show a dialog to edit default conductor properties
QAction *infos_diagram; ///< Show a dialog to edit diagram 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_edit_prop; ///< Edit the properties of the current project.
QAction *prj_add_diagram; ///< Add a diagram to the current project. QAction *prj_add_diagram; ///< Add a diagram to the current project.
QAction *prj_del_diagram; ///< Delete a diagram from the current project QAction *prj_del_diagram; ///< Delete a diagram from the current project

View File

@@ -40,7 +40,8 @@ namespace QET {
QIcon DefaultConductor; QIcon DefaultConductor;
QIcon DiagramAdd; QIcon DiagramAdd;
QIcon Diagram; QIcon Diagram;
QIcon DiagramDelete; QIcon DiagramBg;
QIcon DiagramDelete;
QIcon DialogCancel; QIcon DialogCancel;
QIcon DialogInformation; QIcon DialogInformation;
QIcon DialogOk; QIcon DialogOk;
@@ -219,7 +220,8 @@ void QET::Icons::initIcons() {
DefaultConductor .addFile(":/ico/22x22/conductor3.png"); DefaultConductor .addFile(":/ico/22x22/conductor3.png");
DiagramAdd .addFile(":/ico/22x22/diagram_add.png"); DiagramAdd .addFile(":/ico/22x22/diagram_add.png");
Diagram .addFile(":/ico/diagram.png"); Diagram .addFile(":/ico/diagram.png");
DiagramDelete .addFile(":/ico/22x22/diagram_del.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/16x16/dialog-cancel.png");
DialogCancel .addFile(":/ico/22x22/dialog-cancel.png"); DialogCancel .addFile(":/ico/22x22/dialog-cancel.png");
DialogInformation .addFile(":/ico/22x22/dialog-information.png"); DialogInformation .addFile(":/ico/22x22/dialog-information.png");

View File

@@ -47,6 +47,7 @@ namespace QET {
extern QIcon DefaultConductor; extern QIcon DefaultConductor;
extern QIcon DiagramAdd; extern QIcon DiagramAdd;
extern QIcon Diagram; extern QIcon Diagram;
extern QIcon DiagramBg;
extern QIcon DiagramDelete; extern QIcon DiagramDelete;
extern QIcon DialogCancel; extern QIcon DialogCancel;
extern QIcon DialogInformation; extern QIcon DialogInformation;

View File

@@ -55,7 +55,6 @@ void BorderPropertiesWidget::setProperties(const BorderProperties &bp) {
ui -> m_rows_count_sp ->setValue (m_properties.rows_count); ui -> m_rows_count_sp ->setValue (m_properties.rows_count);
ui -> m_rows_height_sp ->setValue (m_properties.rows_height); ui -> m_rows_height_sp ->setValue (m_properties.rows_height);
ui -> m_display_rows_cb ->setChecked (m_properties.display_rows); 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) { void BorderPropertiesWidget::setReadOnly(const bool &ro) {
ui->border_gb->setDisabled(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;
}

View File

@@ -42,7 +42,6 @@ class BorderPropertiesWidget : public QWidget
void setReadOnly (const bool &ro); void setReadOnly (const bool &ro);
private slots: private slots:
void on_m_grey_bg_cb_clicked(bool checked);
private: private:
Ui::BorderPropertiesWidget *ui; Ui::BorderPropertiesWidget *ui;