diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index bec33bb14..89d93b856 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -52,11 +52,6 @@ #include #include -/** - Number max of primitive displayed by the parts list widget - */ -#define QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST 200 - /** * @brief QETElementEditor::QETElementEditor * @param parent @@ -464,7 +459,9 @@ void QETElementEditor::fillPartsList() m_parts_list -> clear(); QList qgis = m_elmt_scene -> zItems(); - if (qgis.count() <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) + QSettings settings; + int maxParts = settings.value("elementeditor/max-parts-element-editor-list", 200).toInt(); + if (qgis.count() <= maxParts) { { for (int j = qgis.count() - 1 ; j >= 0 ; -- j) { @@ -489,7 +486,7 @@ void QETElementEditor::fillPartsList() } } else { - m_parts_list -> addItem(new QListWidgetItem(tr("Trop de primitives, liste non générée."))); + m_parts_list -> addItem(new QListWidgetItem(tr("Trop de primitives, liste non générée: %1").arg(qgis.count()))); } m_parts_list -> blockSignals(false); } @@ -678,10 +675,12 @@ void QETElementEditor::updateInformations() void QETElementEditor::updatePartsList() { int items_count = m_elmt_scene -> items().count(); + QSettings settings; + const int maxParts = settings.value("elementeditor/max-parts-element-editor-list", 200).toInt(); if (m_parts_list -> count() != items_count) { fillPartsList(); } - else if (items_count <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) { + else if (items_count <= maxParts) { m_parts_list -> blockSignals(true); int i = 0; QList items = m_elmt_scene -> zItems(); diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index 56f4135d3..30d0adf6d 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -122,6 +122,12 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool()); ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString()); + /* + Nombre maximum de primitives affichees par la "liste des parties" + Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse + et que la liste ne sera donc pas mise a jour. + */ + ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt()); QString path = settings.value("elements-collections/common-collection-path", "default").toString(); if (path != "default") @@ -185,6 +191,7 @@ void GeneralConfigurationPage::applyConf() //ELEMENT EDITOR settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText()); + settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value()); //DIAGRAM VIEW settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked()); @@ -434,3 +441,14 @@ void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked() ui->m_indi_text_font_pb->setText(fontInfos); } } + +void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int value) +{ + if (value > 500) { + ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application.")); + ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange"); + } else { + ui->MaxPartsElementEditorList_sb->setToolTip(""); + ui->MaxPartsElementEditorList_sb->setStyleSheet(""); + } +} diff --git a/sources/ui/configpage/generalconfigurationpage.h b/sources/ui/configpage/generalconfigurationpage.h index f6f38d96b..0fb6b4737 100644 --- a/sources/ui/configpage/generalconfigurationpage.h +++ b/sources/ui/configpage/generalconfigurationpage.h @@ -45,6 +45,7 @@ class GeneralConfigurationPage : public ConfigPage void on_m_custom_elmt_path_cb_currentIndexChanged(int index); void on_m_custom_tbt_path_cb_currentIndexChanged(int index); void on_m_indi_text_font_pb_clicked(); + void on_MaxPartsElementEditorList_sb_valueChanged(int value); private: void fillLang(); diff --git a/sources/ui/configpage/generalconfigurationpage.ui b/sources/ui/configpage/generalconfigurationpage.ui index 3fa5ee52c..3645f6aa6 100644 --- a/sources/ui/configpage/generalconfigurationpage.ui +++ b/sources/ui/configpage/generalconfigurationpage.ui @@ -13,8 +13,8 @@ Form - - + + 0 @@ -841,6 +841,63 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments + + + Editor + + + + + + + + Max. parts in Element Editor List + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 1 + + + 10000 + + + 200 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + +