mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
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:
@@ -349,16 +349,6 @@ 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,7 +135,6 @@ class DiagramView : public QGraphicsView {
|
||||
void rotateTexts();
|
||||
void setVisualisationMode();
|
||||
void setSelectionMode();
|
||||
void refreshBg();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void zoomInSlowly();
|
||||
|
||||
@@ -189,8 +189,8 @@ void QETDiagramEditor::setUpSelectionPropertiesEditor()
|
||||
* @brief QETDiagramEditor::setUpActions
|
||||
* Set up all Qaction
|
||||
*/
|
||||
void QETDiagramEditor::setUpActions() {
|
||||
// icones et labels
|
||||
void QETDiagramEditor::setUpActions()
|
||||
{
|
||||
export_diagram = new QAction(QET::Icons::DocumentExport, tr("E&xporter"), this);
|
||||
print = new QAction(QET::Icons::DocumentPrint, tr("Imprimer"), 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 -> 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 -> 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()));
|
||||
connect (m_grey_background, &QAction::triggered, [this](bool checked) {
|
||||
Diagram::background_color = checked ? Qt::darkGray : Qt::white;
|
||||
if (this->currentDiagram() && this->currentDiagram()->diagram())
|
||||
this->currentDiagram()->diagram()->update();
|
||||
});
|
||||
|
||||
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);
|
||||
@@ -446,22 +447,6 @@ 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
|
||||
*/
|
||||
@@ -584,6 +569,8 @@ void QETDiagramEditor::setUpMenu() {
|
||||
menu_affichage -> addAction(mode_selection);
|
||||
menu_affichage -> addAction(mode_visualise);
|
||||
menu_affichage -> addSeparator();
|
||||
menu_affichage -> addAction(m_grey_background);
|
||||
menu_affichage -> addSeparator();
|
||||
menu_affichage -> addActions(m_zoom_actions_group.actions());
|
||||
|
||||
// menu Fenetres
|
||||
@@ -1093,13 +1080,6 @@ 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
|
||||
*/
|
||||
@@ -1228,6 +1208,7 @@ void QETDiagramEditor::slot_updateActions()
|
||||
m_select_actions_group. setEnabled(opened_diagram);
|
||||
m_add_item_actions_group. setEnabled(editable_project);
|
||||
m_row_column_actions_group.setEnabled(editable_project);
|
||||
m_grey_background->setEnabled(opened_diagram);
|
||||
|
||||
|
||||
slot_updateUndoStack();
|
||||
@@ -1336,17 +1317,14 @@ void QETDiagramEditor::slot_updateComplexActions() {
|
||||
* @brief QETDiagramEditor::slot_updateModeActions
|
||||
* Manage action who need an opened diagram or project to be updated
|
||||
*/
|
||||
void QETDiagramEditor::slot_updateModeActions() {
|
||||
void QETDiagramEditor::slot_updateModeActions()
|
||||
{
|
||||
DiagramView *dv = currentDiagram();
|
||||
|
||||
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:
|
||||
@@ -1363,7 +1341,6 @@ void QETDiagramEditor::slot_updateModeActions() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ProjectView *pv = currentProject())
|
||||
{
|
||||
m_auto_conductor -> setEnabled (true);
|
||||
|
||||
@@ -118,8 +118,6 @@ 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();
|
||||
|
||||
Reference in New Issue
Block a user