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

View File

@@ -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
*/
@@ -469,6 +492,8 @@ void QETDiagramEditor::setUpToolBar() {
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);
diagram_bar -> addAction (infos_diagram);
@@ -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,10 +1342,12 @@ void QETDiagramEditor::slot_updateModeActions() {
if (!dv)
{
grp_visu_sel -> setEnabled(false);
m_grey_background -> setDisabled(true);
}
else
{
switch((int)(dv -> dragMode()))
m_grey_background -> setEnabled(true);
switch((int)(dv -> dragMode()))
{
case QGraphicsView::NoDrag:
grp_visu_sel -> setEnabled(false);