mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Add the new element type : thumbnail
This type must be used for element who goal is to display a thumbnail/front view of an element, notably used for cabinet contents view and placement.
This commit is contained in:
@@ -122,6 +122,7 @@ void ElementPropertiesEditorWidget::setUpInterface()
|
|||||||
ui->m_base_type_cb->addItem (tr("Renvoi de folio suivant"), ElementData::NextReport);
|
ui->m_base_type_cb->addItem (tr("Renvoi de folio suivant"), ElementData::NextReport);
|
||||||
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
|
ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), ElementData::PreviousReport);
|
||||||
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminale);
|
ui->m_base_type_cb->addItem (tr("Bornier"), ElementData::Terminale);
|
||||||
|
ui->m_base_type_cb->addItem (tr("Vignette"), ElementData::Thumbnail);
|
||||||
|
|
||||||
// Slave option
|
// Slave option
|
||||||
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
|
ui->m_state_cb->addItem(tr("Normalement ouvert"), ElementData::NO);
|
||||||
@@ -179,6 +180,9 @@ void ElementPropertiesEditorWidget::updateTree()
|
|||||||
case ElementData::Terminale:
|
case ElementData::Terminale:
|
||||||
ui->m_tree->setEnabled(true);
|
ui->m_tree->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
ui->m_tree->setDisabled(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,10 @@ bool ElementData::operator !=(const ElementData &data) const {
|
|||||||
return !(*this == data);
|
return !(*this == data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ElementData::typeToString() const {
|
||||||
|
return typeToString(m_type);
|
||||||
|
}
|
||||||
|
|
||||||
QString ElementData::typeToString(ElementData::Type type)
|
QString ElementData::typeToString(ElementData::Type type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -307,6 +311,8 @@ QString ElementData::typeToString(ElementData::Type type)
|
|||||||
return QString("slave");
|
return QString("slave");
|
||||||
case ElementData::Terminale :
|
case ElementData::Terminale :
|
||||||
return QString("terminal");
|
return QString("terminal");
|
||||||
|
case ElementData::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'";
|
||||||
@@ -328,6 +334,8 @@ 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 == QLatin1String("thumbnail")) {
|
||||||
|
return ElementData::Thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return simple if nothing match
|
//Return simple if nothing match
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ class ElementData : public PropertiesInterface
|
|||||||
AllReport = 6,
|
AllReport = 6,
|
||||||
Master = 8,
|
Master = 8,
|
||||||
Slave = 16,
|
Slave = 16,
|
||||||
Terminale = 32};
|
Terminale = 32,
|
||||||
|
Thumbnail = 64};
|
||||||
Q_ENUM(Type)
|
Q_ENUM(Type)
|
||||||
|
|
||||||
enum MasterType {
|
enum MasterType {
|
||||||
@@ -104,6 +105,7 @@ class ElementData : public PropertiesInterface
|
|||||||
bool operator==(const ElementData &data) const;
|
bool operator==(const ElementData &data) const;
|
||||||
bool operator!=(const ElementData &data) const;
|
bool operator!=(const ElementData &data) const;
|
||||||
|
|
||||||
|
QString typeToString() const;
|
||||||
static QString typeToString(ElementData::Type type);
|
static QString typeToString(ElementData::Type type);
|
||||||
static ElementData::Type typeFromString(const QString &string);
|
static ElementData::Type typeFromString(const QString &string);
|
||||||
|
|
||||||
|
|||||||
@@ -1306,6 +1306,12 @@ void Element::initLink(QETProject *prj)
|
|||||||
tmp_uuids_link.clear();
|
tmp_uuids_link.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Element::linkTypeToString
|
||||||
|
* \deprecated use instead ElementData::typeToString
|
||||||
|
* \todo remove this function
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
QString Element::linkTypeToString() const
|
QString Element::linkTypeToString() const
|
||||||
{
|
{
|
||||||
switch (m_link_type)
|
switch (m_link_type)
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ QWidget *ElementPropertiesWidget::generalWidget()
|
|||||||
if (folio_index != -1) {
|
if (folio_index != -1) {
|
||||||
description_string += QString(tr("Folio : %1\n")).arg(folio_index + 1);
|
description_string += QString(tr("Folio : %1\n")).arg(folio_index + 1);
|
||||||
}
|
}
|
||||||
description_string += QString(tr("Type : %1\n")).arg(m_element ->linkTypeToString());
|
description_string += QString(tr("Type : %1\n")).arg(m_element->elementData().typeToString());
|
||||||
description_string += QString(tr("Sous-type : %1\n")).arg(m_element ->kindInformations()["type"].toString());
|
description_string += QString(tr("Sous-type : %1\n")).arg(m_element ->kindInformations()["type"].toString());
|
||||||
description_string += QString(tr("Position : %1\n")).arg(m_diagram -> convertPosition(m_element -> scenePos()).toString());
|
description_string += QString(tr("Position : %1\n")).arg(m_diagram -> convertPosition(m_element -> scenePos()).toString());
|
||||||
description_string += QString(tr("Rotation : %1°\n")).arg(m_element.data()->rotation());
|
description_string += QString(tr("Rotation : %1°\n")).arg(m_element.data()->rotation());
|
||||||
|
|||||||
Reference in New Issue
Block a user