mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Give the user a possibility to set the maximum number of parts during import on an dxf file. Because sometimes the dxf file can contain more than 200 elements and the user is deleting some elements afterwards
This commit is contained in:
@@ -52,11 +52,6 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
|
||||||
/**
|
|
||||||
Number max of primitive displayed by the parts list widget
|
|
||||||
*/
|
|
||||||
#define QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST 200
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETElementEditor::QETElementEditor
|
* @brief QETElementEditor::QETElementEditor
|
||||||
* @param parent
|
* @param parent
|
||||||
@@ -464,7 +459,9 @@ void QETElementEditor::fillPartsList()
|
|||||||
m_parts_list -> clear();
|
m_parts_list -> clear();
|
||||||
QList<QGraphicsItem *> qgis = m_elmt_scene -> zItems();
|
QList<QGraphicsItem *> 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)
|
for (int j = qgis.count() - 1 ; j >= 0 ; -- j)
|
||||||
{
|
{
|
||||||
@@ -489,7 +486,7 @@ void QETElementEditor::fillPartsList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
m_parts_list -> blockSignals(false);
|
||||||
}
|
}
|
||||||
@@ -678,10 +675,12 @@ void QETElementEditor::updateInformations()
|
|||||||
void QETElementEditor::updatePartsList()
|
void QETElementEditor::updatePartsList()
|
||||||
{
|
{
|
||||||
int items_count = m_elmt_scene -> items().count();
|
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) {
|
if (m_parts_list -> count() != items_count) {
|
||||||
fillPartsList();
|
fillPartsList();
|
||||||
}
|
}
|
||||||
else if (items_count <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) {
|
else if (items_count <= maxParts) {
|
||||||
m_parts_list -> blockSignals(true);
|
m_parts_list -> blockSignals(true);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
QList<QGraphicsItem *> items = m_elmt_scene -> zItems();
|
QList<QGraphicsItem *> items = m_elmt_scene -> zItems();
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
|||||||
|
|
||||||
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
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());
|
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();
|
QString path = settings.value("elements-collections/common-collection-path", "default").toString();
|
||||||
if (path != "default")
|
if (path != "default")
|
||||||
@@ -185,6 +191,7 @@ void GeneralConfigurationPage::applyConf()
|
|||||||
|
|
||||||
//ELEMENT EDITOR
|
//ELEMENT EDITOR
|
||||||
settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText());
|
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
|
//DIAGRAM VIEW
|
||||||
settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked());
|
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);
|
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("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class GeneralConfigurationPage : public ConfigPage
|
|||||||
void on_m_custom_elmt_path_cb_currentIndexChanged(int index);
|
void on_m_custom_elmt_path_cb_currentIndexChanged(int index);
|
||||||
void on_m_custom_tbt_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_m_indi_text_font_pb_clicked();
|
||||||
|
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fillLang();
|
void fillLang();
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -841,6 +841,63 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="Editor">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Editor</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Max. parts in Element Editor List</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="MaxPartsElementEditorList_sb">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>200</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user