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() {
|
void ProjectView::addNewDiagramFolioList() {
|
||||||
if (project_ -> isReadOnly()) return;
|
if (project_ -> isReadOnly()) return;
|
||||||
|
int i = 0; //< Each new diagram is added to the end of the project.
|
||||||
QList <Diagram *> list = project_ -> addNewDiagramFolioList();
|
//< We use @i to move the folio list at the beginning of the project
|
||||||
int size = list.size();
|
foreach (Diagram *d, project_ -> addNewDiagramFolioList()) {
|
||||||
for (int i = 0; i < size; i++) {
|
DiagramView *new_diagram_view = new DiagramView(d);
|
||||||
DiagramView *new_diagram_view = new DiagramView(list.takeLast());
|
addDiagram(new_diagram_view);
|
||||||
addDiagram(new_diagram_view, true);
|
|
||||||
showDiagram(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
|
* @param front: true add page at front
|
||||||
* false add page at back
|
* false add page at back
|
||||||
*/
|
*/
|
||||||
void ProjectView::addDiagram(DiagramView *diagram, bool front) {
|
void ProjectView::addDiagram(DiagramView *diagram) {
|
||||||
if (!diagram) return;
|
if (!diagram) return;
|
||||||
|
|
||||||
// check diagram isn't present in the project
|
// check diagram isn't present in the project
|
||||||
@@ -358,10 +359,6 @@ void ProjectView::addDiagram(DiagramView *diagram, bool front) {
|
|||||||
|
|
||||||
// signal diagram was added
|
// signal diagram was added
|
||||||
emit(diagramAdded(diagram));
|
emit(diagramAdded(diagram));
|
||||||
// move tab to front if wanted
|
|
||||||
if (front) {
|
|
||||||
tabs_->moveTab(tabs_->count()-1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -769,9 +766,13 @@ void ProjectView::initLayout() {
|
|||||||
layout_ -> addWidget(tabs_);
|
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() {
|
void ProjectView::loadDiagrams() {
|
||||||
if (!project_) return;
|
if (!project_) return;
|
||||||
|
|
||||||
@@ -781,11 +782,18 @@ void ProjectView::loadDiagrams() {
|
|||||||
DiagramView *sv = new DiagramView(diagram);
|
DiagramView *sv = new DiagramView(diagram);
|
||||||
addDiagram(sv);
|
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() {
|
void ProjectView::updateWindowTitle() {
|
||||||
QString title;
|
QString title;
|
||||||
if (project_) {
|
if (project_) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class ProjectView : public QWidget {
|
|||||||
public slots:
|
public slots:
|
||||||
void addNewDiagram();
|
void addNewDiagram();
|
||||||
void addNewDiagramFolioList();
|
void addNewDiagramFolioList();
|
||||||
void addDiagram(DiagramView *, bool front=false);
|
void addDiagram(DiagramView *);
|
||||||
void removeDiagram(DiagramView *);
|
void removeDiagram(DiagramView *);
|
||||||
void removeDiagram(Diagram *);
|
void removeDiagram(Diagram *);
|
||||||
void showDiagram(DiagramView *);
|
void showDiagram(DiagramView *);
|
||||||
|
|||||||
Reference in New Issue
Block a user