~rexut/qelectrotech/trunk

« back to all changes in this revision

Viewing changes to sources/editor/qetelementeditor.cpp

  • Committer: blacksun
  • Date: 2018-06-20 18:35:06 UTC
  • Revision ID: svn-v4:bfdf4180-ca20-0410-9c96-a3a8aa849046:trunk:5402
Forget qet.cpp and qet.h from previous comit.
Add new function for create QAction used for edit the depth of items.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "recentfiles.h"
28
28
#include "qeticons.h"
29
29
#include "qetmessagebox.h"
 
30
#include "editorcommands.h"
30
31
 
31
32
// editeurs de primitives
32
33
#include "arceditor.h"
224
225
        connect(edit_author,     SIGNAL(triggered()), m_elmt_scene, SLOT(slot_editAuthorInformations()));
225
226
        connect(m_edit_properties, SIGNAL(triggered()), m_elmt_scene, SLOT(slot_editProperties()));
226
227
 
227
 
 
228
 
        /*
229
 
         * Action related to change depth of primitive
230
 
         */
231
 
        m_depth_ag = new QActionGroup(this);
232
 
 
233
 
        QAction *edit_forward  = new QAction(QET::Icons::BringForward, tr("Amener au premier plan"), m_depth_ag);
234
 
        QAction *edit_raise    = new QAction(QET::Icons::Raise,        tr("Rapprocher"),             m_depth_ag);
235
 
        QAction *edit_lower    = new QAction(QET::Icons::Lower,        tr("Éloigner"),            m_depth_ag);
236
 
        QAction *edit_backward = new QAction(QET::Icons::SendBackward, tr("Envoyer au fond"),        m_depth_ag);
237
 
 
238
 
        edit_raise    -> setShortcut(QKeySequence(tr("Ctrl+Shift+Up")));
239
 
        edit_lower    -> setShortcut(QKeySequence(tr("Ctrl+Shift+Down")));
240
 
        edit_backward -> setShortcut(QKeySequence(tr("Ctrl+Shift+End")));
241
 
        edit_forward  -> setShortcut(QKeySequence(tr("Ctrl+Shift+Home")));
242
 
 
243
 
        connect(edit_forward,  SIGNAL(triggered()), m_elmt_scene, SLOT(slot_bringForward() ));
244
 
        connect(edit_raise,    SIGNAL(triggered()), m_elmt_scene, SLOT(slot_raise()        ));
245
 
        connect(edit_lower,    SIGNAL(triggered()), m_elmt_scene, SLOT(slot_lower()        ));
246
 
        connect(edit_backward, SIGNAL(triggered()), m_elmt_scene, SLOT(slot_sendBackward() ));
247
 
 
 
228
                //Action related to change depth of primitive
 
229
        m_depth_action_group = QET::depthActionGroup(this);
 
230
        
 
231
        connect(m_depth_action_group, &QActionGroup::triggered, [this](QAction *action) {
 
232
                this->elementScene()->undoStack().push(new ChangeZValueCommand(this->elementScene(), action->data().value<QET::DepthOption>()));
 
233
                emit(this->elementScene()->partsZValueChanged());
 
234
        });
 
235
        
248
236
        depth_toolbar = addToolBar(tr("Profondeur", "toolbar title"));
249
237
        depth_toolbar -> setObjectName("depth_toolbar");
250
 
        depth_toolbar -> addActions(m_depth_ag -> actions());
 
238
        depth_toolbar -> addActions(m_depth_action_group -> actions());
251
239
        addToolBar(Qt::TopToolBarArea, depth_toolbar);
252
240
 
253
241
 
402
390
        edit_menu -> addAction(edit_author);
403
391
        edit_menu -> addAction(m_edit_properties);
404
392
        edit_menu -> addSeparator();
405
 
        edit_menu -> addActions(m_depth_ag -> actions());
 
393
        edit_menu -> addActions(m_depth_action_group -> actions());
406
394
 
407
395
        display_menu -> addActions(m_zoom_ag -> actions());
408
396
        
432
420
                menu.addAction(paste_in_area);
433
421
                menu.addMenu(paste_from_menu);
434
422
                menu.addSeparator();
435
 
                menu.addActions(m_depth_ag -> actions());
 
423
                menu.addActions(m_depth_action_group -> actions());
436
424
                
437
425
                        //Remove from the context menu the actions which are disabled.
438
426
                const QList<QAction *>actions = menu.actions();
467
455
        cut             -> setEnabled(selected_items);
468
456
        copy            -> setEnabled(selected_items);
469
457
        edit_delete     -> setEnabled(selected_items);
470
 
        foreach (QAction *action, m_depth_ag -> actions())
 
458
        foreach (QAction *action, m_depth_action_group -> actions())
471
459
                action->setEnabled(selected_items);
472
460
        
473
461
        // actions dependant du contenu du presse-papiers