Revamp the action white/grey background

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4029 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-06-25 18:23:47 +00:00
parent 92d9a01da3
commit c2b97439a9
4 changed files with 12 additions and 48 deletions

View File

@@ -349,16 +349,6 @@ 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,7 +135,6 @@ 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

@@ -189,8 +189,8 @@ void QETDiagramEditor::setUpSelectionPropertiesEditor()
* @brief QETDiagramEditor::setUpActions * @brief QETDiagramEditor::setUpActions
* Set up all Qaction * Set up all Qaction
*/ */
void QETDiagramEditor::setUpActions() { void QETDiagramEditor::setUpActions()
// icones et labels {
export_diagram = new QAction(QET::Icons::DocumentExport, tr("E&xporter"), this); export_diagram = new QAction(QET::Icons::DocumentExport, tr("E&xporter"), this);
print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), this); print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), this);
quit_editor = new QAction(QET::Icons::ApplicationExit, tr("&Quitter"), this); quit_editor = new QAction(QET::Icons::ApplicationExit, tr("&Quitter"), this);
@@ -207,15 +207,16 @@ void QETDiagramEditor::setUpActions() {
m_auto_conductor = new QAction (QET::Icons::Autoconnect, tr("Création automatique de conducteur(s)","Tool tip of auto conductor"), this); m_auto_conductor = new QAction (QET::Icons::Autoconnect, tr("Création automatique de conducteur(s)","Tool tip of auto conductor"), this);
m_auto_conductor -> setStatusTip (tr("Utiliser la création automatique de conducteur(s) quand cela est possible", "Status tip of auto conductor")); m_auto_conductor -> setStatusTip (tr("Utiliser la création automatique de conducteur(s) quand cela est possible", "Status tip of auto conductor"));
m_auto_conductor -> setCheckable (true); m_auto_conductor -> setCheckable (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 = 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 -> 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 -> setCheckable (true);
m_grey_background -> setDisabled (true); connect (m_grey_background, &QAction::triggered, [this](bool checked) {
connect(m_grey_background, SIGNAL(triggered(bool)), this, SLOT(slot_whgyBackground(bool))); Diagram::background_color = checked ? Qt::darkGray : Qt::white;
connect(m_grey_background, SIGNAL(triggered(bool)), this, SLOT(slot_refreshBg())); if (this->currentDiagram() && this->currentDiagram()->diagram())
this->currentDiagram()->diagram()->update();
});
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);
@@ -446,22 +447,6 @@ 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
*/ */
@@ -584,6 +569,8 @@ void QETDiagramEditor::setUpMenu() {
menu_affichage -> addAction(mode_selection); menu_affichage -> addAction(mode_selection);
menu_affichage -> addAction(mode_visualise); menu_affichage -> addAction(mode_visualise);
menu_affichage -> addSeparator(); menu_affichage -> addSeparator();
menu_affichage -> addAction(m_grey_background);
menu_affichage -> addSeparator();
menu_affichage -> addActions(m_zoom_actions_group.actions()); menu_affichage -> addActions(m_zoom_actions_group.actions());
// menu Fenetres // menu Fenetres
@@ -1093,13 +1080,6 @@ 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
*/ */
@@ -1228,6 +1208,7 @@ void QETDiagramEditor::slot_updateActions()
m_select_actions_group. setEnabled(opened_diagram); m_select_actions_group. setEnabled(opened_diagram);
m_add_item_actions_group. setEnabled(editable_project); m_add_item_actions_group. setEnabled(editable_project);
m_row_column_actions_group.setEnabled(editable_project); m_row_column_actions_group.setEnabled(editable_project);
m_grey_background->setEnabled(opened_diagram);
slot_updateUndoStack(); slot_updateUndoStack();
@@ -1336,17 +1317,14 @@ void QETDiagramEditor::slot_updateComplexActions() {
* @brief QETDiagramEditor::slot_updateModeActions * @brief QETDiagramEditor::slot_updateModeActions
* Manage action who need an opened diagram or project to be updated * Manage action who need an opened diagram or project to be updated
*/ */
void QETDiagramEditor::slot_updateModeActions() { void QETDiagramEditor::slot_updateModeActions()
{
DiagramView *dv = currentDiagram(); DiagramView *dv = currentDiagram();
if (!dv) if (!dv)
{
grp_visu_sel -> setEnabled(false); grp_visu_sel -> setEnabled(false);
m_grey_background -> setDisabled(true);
}
else else
{ {
m_grey_background -> setEnabled(true);
switch((int)(dv -> dragMode())) switch((int)(dv -> dragMode()))
{ {
case QGraphicsView::NoDrag: case QGraphicsView::NoDrag:
@@ -1363,7 +1341,6 @@ void QETDiagramEditor::slot_updateModeActions() {
} }
} }
if (ProjectView *pv = currentProject()) if (ProjectView *pv = currentProject())
{ {
m_auto_conductor -> setEnabled (true); m_auto_conductor -> setEnabled (true);

View File

@@ -118,8 +118,6 @@ 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();