mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Minor: %prefix is not hardcoded anymore. Zoom in and out with Ctrl + and Ctrl -
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4574 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -612,6 +612,12 @@ switch(e -> key())
|
|||||||
case Qt::Key_ZoomIn:
|
case Qt::Key_ZoomIn:
|
||||||
zoom(1.15);
|
zoom(1.15);
|
||||||
return;
|
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:
|
case Qt::Key_Up:
|
||||||
if(!scene->selectedContent().elements.isEmpty()){
|
if(!scene->selectedContent().elements.isEmpty()){
|
||||||
scrollOnMovement(e);
|
scrollOnMovement(e);
|
||||||
|
|||||||
@@ -311,12 +311,13 @@ void CustomElement::parseLabels() {
|
|||||||
//if there is a formula to assign, assign it
|
//if there is a formula to assign, assign it
|
||||||
if (!location().project()->elementAutoNumFormula().isEmpty() && this->linkType()!=Element::Slave) {
|
if (!location().project()->elementAutoNumFormula().isEmpty() && this->linkType()!=Element::Slave) {
|
||||||
QString formula = location().project()->elementAutoNumFormula();
|
QString formula = location().project()->elementAutoNumFormula();
|
||||||
formula.replace("%prefix", prefix);
|
this->setPrefix(prefix);
|
||||||
dc.addValue("label", formula);
|
dc.addValue("label", formula);
|
||||||
this->setTaggedText("label",formula);
|
this->setTaggedText("label",formula);
|
||||||
} else { //assign only prefix
|
} else { //assign only prefix
|
||||||
dc.addValue("label", prefix);
|
this->setPrefix(prefix);
|
||||||
this->setTaggedText("label", prefix);
|
dc.addValue("label", "%prefix");
|
||||||
|
this->setTaggedText("label", "%prefix");
|
||||||
}
|
}
|
||||||
this->setElementInformations(dc);
|
this->setElementInformations(dc);
|
||||||
return;
|
return;
|
||||||
@@ -340,7 +341,7 @@ void CustomElement::parseLabels() {
|
|||||||
QString formula = location().project()->elementAutoNumFormula();
|
QString formula = location().project()->elementAutoNumFormula();
|
||||||
DiagramContext &dc = this->rElementInformations();
|
DiagramContext &dc = this->rElementInformations();
|
||||||
QString prefix = this->taggedText("label")->toPlainText();
|
QString prefix = this->taggedText("label")->toPlainText();
|
||||||
formula.replace("%prefix", prefix);
|
this->setPrefix(prefix);
|
||||||
dc.addValue("label", formula);
|
dc.addValue("label", formula);
|
||||||
this->setTaggedText("label",formula);
|
this->setTaggedText("label",formula);
|
||||||
this->setElementInformations(dc);
|
this->setElementInformations(dc);
|
||||||
|
|||||||
@@ -676,6 +676,9 @@ QString Element::assignVariables(QString label, Element *elmt){
|
|||||||
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
|
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
|
||||||
label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1));
|
label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1));
|
||||||
label.replace("%total", QString::number(elmt->diagram()->border_and_titleblock.folioTotal()));
|
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;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,3 +748,18 @@ ElementTextItem* Element::setTaggedText(const QString &tagg, const QString &news
|
|||||||
return eti;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ class Element : public QetGraphicsItem {
|
|||||||
// kind of contact (simple tempo) or number of contact show by the element.
|
// kind of contact (simple tempo) or number of contact show by the element.
|
||||||
QString assignVariables (QString, Element *);
|
QString assignVariables (QString, Element *);
|
||||||
void assignSeq ();
|
void assignSeq ();
|
||||||
|
void setPrefix(QString);
|
||||||
|
QString getPrefix();
|
||||||
|
|
||||||
//ATTRIBUTES
|
//ATTRIBUTES
|
||||||
protected:
|
protected:
|
||||||
@@ -196,6 +198,7 @@ class Element : public QetGraphicsItem {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_mouse_over;
|
bool m_mouse_over;
|
||||||
|
QString m_prefix;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi,
|
|||||||
{
|
{
|
||||||
Xref_item = nullptr;
|
Xref_item = nullptr;
|
||||||
link_type_ = Slave;
|
link_type_ = Slave;
|
||||||
|
connect(this, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,6 +57,7 @@ void SlaveElement::linkToElement(Element *elmt)
|
|||||||
if (elmt->linkType() == Master && !connected_elements.contains(elmt))
|
if (elmt->linkType() == Master && !connected_elements.contains(elmt))
|
||||||
{
|
{
|
||||||
if(!isFree()) unlinkAllElements();
|
if(!isFree()) unlinkAllElements();
|
||||||
|
this->disconnect();
|
||||||
connected_elements << elmt;
|
connected_elements << elmt;
|
||||||
|
|
||||||
connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
||||||
@@ -125,7 +127,7 @@ void SlaveElement::unlinkElement(Element *elmt)
|
|||||||
*/
|
*/
|
||||||
void SlaveElement::updateLabel() {
|
void SlaveElement::updateLabel() {
|
||||||
|
|
||||||
QString label("_");
|
QString label = this->taggedText("label")->toPlainText();
|
||||||
QString Xreflabel;
|
QString Xreflabel;
|
||||||
bool no_editable = false;
|
bool no_editable = false;
|
||||||
|
|
||||||
@@ -139,6 +141,7 @@ void SlaveElement::updateLabel() {
|
|||||||
Xreflabel = assignVariables(Xreflabel, elmt);
|
Xreflabel = assignVariables(Xreflabel, elmt);
|
||||||
label = assignVariables(label, elmt);
|
label = assignVariables(label, elmt);
|
||||||
}
|
}
|
||||||
|
else label = assignVariables(label, this);
|
||||||
|
|
||||||
// set the new label
|
// set the new label
|
||||||
ElementTextItem *eti = setTaggedText("label", label, no_editable);
|
ElementTextItem *eti = setTaggedText("label", label, no_editable);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class TitleBlockProperties {
|
|||||||
QString filename; ///< Filename (displayed by the default template)
|
QString filename; ///< Filename (displayed by the default template)
|
||||||
QString folio; ///< Folio information (displayed by the default template)
|
QString folio; ///< Folio information (displayed by the default template)
|
||||||
QString auto_page_num;
|
QString auto_page_num;
|
||||||
|
QString location;
|
||||||
DateManagement useDate; ///< Wheter to use the date attribute
|
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"
|
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
|
DiagramContext context; ///< Container for the additional, user-defined fields
|
||||||
|
|||||||
Reference in New Issue
Block a user