Element::Thumbnail WIP

This commit is contained in:
Laurent Trinques
2022-05-15 14:29:01 +02:00
parent 2ec7e6aa45
commit db8c76c184
7 changed files with 42 additions and 13 deletions

View File

@@ -412,7 +412,7 @@ void projectDataBase::populateElementTable()
for (auto diagram : m_project->diagrams())
{
ElementProvider ep(diagram);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master | Element::Thumbnail);
//Insert all value into the database
for (auto elmt : elements_list)
{
@@ -440,7 +440,7 @@ void projectDataBase::populateElementInfoTable()
for (auto *diagram : m_project->diagrams())
{
ElementProvider ep(diagram);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master| Element::Thumbnail);
//Insert all value into the database
for (auto elmt : elements_list)

View File

@@ -45,6 +45,7 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
m_button_group.addButton(ui->m_button_cb, 3);
m_button_group.addButton(ui->m_coil_cb, 4);
m_button_group.addButton(ui->m_protection_cb, 5);
m_button_group.addButton(ui->m_thumbnail_cb,6);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
#else
@@ -185,8 +186,13 @@ void ElementQueryWidget::setQuery(const QString &query)
if (ui->m_protection_cb) {
++c;
}
ui->m_thumbnail_cb->setChecked (str_type.contains("Thumbnail") ? true : false);
if (ui->m_thumbnail_cb->isChecked()) {
++c;
}
if (c == 5) {
if (c == 6) {
ui->m_all_cb->setCheckState(Qt::Checked);
} else if (c > 0) {
ui->m_all_cb->setCheckState(Qt::PartiallyChecked);
@@ -337,6 +343,11 @@ QString ElementQueryWidget::queryStr() const
where += " element_type = 'Terminale'";
b = true;
}
if (ui->m_thumbnail_cb->isChecked()) {
if (b) where +=" OR";
where += " element_type = 'thumbnail'";
b = true;
}
if (ui->m_simple_cb->isChecked()) {
if (b) where +=" OR";
where += " element_type = 'Simple'";

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>341</width>
<height>527</height>
<height>557</height>
</rect>
</property>
<property name="windowTitle">
@@ -242,7 +242,7 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="4" column="0">
<item row="5" column="0">
<widget class="QCheckBox" name="m_simple_cb">
<property name="text">
<string>Simples</string>
@@ -252,6 +252,16 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="m_protection_cb">
<property name="text">
<string>Organes de protection</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_all_cb">
<property name="text">
@@ -272,7 +282,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QCheckBox" name="m_button_cb">
<property name="text">
<string>Boutons et commutateurs</string>
@@ -282,7 +292,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QCheckBox" name="m_terminal_cb">
<property name="text">
<string>Borniers</string>
@@ -292,10 +302,10 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="m_protection_cb">
<item row="1" column="0">
<widget class="QCheckBox" name="m_thumbnail_cb">
<property name="text">
<string>Organes de protection</string>
<string>Vignettes</string>
</property>
<property name="checked">
<bool>true</bool>