[qet] [4636] Bug fix : crash when edit the titleblock properties of an empty project ( project without folio) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4636
Author: blacksun
Date: 2016-08-17 15:00:32 +0200 (Wed, 17 Aug 2016)
Log Message:
-----------
Bug fix : crash when edit the titleblock properties of an empty project (project without folio)
Modified Paths:
--------------
trunk/sources/configpages.cpp
trunk/sources/projectview.cpp
trunk/sources/ui/autonumberingdockwidget.cpp
Modified: trunk/sources/configpages.cpp
===================================================================
--- trunk/sources/configpages.cpp 2016-08-17 12:41:49 UTC (rev 4635)
+++ trunk/sources/configpages.cpp 2016-08-17 13:00:32 UTC (rev 4636)
@@ -114,7 +114,6 @@
if (m_project -> defaultTitleBlockProperties() != new_tbt_prop) {
m_project -> setDefaultTitleBlockProperties(ipw -> properties());
modified_project = true;
- emit (m_project->defaultTitleBlockPropertiesChanged());
}
ConductorProperties new_conductor_prop = cpw -> properties();
Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp 2016-08-17 12:41:49 UTC (rev 4635)
+++ trunk/sources/projectview.cpp 2016-08-17 13:00:32 UTC (rev 4636)
@@ -116,10 +116,13 @@
}
/**
- @return le schema actuellement active
-*/
+ * @brief ProjectView::currentDiagram
+ * @return The current active diagram view or nullptr if there isn't diagramView in this project view.
+ */
DiagramView *ProjectView::currentDiagram() const {
int current_tab_index = m_tab -> currentIndex();
+ if (current_tab_index == -1)
+ return nullptr;
return(diagram_ids_[current_tab_index]);
}
Modified: trunk/sources/ui/autonumberingdockwidget.cpp
===================================================================
--- trunk/sources/ui/autonumberingdockwidget.cpp 2016-08-17 12:41:49 UTC (rev 4635)
+++ trunk/sources/ui/autonumberingdockwidget.cpp 2016-08-17 13:00:32 UTC (rev 4636)
@@ -145,19 +145,20 @@
void AutoNumberingDockWidget::setActive() {
if (projectview_!=NULL) {
- //Conductor
- QString conductor_autonum = projectview_->currentDiagram()->diagram()->conductorsAutonumName();
- int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
- ui->m_conductor_cb->setCurrentIndex(conductor_index);
+ //Conductor
+ if (projectview_->currentDiagram()) {
+ QString conductor_autonum = projectview_->currentDiagram()->diagram()->conductorsAutonumName();
+ int conductor_index = ui->m_conductor_cb->findText(conductor_autonum);
+ ui->m_conductor_cb->setCurrentIndex(conductor_index);
+ }
- //Element
- QString current_element_autonum = project_->elementCurrentAutoNum();
+ //Element
QString element_formula = project_->elementAutoNumFormula();
QString active_element_autonum = project_->elementAutoNumHash().key(element_formula);
int el_index = ui->m_element_cb->findText(active_element_autonum);
ui->m_element_cb->setCurrentIndex(el_index);
- //Folio
+ //Folio
if (project_->defaultTitleBlockProperties().folio == "%autonum") {
QString page_autonum = project_->defaultTitleBlockProperties().auto_page_num;
int folio_index = ui->m_folio_cb->findText(page_autonum);