mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Report element : minor improvement about text (text used to display the position of linked report is now tagged "label")
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3560 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<definition width="70" version="0.3" hotspot_x="49" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
||||
link_type="previous_report">
|
||||
<definition width="20" version="0.4" hotspot_x="3" hotspot_y="10" height="20" link_type="previous_report" type="element" ic="true" orientation="dyyy">
|
||||
<names>
|
||||
<name lang="ar">الصفحة السابقة</name>
|
||||
<name lang="de">Vorherige Seite</name>
|
||||
@@ -9,15 +8,15 @@ link_type="previous_report">
|
||||
<name lang="fr">Folio précédent</name>
|
||||
<name lang="pl">Wejście adresowe</name>
|
||||
<name lang="es">folio anterior</name>
|
||||
<name lang="cs">Předchozí list</name>
|
||||
<name lang="nl">Referentie Vorig</name>
|
||||
<name lang="cs">Předchozí list</name>
|
||||
</names>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
<description>
|
||||
<polygon x4="-1" antialias="true" style="line-style:normal;line-weight:normal;filling:black;color:black" closed="false" y1="-4" x1="-1" y2="4" x2="-1" y3="0" x3="9" y4="-4"/>
|
||||
<line length1="1.5" length2="1.5" antialias="false" end1="none" end2="none" style="line-style:normal;line-weight:normal;filling:none;color:black" y1="0" x1="9" y2="0" x2="12"/>
|
||||
<input x="-44" y="0" size="9" rotate="true" text="/"/>
|
||||
<terminal x="13" y="0" nameHidden="0" number="" name="" orientation="e"/>
|
||||
<input x="-44" y="0" size="9" rotate="true" text="/" tagg="label"/>
|
||||
<terminal x="13" y="0" orientation="e"/>
|
||||
</description>
|
||||
</definition>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<definition width="40" version="0.3" hotspot_x="18" hotspot_y="15" height="30" type="element" ic="true" orientation="dyyy"
|
||||
link_type="next_report">
|
||||
<definition width="30" version="0.4" hotspot_x="21" hotspot_y="10" height="20" link_type="next_report" type="element" ic="true" orientation="dyyy">
|
||||
<names>
|
||||
<name lang="ar">الصفحة التالية</name>
|
||||
<name lang="de">Nächste Seite</name>
|
||||
@@ -9,15 +8,15 @@ link_type="next_report">
|
||||
<name lang="fr">Folio suivant</name>
|
||||
<name lang="pl">Wyjście adresowe</name>
|
||||
<name lang="es">Folio siguiente</name>
|
||||
<name lang="cs">Další list</name>
|
||||
<name lang="nl">Referentie volgend</name>
|
||||
<name lang="cs">Další list</name>
|
||||
</names>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
<description>
|
||||
<polygon x4="-9" antialias="true" style="line-style:normal;line-weight:normal;filling:black;color:black" closed="false" y1="-4" x1="-9" y2="4" x2="-9" y3="0" x3="2" y4="-4"/>
|
||||
<line length1="1.5" length2="1.5" antialias="false" end1="none" end2="none" style="line-style:normal;line-weight:normal;filling:none;color:black" y1="0" x1="-9" y2="0" x2="-12"/>
|
||||
<input x="6" y="0" size="9" rotate="true" text="/"/>
|
||||
<terminal x="-13" y="0" nameHidden="0" number="" name="" orientation="w"/>
|
||||
<input x="6" y="0" size="9" rotate="true" text="/" tagg="label"/>
|
||||
<terminal x="-13" y="0" orientation="w"/>
|
||||
</description>
|
||||
</definition>
|
||||
|
||||
@@ -637,7 +637,8 @@ bool QETElementEditor::checkElement() {
|
||||
/// Check master, slave and simple element
|
||||
if(ce_scene -> elementType() == "master" ||
|
||||
ce_scene -> elementType() == "slave" ||
|
||||
ce_scene -> elementType() == "simple" ) {
|
||||
ce_scene -> elementType() == "simple" ||
|
||||
ce_scene -> elementType().contains("report")) {
|
||||
|
||||
bool wrng = true;
|
||||
foreach (CustomElementPart *cep, ce_scene->primitives()) {
|
||||
@@ -647,7 +648,7 @@ bool QETElementEditor::checkElement() {
|
||||
if (wrng) {
|
||||
errors << qMakePair(
|
||||
tr("Absence de champ texte 'label'", "warning title"),
|
||||
tr("Les \351l\351ments ma\356tres, esclaves et simple doivent poss\351der "
|
||||
tr("Les \351l\351ments ma\356tres, esclaves, simple et renvoie de folio doivent poss\351der "
|
||||
"un champ texte comportant le tagg 'label'", "warning description"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,21 @@ void ElementTextItem::adjustItemPosition(int new_block_count) {
|
||||
*/
|
||||
void ElementTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if ( (tagg_ == "label" || parent_element_ -> linkType() & Element::AllReport) && !parent_element_ -> isFree())
|
||||
/*
|
||||
* Before revision 3559, report element haven't got text tagged label
|
||||
* so if parent is a report and haven't got text tagged label,
|
||||
* we know if this text is used has tagged label.
|
||||
*/
|
||||
bool report_text = false;
|
||||
if (parent_element_ -> linkType() & Element::AllReport && !parent_element_ -> taggedText("label"))
|
||||
{
|
||||
//This is the first of list, so this text is used to display
|
||||
//pos of linked report.
|
||||
if (parent_element_ -> texts().first() == this)
|
||||
report_text = true;
|
||||
}
|
||||
|
||||
if ( (tagg_ == "label" || report_text) && !parent_element_ -> isFree())
|
||||
{
|
||||
//If parent is linked, show the linked element
|
||||
if ( parent_element_ -> linkType() & (Element::AllReport | Element::Slave) )
|
||||
@@ -289,10 +303,24 @@ void ElementTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||
* @brief ElementTextItem::hoverEnterEvent
|
||||
* @param event
|
||||
*/
|
||||
void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
|
||||
|
||||
if (tagg_ == "label" || parent_element_ -> linkType() & Element::AllReport) {
|
||||
void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
/*
|
||||
* Before revision 3559, report element haven't got text tagged label
|
||||
* so if parent is a report and haven't got text tagged label,
|
||||
* we know if this text is used has tagged label.
|
||||
*/
|
||||
bool report_text = false;
|
||||
if (parent_element_ -> linkType() & Element::AllReport && !parent_element_ -> taggedText("label"))
|
||||
{
|
||||
//This is the first of list, so this text is used to display
|
||||
//pos of linked report.
|
||||
if (parent_element_ -> texts().first() == this)
|
||||
report_text = true;
|
||||
}
|
||||
|
||||
if (tagg_ == "label" || report_text)
|
||||
{
|
||||
if (parent_element_ -> linkType() & (Element::AllReport | Element::Slave) && !parent_element_->isFree()) {
|
||||
|
||||
setDefaultTextColor(Qt::blue);
|
||||
@@ -312,10 +340,24 @@ void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
|
||||
* @brief ElementTextItem::hoverLeaveEvent
|
||||
* @param event
|
||||
*/
|
||||
void ElementTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
|
||||
|
||||
if (tagg_ == "label" || parent_element_ -> linkType() & Element::AllReport) {
|
||||
void ElementTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
/*
|
||||
* Before revision 3559, report element haven't got text tagged label
|
||||
* so if parent is a report and haven't got text tagged label,
|
||||
* we know if this text is used has tagged label.
|
||||
*/
|
||||
bool report_text = false;
|
||||
if (parent_element_ -> linkType() & Element::AllReport && !parent_element_ -> taggedText("label"))
|
||||
{
|
||||
//This is the first of list, so this text is used to display
|
||||
//pos of linked report.
|
||||
if (parent_element_ -> texts().first() == this)
|
||||
report_text = true;
|
||||
}
|
||||
|
||||
if (tagg_ == "label" || report_text)
|
||||
{
|
||||
if (defaultTextColor() != Qt::black)
|
||||
setDefaultTextColor(Qt::black);
|
||||
|
||||
|
||||
@@ -22,10 +22,21 @@
|
||||
#include "diagram.h"
|
||||
|
||||
ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, int *state) :
|
||||
CustomElement(location, qgi, state)
|
||||
{
|
||||
if (!texts().isEmpty())
|
||||
texts().first()->setNoEditable();
|
||||
CustomElement(location, qgi, state),
|
||||
m_text_field (nullptr)
|
||||
{
|
||||
/*
|
||||
* Get text tagged label. This is work for report
|
||||
* create after the revision 3559.
|
||||
* for report create before, we take the first text field
|
||||
* because report haven't got a text field tagged label
|
||||
*/
|
||||
m_text_field = taggedText("label");
|
||||
if (!m_text_field && !texts().isEmpty())
|
||||
m_text_field = texts().first();
|
||||
if (m_text_field)
|
||||
m_text_field -> setNoEditable();
|
||||
|
||||
link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
|
||||
link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
|
||||
}
|
||||
@@ -121,18 +132,21 @@ void ReportElement::setLabel(QString label) {
|
||||
* Update the displayed label.
|
||||
* ie the folio and position of the linked folio report
|
||||
*/
|
||||
void ReportElement::updateLabel() {
|
||||
if (texts().isEmpty()) return;
|
||||
ElementTextItem *text = texts().first();
|
||||
void ReportElement::updateLabel()
|
||||
{
|
||||
if (!m_text_field) return;
|
||||
|
||||
if (!connected_elements.isEmpty()){
|
||||
if (!connected_elements.isEmpty())
|
||||
{
|
||||
Element *elmt = connected_elements.at(0);
|
||||
QString label = label_;
|
||||
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
|
||||
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
||||
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
|
||||
text->setPlainText(label);
|
||||
} else {
|
||||
text->setPlainText("/");
|
||||
m_text_field -> setPlainText(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_text_field -> setPlainText("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "customelement.h"
|
||||
|
||||
class ElementTextItem;
|
||||
|
||||
/**
|
||||
* @brief The ReportElement class
|
||||
*this class represent an element that can be linked to an other ReportElement
|
||||
@@ -37,8 +39,9 @@ class ReportElement : public CustomElement {
|
||||
virtual void unlinkElement(Element *elmt);
|
||||
|
||||
private:
|
||||
int inverse_report;
|
||||
QString label_;
|
||||
int inverse_report;
|
||||
QString label_;
|
||||
ElementTextItem *m_text_field;
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user