Logo Search packages:      
Sourcecode: qelectrotech version File versions  Download package

void QETElementEditor::setupActions (  )  [private]

Met en place les actions

Definition at line 72 of file qetelementeditor.cpp.

References about_qet, about_qt, ce_scene, ce_view, configure, fullscreen, QETApp::instance(), new_element, parts, parts_toolbar, selectall, slot_new(), slot_open(), slot_openFile(), slot_reload(), slot_save(), slot_saveAs(), slot_saveAsFile(), slot_setNoDragToView(), slot_setNormalMode(), slot_setRubberBandToView(), slot_updateFullScreenAction(), slot_updateInformations(), slot_updateMenus(), slot_updatePartsList(), slot_updateTitle(), toggleFullScreen(), and zoom_in.

Referenced by QETElementEditor().

                                    {
      new_element   = new QAction(QET::Icons::DocumentNew,          tr("&Nouveau"),                                  this);
      open          = new QAction(QET::Icons::DocumentOpen,         tr("&Ouvrir"),                                   this);
      open_file     = new QAction(QET::Icons::DocumentOpen,         tr("&Ouvrir depuis un fichier"),                 this);
      save          = new QAction(QET::Icons::DocumentSave,         tr("&Enregistrer"),                              this);
      save_as       = new QAction(QET::Icons::DocumentSaveAs,       tr("Enregistrer sous"),                          this);
      save_as_file  = new QAction(QET::Icons::DocumentSaveAs,       tr("Enregistrer dans un fichier"),               this);
      reload        = new QAction(QET::Icons::ViewRefresh,          tr("Recharger"),                                 this);
      quit          = new QAction(QET::Icons::ApplicationExit,      tr("&Quitter"),                                  this);
      selectall     = new QAction(QET::Icons::EditSelectAll,        tr("Tout s\351lectionner"),                      this);
      deselectall   = new QAction(                                  tr("D\351s\351lectionner tout"),                 this);
      cut           = new QAction(QET::Icons::EditCut,              tr("Co&uper"),                                   this);
      copy          = new QAction(QET::Icons::EditCopy,             tr("Cop&ier"),                                   this);
      paste         = new QAction(QET::Icons::EditPaste,            tr("C&oller"),                                   this);
      paste_in_area = new QAction(QET::Icons::EditPaste,            tr("C&oller dans la zone..."),                   this);
      inv_select    = new QAction(                                  tr("Inverser la s\351lection"),                  this);
      edit_delete   = new QAction(QET::Icons::EditDelete,           tr("&Supprimer"),                                this);
      zoom_in       = new QAction(QET::Icons::ZoomIn,               tr("Zoom avant"),                                this);
      zoom_out      = new QAction(QET::Icons::ZoomOut,              tr("Zoom arri\350re"),                           this);
      zoom_fit      = new QAction(QET::Icons::ZoomFitBest,          tr("Zoom adapt\351"),                            this);
      zoom_reset    = new QAction(QET::Icons::ZoomOriginal,         tr("Pas de zoom"),                               this);
      edit_size_hs  = new QAction(QET::Icons::HotSpot,              tr("\311diter la taille et le point de saisie"), this);
      edit_names    = new QAction(QET::Icons::Names,                tr("\311diter les noms"),                        this);
      edit_ori      = new QAction(QET::Icons::Orientations,         tr("\311diter les orientations"),                this);
      edit_raise    = new QAction(QET::Icons::Raise,                tr("Rapprocher"),                                this);
      edit_lower    = new QAction(QET::Icons::Lower,                tr("\311loigner"),                               this);
      edit_backward = new QAction(QET::Icons::SendBackward,         tr("Envoyer au fond"),                           this);
      edit_forward  = new QAction(QET::Icons::BringForward,         tr("Amener au premier plan"),                    this);
      move          = new QAction(QET::Icons::PartSelect,           tr("D\351placer un objet"),                      this);
      add_line      = new QAction(QET::Icons::PartLine,             tr("Ajouter une ligne"),                         this);
      add_rectangle = new QAction(QET::Icons::PartRectangle,        tr("Ajouter un rectangle"),                      this);
      add_ellipse   = new QAction(QET::Icons::PartEllipse,          tr("Ajouter une ellipse"),                       this);
      add_circle    = new QAction(QET::Icons::PartCircle,           tr("Ajouter un cercle"),                         this);
      add_polygon   = new QAction(QET::Icons::PartPolygon,          tr("Ajouter un polygone"),                       this);
      add_text      = new QAction(QET::Icons::PartText,             tr("Ajouter du texte"),                          this);
      add_arc       = new QAction(QET::Icons::PartArc,              tr("Ajouter un arc de cercle"),                  this);
      add_terminal  = new QAction(QET::Icons::Terminal,             tr("Ajouter une borne"),                         this);
      add_textfield = new QAction(QET::Icons::PartTextField,        tr("Ajouter un champ de texte"),                 this);
      fullscreen    = new QAction(this);
      slot_updateFullScreenAction();
      configure     = new QAction(QET::Icons::Configure,            tr("&Configurer QElectroTech"),                  this);
      about_qet     = new QAction(QET::Icons::QETLogo,              tr("\300 &propos de QElectroTech"),              this);
      about_qt      = new QAction(QET::Icons::QtLogo,               tr("\300 propos de &Qt"),                        this);
      
      QString add_status_tip = tr("Maintenez la touche Shift enfonc\351e pour effectuer plusieurs ajouts d'affil\351e");
      add_line      -> setStatusTip(add_status_tip);
      add_rectangle -> setStatusTip(add_status_tip);
      add_ellipse   -> setStatusTip(add_status_tip);
      add_circle    -> setStatusTip(add_status_tip);
      add_text      -> setStatusTip(add_status_tip);
      add_arc       -> setStatusTip(add_status_tip);
      add_terminal  -> setStatusTip(add_status_tip);
      add_textfield -> setStatusTip(add_status_tip);
      add_polygon   -> setStatusTip(tr("Utilisez le bouton droit de la souris pour poser le dernier point du polygone"));
      configure     -> setStatusTip(tr("Permet de r\351gler diff\351rents param\350tres de QElectroTech", "status bar tip"));
      about_qet     -> setStatusTip(tr("Affiche des informations sur QElectroTech",                       "status bar tip"));
      about_qt      -> setStatusTip(tr("Affiche des informations sur la biblioth\350que Qt",              "status bar tip"));
      
      undo = ce_scene -> undoStack().createUndoAction(this, tr("Annuler"));
      redo = ce_scene -> undoStack().createRedoAction(this, tr("Refaire"));
      undo -> setIcon(QET::Icons::EditUndo);
      redo -> setIcon(QET::Icons::EditRedo);
      undo -> setShortcuts(QKeySequence::Undo);
      redo -> setShortcuts(QKeySequence::Redo);
      
      new_element       -> setShortcut(QKeySequence::New);
      open              -> setShortcut(QKeySequence::Open);
      open_file         -> setShortcut(tr("Ctrl+Shift+O"));
      save              -> setShortcut(QKeySequence::Save);
      save_as_file      -> setShortcut(tr("Ctrl+Shift+S"));
      reload            -> setShortcut(Qt::Key_F5);
      quit              -> setShortcut(QKeySequence(tr("Ctrl+Q")));
      selectall         -> setShortcut(QKeySequence::SelectAll);
      deselectall       -> setShortcut(QKeySequence(tr("Ctrl+Shift+A")));
      inv_select        -> setShortcut(QKeySequence(tr("Ctrl+I")));
      cut               -> setShortcut(QKeySequence::Cut);
      copy              -> setShortcut(QKeySequence::Copy);
      paste             -> setShortcut(QKeySequence::Paste);
      paste_in_area     -> setShortcut(tr("Ctrl+Shift+V"));
      edit_delete       -> setShortcut(QKeySequence(tr("Suppr")));
      
      zoom_in           -> setShortcut(QKeySequence::ZoomIn);
      zoom_out          -> setShortcut(QKeySequence::ZoomOut);
      zoom_fit          -> setShortcut(QKeySequence(tr("Ctrl+9")));
      zoom_reset        -> setShortcut(QKeySequence(tr("Ctrl+0")));
      
      fullscreen        -> setShortcut(QKeySequence(tr("Ctrl+Shift+F")));
      
      edit_names        -> setShortcut(QKeySequence(tr("Ctrl+E")));
      edit_size_hs      -> setShortcut(QKeySequence(tr("Ctrl+R")));
      edit_ori          -> setShortcut(QKeySequence(tr("Ctrl+T")));
      
      edit_raise        -> setShortcut(QKeySequence(tr("Ctrl+Shift+Up")));
      edit_lower        -> setShortcut(QKeySequence(tr("Ctrl+Shift+Down")));
      edit_backward     -> setShortcut(QKeySequence(tr("Ctrl+Shift+End")));
      edit_forward      -> setShortcut(QKeySequence(tr("Ctrl+Shift+Home")));
      
      QETApp *qet_app = QETApp::instance();
      
      connect(new_element,   SIGNAL(triggered()), this,     SLOT(slot_new()));
      connect(open,          SIGNAL(triggered()), this,     SLOT(slot_open()));
      connect(open_file,     SIGNAL(triggered()), this,     SLOT(slot_openFile()));
      connect(save,          SIGNAL(triggered()), this,     SLOT(slot_save()));
      connect(save_as,       SIGNAL(triggered()), this,     SLOT(slot_saveAs()));
      connect(save_as_file,  SIGNAL(triggered()), this,     SLOT(slot_saveAsFile()));
      connect(reload,        SIGNAL(triggered()), this,     SLOT(slot_reload()));
      connect(quit,          SIGNAL(triggered()), this,     SLOT(close()));
      connect(selectall,     SIGNAL(triggered()), ce_scene, SLOT(slot_selectAll()));
      connect(deselectall,   SIGNAL(triggered()), ce_scene, SLOT(slot_deselectAll()));
      connect(inv_select,    SIGNAL(triggered()), ce_scene, SLOT(slot_invertSelection()));
      connect(cut,           SIGNAL(triggered()), ce_view,  SLOT(cut()));
      connect(copy,          SIGNAL(triggered()), ce_view,  SLOT(copy()));
      connect(paste,         SIGNAL(triggered()), ce_view,  SLOT(paste()));
      connect(paste_in_area, SIGNAL(triggered()), ce_view,  SLOT(pasteInArea()));
      connect(zoom_in,       SIGNAL(triggered()), ce_view,  SLOT(zoomIn()));
      connect(zoom_out,      SIGNAL(triggered()), ce_view,  SLOT(zoomOut()));
      connect(zoom_fit,      SIGNAL(triggered()), ce_view,  SLOT(zoomFit()));
      connect(zoom_reset,    SIGNAL(triggered()), ce_view,  SLOT(zoomReset()));
      connect(edit_delete,   SIGNAL(triggered()), ce_scene, SLOT(slot_delete()));
      connect(edit_size_hs,  SIGNAL(triggered()), ce_scene, SLOT(slot_editSizeHotSpot()));
      connect(edit_names,    SIGNAL(triggered()), ce_scene, SLOT(slot_editNames()));
      connect(fullscreen,    SIGNAL(triggered()), this,     SLOT(toggleFullScreen()));
      connect(configure,     SIGNAL(triggered()), qet_app,  SLOT(configureQET()));
      connect(edit_ori,      SIGNAL(triggered()), ce_scene, SLOT(slot_editOrientations()));
      connect(edit_forward,  SIGNAL(triggered()), ce_scene, SLOT(slot_bringForward()));
      connect(edit_raise,    SIGNAL(triggered()), ce_scene, SLOT(slot_raise()));
      connect(edit_lower,    SIGNAL(triggered()), ce_scene, SLOT(slot_lower()));
      connect(edit_backward, SIGNAL(triggered()), ce_scene, SLOT(slot_sendBackward()));
      connect(move,          SIGNAL(triggered()), ce_scene, SLOT(slot_move()));
      connect(add_line,      SIGNAL(triggered()), ce_scene, SLOT(slot_addLine()));
      connect(add_rectangle, SIGNAL(triggered()), ce_scene, SLOT(slot_addRectangle()));
      connect(add_ellipse,   SIGNAL(triggered()), ce_scene, SLOT(slot_addEllipse()));
      connect(add_circle,    SIGNAL(triggered()), ce_scene, SLOT(slot_addCircle()));
      connect(add_polygon,   SIGNAL(triggered()), ce_scene, SLOT(slot_addPolygon()));
      connect(add_text,      SIGNAL(triggered()), ce_scene, SLOT(slot_addText()));
      connect(add_arc,       SIGNAL(triggered()), ce_scene, SLOT(slot_addArc()));
      connect(add_terminal,  SIGNAL(triggered()), ce_scene, SLOT(slot_addTerminal()));
      connect(add_textfield, SIGNAL(triggered()), ce_scene, SLOT(slot_addTextField()));
      
      connect(move,          SIGNAL(triggered()), this, SLOT(slot_setRubberBandToView()));
      connect(add_line,      SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_rectangle, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_ellipse,   SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_circle,    SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_polygon,   SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_text,      SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_arc,       SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_terminal,  SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      connect(add_textfield, SIGNAL(triggered()), this, SLOT(slot_setNoDragToView()));
      
      connect(about_qet,     SIGNAL(triggered()), qet_app, SLOT(aboutQET()));
      connect(about_qt,      SIGNAL(triggered()), qet_app, SLOT(aboutQt()));
      
      connect(ce_scene,      SIGNAL(needNormalMode()), this, SLOT(slot_setNormalMode()));
      
      move          -> setCheckable(true);
      add_line      -> setCheckable(true);
      add_rectangle -> setCheckable(true);
      add_ellipse   -> setCheckable(true);
      add_circle    -> setCheckable(true);
      add_polygon   -> setCheckable(true);
      add_text      -> setCheckable(true);
      add_arc       -> setCheckable(true);
      add_terminal  -> setCheckable(true);
      add_textfield -> setCheckable(true);
      
      parts = new QActionGroup(this);
      parts -> addAction(move);
      parts -> addAction(add_line);
      parts -> addAction(add_rectangle);
      parts -> addAction(add_ellipse);
      parts -> addAction(add_circle);
      parts -> addAction(add_polygon);
      parts -> addAction(add_arc);
      parts -> addAction(add_text);
      parts -> addAction(add_textfield);
      parts -> addAction(add_terminal);
      parts -> setExclusive(true);
      
      parts_toolbar = new QToolBar(tr("Parties", "toolbar title"), this);
      parts_toolbar -> setObjectName("parts");
      foreach (QAction *action, parts -> actions()) parts_toolbar -> addAction(action);
      move -> setChecked(true);
      parts_toolbar -> setAllowedAreas(Qt::AllToolBarAreas);
      
      /*
      QAction *xml_preview = new QAction(QET::Icons::DialogInformation, tr("XML"), this);
      connect(xml_preview, SIGNAL(triggered()), this, SLOT(xmlPreview()));
      parts_toolbar -> addAction(xml_preview);
      */
      
      main_toolbar = new QToolBar(tr("Outils", "toolbar title"), this);
      main_toolbar -> setObjectName("main_toolbar");
      view_toolbar = new QToolBar(tr("Affichage", "toolbar title"), this);
      view_toolbar -> setObjectName("display");
      element_toolbar = new QToolBar(tr("\311l\351ment", "toolbar title"), this);
      element_toolbar -> setObjectName("element_toolbar");
      depth_toolbar = new QToolBar(tr("Profondeur", "toolbar title"), this);
      depth_toolbar -> setObjectName("depth_toolbar");
      
      main_toolbar -> addAction(new_element);
      main_toolbar -> addAction(open);
      main_toolbar -> addAction(save);
      main_toolbar -> addAction(save_as);
      main_toolbar -> addAction(reload);
      main_toolbar -> addSeparator();
      main_toolbar -> addAction(undo);
      main_toolbar -> addAction(redo);
      main_toolbar -> addSeparator();
      main_toolbar -> addAction(edit_delete);
      view_toolbar -> addAction(zoom_in);
      view_toolbar -> addAction(zoom_out);
      view_toolbar -> addAction(zoom_fit);
      view_toolbar -> addAction(zoom_reset);
      element_toolbar -> addAction(edit_size_hs);
      element_toolbar -> addAction(edit_names);
      element_toolbar -> addAction(edit_ori);
      depth_toolbar -> addAction(edit_forward);
      depth_toolbar -> addAction(edit_raise);
      depth_toolbar -> addAction(edit_lower);
      depth_toolbar -> addAction(edit_backward);
      
      addToolBar(Qt::TopToolBarArea, main_toolbar);
      addToolBar(Qt::TopToolBarArea, view_toolbar);
      addToolBar(Qt::TopToolBarArea, element_toolbar);
      addToolBar(Qt::TopToolBarArea, depth_toolbar);
      addToolBar(Qt::LeftToolBarArea, parts_toolbar);
      
      connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateInformations()));
      connect(ce_scene, SIGNAL(selectionChanged()), this, SLOT(slot_updateMenus()));
      connect(QApplication::clipboard(),  SIGNAL(dataChanged()),      this, SLOT(slot_updateMenus()));
      connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateMenus()));
      connect(&(ce_scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(slot_updateTitle()));
      connect(&(ce_scene -> undoStack()), SIGNAL(indexChanged(int)),  this, SLOT(slot_updatePartsList()));
}


Generated by  Doxygen 1.6.0   Back to index