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

QETDiagramEditor::QETDiagramEditor ( const QStringList &  files = QStringList(),
QWidget *  parent = 0 
)

constructeur

Parameters:
files Liste de fichiers a ouvrir
parent le widget parent de la fenetre principale

Definition at line 34 of file qetdiagrameditor.cpp.

References actions(), activateDiagram(), activateProject(), activateWidget(), addDiagramToProject(), closeProject(), editDiagramProperties(), editProjectProperties(), menus(), newProject(), openAndAddProject(), pa, qdw_pa, qdw_undo, readSettings(), removeDiagram(), slot_updateActions(), slot_updatePasteAction(), slot_updateWindowsMenu(), and toolbar().

                                                                            :
      QMainWindow(parent),
      open_dialog_dir(QDir::homePath()),
      can_update_actions(true)
{
      // mise en place de l'interface MDI au centre de l'application
      setCentralWidget(&workspace);
      
      // nomme l'objet afin qu'il soit reperable par les feuilles de style
      workspace.setBackground(QBrush(Qt::NoBrush));
      workspace.setObjectName("mdiarea");
      
      // mise en place du signalmapper
      connect(&windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *)));
      
      // titre de la fenetre
      setWindowTitle(tr("QElectroTech", "window title"));
      
      // icone de la fenetre
      setWindowIcon(QET::Icons::QETLogo);
      
      // barre de statut de la fenetre
      statusBar() -> showMessage(tr("QElectroTech", "status bar message"));
      
      // ajout du panel d'Elements en tant que QDockWidget
      qdw_pa = new QDockWidget(tr("Panel d'\351l\351ments", "dock title"), this);
      qdw_pa -> setObjectName("elements panel");
      qdw_pa -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
      qdw_pa -> setFeatures(QDockWidget::AllDockWidgetFeatures);
      qdw_pa -> setMinimumWidth(160);
      qdw_pa -> setWidget(pa = new ElementsPanelWidget(qdw_pa));
      connect(&(pa -> elementsPanel()), SIGNAL(requestForDiagram(Diagram *)),    this, SLOT(activateDiagram(Diagram *)));
      connect(&(pa -> elementsPanel()), SIGNAL(requestForProject(QETProject *)), this, SLOT(activateProject(QETProject *)));
      
      connect(pa, SIGNAL(requestForProjectClosing(QETProject *)), this, SLOT(closeProject(QETProject *)));
      connect(pa, SIGNAL(requestForProjectPropertiesEdition(QETProject *)), this, SLOT(editProjectProperties(QETProject *)));
      connect(pa, SIGNAL(requestForDiagramPropertiesEdition(Diagram *)),    this, SLOT(editDiagramProperties(Diagram *)));
      connect(pa, SIGNAL(requestForNewDiagram(QETProject *)),     this, SLOT(addDiagramToProject(QETProject *)));
      connect(pa, SIGNAL(requestForDiagramDeletion(Diagram *)),   this, SLOT(removeDiagram(Diagram *)));
      
      qdw_undo = new QDockWidget(tr("Annulations", "dock title"));
      qdw_undo -> setObjectName("diagram_undo");
      qdw_pa -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
      qdw_undo -> setFeatures(QDockWidget::AllDockWidgetFeatures);
      qdw_undo -> setMinimumWidth(160);
      tabifyDockWidget(qdw_pa, qdw_undo);
      QUndoView *undo_view = new QUndoView(&undo_group, this);
      undo_view -> setEmptyLabel(tr("Aucune modification"));
      qdw_undo -> setWidget(undo_view);
      
      addDockWidget(Qt::LeftDockWidgetArea, qdw_undo);
      tabifyDockWidget(qdw_undo, qdw_pa);
      
      // mise en place des actions
      actions();
      
      // mise en place de la barre d'outils
      toolbar();
      
      // mise en place des menus
      menus();
      
      // la fenetre est maximisee par defaut
      setMinimumSize(QSize(500, 350));
      setWindowState(Qt::WindowMaximized);
      
      // connexions signaux / slots pour une interface sensee
      connect(&workspace,                SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateWindowsMenu()));
      connect(&workspace,                SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slot_updateActions()));
      connect(QApplication::clipboard(), SIGNAL(dataChanged()),              this, SLOT(slot_updatePasteAction()));
      
      // lecture des parametres
      readSettings();
      
      // affichage
      show();
      
      // si des chemins de fichiers valides sont passes en arguments
      uint opened_projects = 0;
      if (files.count()) {
            // alors on ouvre ces fichiers
            foreach(QString file, files) {
                  bool project_opening = openAndAddProject(file, false);
                  if (project_opening) {
                        ++ opened_projects;
                  }
            }
      }
      
      // si aucun schema n'a ete ouvert jusqu'a maintenant, on ouvre un nouveau schema
      if (!opened_projects) newProject();
}


Generated by  Doxygen 1.6.0   Back to index