mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Diagram folio list is now always at the beginnig of the project (at creation and at load)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3314 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -316,13 +316,14 @@ void ProjectView::addNewDiagram() {
|
||||
*/
|
||||
void ProjectView::addNewDiagramFolioList() {
|
||||
if (project_ -> isReadOnly()) return;
|
||||
|
||||
QList <Diagram *> list = project_ -> addNewDiagramFolioList();
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
DiagramView *new_diagram_view = new DiagramView(list.takeLast());
|
||||
addDiagram(new_diagram_view, true);
|
||||
int i = 0; //< Each new diagram is added to the end of the project.
|
||||
//< We use @i to move the folio list at the beginning of the project
|
||||
foreach (Diagram *d, project_ -> addNewDiagramFolioList()) {
|
||||
DiagramView *new_diagram_view = new DiagramView(d);
|
||||
addDiagram(new_diagram_view);
|
||||
showDiagram(new_diagram_view);
|
||||
tabs_->moveTab(diagrams().size()-1, i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +338,7 @@ void ProjectView::addNewDiagramFolioList() {
|
||||
* @param front: true add page at front
|
||||
* false add page at back
|
||||
*/
|
||||
void ProjectView::addDiagram(DiagramView *diagram, bool front) {
|
||||
void ProjectView::addDiagram(DiagramView *diagram) {
|
||||
if (!diagram) return;
|
||||
|
||||
// check diagram isn't present in the project
|
||||
@@ -358,10 +359,6 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) {
|
||||
|
||||
// signal diagram was added
|
||||
emit(diagramAdded(diagram));
|
||||
// move tab to front if wanted
|
||||
if (front) {
|
||||
tabs_->moveTab(tabs_->count()-1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -769,8 +766,12 @@ void ProjectView::initLayout() {
|
||||
layout_ -> addWidget(tabs_);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Charge les schemas du projet
|
||||
* @brief ProjectView::loadDiagrams
|
||||
* Load diagrams of project.
|
||||
* We create a diagram view for each diagram,
|
||||
* and add it to the project view.
|
||||
*/
|
||||
void ProjectView::loadDiagrams() {
|
||||
if (!project_) return;
|
||||
@@ -781,10 +782,17 @@ void ProjectView::loadDiagrams() {
|
||||
DiagramView *sv = new DiagramView(diagram);
|
||||
addDiagram(sv);
|
||||
}
|
||||
|
||||
// If project have the folios list, move it at the beginning of the project
|
||||
if (project_ -> getFolioSheetsQuantity()) {
|
||||
for (int i = 0; i < project_->getFolioSheetsQuantity(); i++)
|
||||
tabs_ -> moveTab(diagrams().size()-1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Met a jour le titre du ProjectView
|
||||
* @brief ProjectView::updateWindowTitle
|
||||
* Update the project view title
|
||||
*/
|
||||
void ProjectView::updateWindowTitle() {
|
||||
QString title;
|
||||
|
||||
@@ -61,7 +61,7 @@ class ProjectView : public QWidget {
|
||||
public slots:
|
||||
void addNewDiagram();
|
||||
void addNewDiagramFolioList();
|
||||
void addDiagram(DiagramView *, bool front=false);
|
||||
void addDiagram(DiagramView *);
|
||||
void removeDiagram(DiagramView *);
|
||||
void removeDiagram(Diagram *);
|
||||
void showDiagram(DiagramView *);
|
||||
|
||||
Reference in New Issue
Block a user