mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Element::Thumbnail WIP
This commit is contained in:
@@ -123,7 +123,8 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
|
|||||||
//We apply change only for master, slave, and terminal element.
|
//We apply change only for master, slave, and terminal element.
|
||||||
if (elmt->linkType() == Element::Master ||
|
if (elmt->linkType() == Element::Master ||
|
||||||
elmt->linkType() == Element::Simple ||
|
elmt->linkType() == Element::Simple ||
|
||||||
elmt->linkType() == Element::Terminale)
|
elmt->linkType() == Element::Terminale ||
|
||||||
|
elmt->linkType() == Element::Thumbnail)
|
||||||
{
|
{
|
||||||
DiagramContext old_context;
|
DiagramContext old_context;
|
||||||
DiagramContext new_context = old_context = elmt->elementInformations();
|
DiagramContext new_context = old_context = elmt->elementInformations();
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ void projectDataBase::addElement(Element *element)
|
|||||||
m_insert_elements_query.bindValue(":uuid", element->uuid().toString());
|
m_insert_elements_query.bindValue(":uuid", element->uuid().toString());
|
||||||
m_insert_elements_query.bindValue(":diagram_uuid", element->diagram()->uuid().toString());
|
m_insert_elements_query.bindValue(":diagram_uuid", element->diagram()->uuid().toString());
|
||||||
m_insert_elements_query.bindValue(":pos", element->diagram()->convertPosition(element->scenePos()).toString());
|
m_insert_elements_query.bindValue(":pos", element->diagram()->convertPosition(element->scenePos()).toString());
|
||||||
m_insert_elements_query.bindValue(":type", element->linkTypeToString());
|
m_insert_elements_query.bindValue(":type", element->elementData().typeToString());
|
||||||
m_insert_elements_query.bindValue(":sub_type", element->kindInformations()["type"].toString());
|
m_insert_elements_query.bindValue(":sub_type", element->kindInformations()["type"].toString());
|
||||||
if (!m_insert_elements_query.exec()) {
|
if (!m_insert_elements_query.exec()) {
|
||||||
qDebug() << "projectDataBase::addElement insert element error : " << m_insert_elements_query.lastError();
|
qDebug() << "projectDataBase::addElement insert element error : " << m_insert_elements_query.lastError();
|
||||||
@@ -440,7 +440,7 @@ void projectDataBase::populateElementInfoTable()
|
|||||||
for (auto *diagram : m_project->diagrams())
|
for (auto *diagram : m_project->diagrams())
|
||||||
{
|
{
|
||||||
ElementProvider ep(diagram);
|
ElementProvider ep(diagram);
|
||||||
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master| Element::Thumbnail);
|
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master | Element::Thumbnail);
|
||||||
|
|
||||||
//Insert all value into the database
|
//Insert all value into the database
|
||||||
for (auto elmt : elements_list)
|
for (auto elmt : elements_list)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
|||||||
m_button_group.addButton(ui->m_button_cb, 3);
|
m_button_group.addButton(ui->m_button_cb, 3);
|
||||||
m_button_group.addButton(ui->m_coil_cb, 4);
|
m_button_group.addButton(ui->m_coil_cb, 4);
|
||||||
m_button_group.addButton(ui->m_protection_cb, 5);
|
m_button_group.addButton(ui->m_protection_cb, 5);
|
||||||
m_button_group.addButton(ui->m_thumbnail_cb,6);
|
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
#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)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
||||||
#else
|
#else
|
||||||
@@ -345,7 +345,7 @@ QString ElementQueryWidget::queryStr() const
|
|||||||
}
|
}
|
||||||
if (ui->m_thumbnail_cb->isChecked()) {
|
if (ui->m_thumbnail_cb->isChecked()) {
|
||||||
if (b) where +=" OR";
|
if (b) where +=" OR";
|
||||||
where += " element_type = 'thumbnail'";
|
where += " element_type = 'Thumbnail'";
|
||||||
b = true;
|
b = true;
|
||||||
}
|
}
|
||||||
if (ui->m_simple_cb->isChecked()) {
|
if (ui->m_simple_cb->isChecked()) {
|
||||||
|
|||||||
@@ -467,14 +467,16 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
|||||||
auto type_ = m_element_data.m_type;
|
auto type_ = m_element_data.m_type;
|
||||||
if (type_ == ElementData::Slave ||
|
if (type_ == ElementData::Slave ||
|
||||||
type_ == ElementData::Master ||
|
type_ == ElementData::Master ||
|
||||||
type_ == ElementData::Terminale)
|
type_ == ElementData::Terminale ||
|
||||||
|
type_ == ElementData::Thumbnail)
|
||||||
{
|
{
|
||||||
root.appendChild(m_element_data.kindInfoToXml(xml_document));
|
root.appendChild(m_element_data.kindInfoToXml(xml_document));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type_ == ElementData::Simple ||
|
if(type_ == ElementData::Simple ||
|
||||||
type_ == ElementData::Master ||
|
type_ == ElementData::Master ||
|
||||||
type_ == ElementData::Terminale)
|
type_ == ElementData::Terminale||
|
||||||
|
type_ == ElementData::Thumbnail)
|
||||||
{
|
{
|
||||||
QDomElement element_info = xml_document.createElement("elementInformations");
|
QDomElement element_info = xml_document.createElement("elementInformations");
|
||||||
m_element_data.m_informations.toXml(element_info, "elementInformation");
|
m_element_data.m_informations.toXml(element_info, "elementInformation");
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ QString ElementData::typeToString(ElementData::Type type)
|
|||||||
case ElementData::Terminale :
|
case ElementData::Terminale :
|
||||||
return QString("terminal");
|
return QString("terminal");
|
||||||
case ElementData::Thumbnail:
|
case ElementData::Thumbnail:
|
||||||
return QString("thumbnail");
|
return QStringLiteral("thumbnail");
|
||||||
default:
|
default:
|
||||||
qDebug() << "ElementData::typeToString : type don't exist"
|
qDebug() << "ElementData::typeToString : type don't exist"
|
||||||
<< "return failsafe value 'simple'";
|
<< "return failsafe value 'simple'";
|
||||||
@@ -334,7 +334,7 @@ ElementData::Type ElementData::typeFromString(const QString &string)
|
|||||||
return ElementData::Slave;
|
return ElementData::Slave;
|
||||||
} else if (string == "terminal") {
|
} else if (string == "terminal") {
|
||||||
return ElementData::Terminale;
|
return ElementData::Terminale;
|
||||||
} else if (string == "thumbnail") {
|
} else if (string == QLatin1String("thumbnail")) {
|
||||||
return ElementData::Thumbnail;
|
return ElementData::Thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,6 +270,8 @@ Element *DynamicElementTextItem::elementUseForInfo() const
|
|||||||
{
|
{
|
||||||
case Element::Simple:
|
case Element::Simple:
|
||||||
return elmt;
|
return elmt;
|
||||||
|
case Element::Thumbnail:
|
||||||
|
return elmt;
|
||||||
case Element::NextReport:
|
case Element::NextReport:
|
||||||
return elmt;
|
return elmt;
|
||||||
case Element::PreviousReport:
|
case Element::PreviousReport:
|
||||||
|
|||||||
@@ -1328,6 +1328,8 @@ QString Element::linkTypeToString() const
|
|||||||
return QStringLiteral("Slave");
|
return QStringLiteral("Slave");
|
||||||
case Terminale:
|
case Terminale:
|
||||||
return QStringLiteral("Terminale");
|
return QStringLiteral("Terminale");
|
||||||
|
case Thumbnail:
|
||||||
|
return QStringLiteral("Thumbnail");
|
||||||
default:
|
default:
|
||||||
return QStringLiteral("Unknown");
|
return QStringLiteral("Unknown");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user