[qet] [4574] Minor: %prefix is not hardcoded anymore.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4574
Author:   dfochi
Date:     2016-07-13 23:25:29 +0200 (Wed, 13 Jul 2016)
Log Message:
-----------
Minor: %prefix is not hardcoded anymore. Zoom in and out with Ctrl + and Ctrl -

Modified Paths:
--------------
    trunk/sources/diagramview.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetgraphicsitem/slaveelement.cpp
    trunk/sources/titleblockproperties.h

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/diagramview.cpp	2016-07-13 21:25:29 UTC (rev 4574)
@@ -612,6 +612,12 @@
 		case Qt::Key_ZoomIn:
 			zoom(1.15);
 			return;
+		case Qt::Key_Minus:
+			if (e->modifiers() & Qt::ControlModifier)
+				zoom(0.85);
+		case Qt::Key_Plus:
+			if (e->modifiers() & Qt::ControlModifier)
+				zoom(1.15);
 		case Qt::Key_Up:
 			if(!scene->selectedContent().elements.isEmpty()){
 				scrollOnMovement(e);

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2016-07-13 21:25:29 UTC (rev 4574)
@@ -311,12 +311,13 @@
 								//if there is a formula to assign, assign it
 								if (!location().project()->elementAutoNumFormula().isEmpty() && this->linkType()!=Element::Slave) {
 									QString formula = location().project()->elementAutoNumFormula();
-									formula.replace("%prefix", prefix);
+									this->setPrefix(prefix);
 									dc.addValue("label", formula);
 									this->setTaggedText("label",formula);
 								} else { //assign only prefix
-									dc.addValue("label", prefix);
-									this->setTaggedText("label", prefix);
+									this->setPrefix(prefix);
+									dc.addValue("label", "%prefix");
+									this->setTaggedText("label", "%prefix");
 								}
 								this->setElementInformations(dc);
 								return;
@@ -340,7 +341,7 @@
 		QString formula = location().project()->elementAutoNumFormula();
 		DiagramContext &dc = this->rElementInformations();
 		QString prefix = this->taggedText("label")->toPlainText();
-		formula.replace("%prefix", prefix);
+		this->setPrefix(prefix);
 		dc.addValue("label", formula);
 		this->setTaggedText("label",formula);
 		this->setElementInformations(dc);

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/qetgraphicsitem/element.cpp	2016-07-13 21:25:29 UTC (rev 4574)
@@ -676,6 +676,9 @@
 	label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
 	label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1));
 	label.replace("%total", QString::number(elmt->diagram()->border_and_titleblock.folioTotal()));
+	label.replace("%prefix", elmt->getPrefix());
+	if (label.contains("%prefix"))
+		label.replace("%prefix",this->getPrefix());
 	return label;
 }
 
@@ -745,3 +748,18 @@
 	return eti;
 }
 
+/**
+ * @brief Element::getPrefix
+ * get Element Prefix
+ */
+QString Element::getPrefix() {
+	return m_prefix;
+}
+
+/**
+ * @brief Element::setPrefix
+ * set Element Prefix
+ */
+void Element::setPrefix(QString prefix) {
+	m_prefix = prefix;
+}

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/qetgraphicsitem/element.h	2016-07-13 21:25:29 UTC (rev 4574)
@@ -135,6 +135,8 @@
 																									// kind of contact (simple tempo) or number of contact show by the element.
 		QString assignVariables (QString, Element *);
 		void assignSeq ();
+		void setPrefix(QString);
+		QString getPrefix();
 
 	//ATTRIBUTES
 	protected:
@@ -196,6 +198,7 @@
 
 	private:
 		bool m_mouse_over;
+		QString m_prefix;
 
 };
 

Modified: trunk/sources/qetgraphicsitem/slaveelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/slaveelement.cpp	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/qetgraphicsitem/slaveelement.cpp	2016-07-13 21:25:29 UTC (rev 4574)
@@ -34,6 +34,7 @@
 {
 	Xref_item = nullptr;
 	link_type_ = Slave;
+	connect(this, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
 }
 
 /**
@@ -56,6 +57,7 @@
 	if (elmt->linkType() == Master && !connected_elements.contains(elmt))
 	{
 		if(!isFree()) unlinkAllElements();
+		this->disconnect();
 		connected_elements << elmt;
 
 		connect(elmt,                 SIGNAL(xChanged()),                                       this, SLOT(updateLabel()));
@@ -125,7 +127,7 @@
  */
 void SlaveElement::updateLabel() {
 
-	QString label("_");
+	QString label = this->taggedText("label")->toPlainText();
 	QString Xreflabel;
 	bool no_editable = false;
 
@@ -139,6 +141,7 @@
 		Xreflabel = assignVariables(Xreflabel, elmt);
 		label = assignVariables(label, elmt);
 	}
+	else label = assignVariables(label, this);
 
 	// set the new label
 	ElementTextItem *eti = setTaggedText("label", label, no_editable);

Modified: trunk/sources/titleblockproperties.h
===================================================================
--- trunk/sources/titleblockproperties.h	2016-07-13 14:57:27 UTC (rev 4573)
+++ trunk/sources/titleblockproperties.h	2016-07-13 21:25:29 UTC (rev 4574)
@@ -56,6 +56,7 @@
 	QString filename;         ///< Filename (displayed by the default template)
 	QString folio;            ///< Folio information (displayed by the default template)
 	QString auto_page_num;
+	QString location;
 	DateManagement useDate;   ///< Wheter to use the date attribute
 	QString template_name;    ///< Name of the template used to render the title block - an empty string means "the default template provided by the application"
 	DiagramContext context;   ///< Container for the additional, user-defined fields


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/