mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-22 09:14:14 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5edd0a54b | |||
| 3a13287ba9 | |||
| 4888ae87f3 | |||
| 59344eb565 | |||
| 8985babfe7 | |||
| 29d16c3337 | |||
| 61f5e5e502 | |||
| 77bc9ed8e4 | |||
| 9b26d5dc6a | |||
| b76d8ce8a1 |
@@ -1 +0,0 @@
|
||||
*.qch filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -381,7 +381,20 @@ jobs:
|
||||
deploy-pages:
|
||||
needs: build-msi
|
||||
runs-on: ubuntu-latest
|
||||
if: always() && needs.build-msi.result == 'success'
|
||||
# Regenerate the page whenever the MSI job actually ran (success OR
|
||||
# packaging/signing failure) — not only on full success.
|
||||
# generate-page.py queries the published assets on the "nightly"
|
||||
# release itself (line 407: `gh release view nightly --json assets`),
|
||||
# so it already handles a missing MSI natively (empty MSI_NAME -> no
|
||||
# MSI button on the page). The page only needs the exe/zip already
|
||||
# published by windows-build.yml, independent of the MSI's fate.
|
||||
# Only "skipped"/"cancelled" are excluded: if build-msi never ran at
|
||||
# all (e.g. Windows Build itself failed), there is nothing new to
|
||||
# publish and regenerating the page would be pointless.
|
||||
if: >
|
||||
always() &&
|
||||
needs.build-msi.result != 'skipped' &&
|
||||
needs.build-msi.result != 'cancelled'
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
|
||||
@@ -318,7 +318,6 @@ target_include_directories(
|
||||
${QET_DIR}/sources/NameList
|
||||
${QET_DIR}/sources/NameList/ui
|
||||
${QET_DIR}/sources/utils
|
||||
${QET_DIR}/pugixml/src
|
||||
${QET_DIR}/sources/dataBase
|
||||
${QET_DIR}/sources/dataBase/ui
|
||||
${QET_DIR}/sources/factory/ui
|
||||
|
||||
@@ -507,10 +507,6 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.cpp
|
||||
${QET_DIR}/sources/PropertiesEditor/propertieseditorwidget.h
|
||||
|
||||
${QET_DIR}/pugixml/src/pugiconfig.hpp
|
||||
${QET_DIR}/pugixml/src/pugixml.cpp
|
||||
${QET_DIR}/pugixml/src/pugixml.hpp
|
||||
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.cpp
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductor.h
|
||||
${QET_DIR}/sources/qetgraphicsitem/conductortextitem.cpp
|
||||
|
||||
@@ -732,6 +732,16 @@ void DynamicElementTextItem::paint(QPainter *painter, const QStyleOptionGraphics
|
||||
{
|
||||
DiagramTextItem::paint(painter, option, widget);
|
||||
|
||||
//Only ever repositions already-existing sibling items here --
|
||||
//never adds or removes one. paint() runs while QGraphicsScene is
|
||||
//iterating its item list to draw it, and mutating that list mid
|
||||
//-iteration (which addResizeHandles()/removeResizeHandles() do,
|
||||
//through QGraphicsScene::addItem()/removeItem()) crashes. An
|
||||
//earlier version of this fix called them from here and crashed
|
||||
//qelectrotech reproducibly on deselecting a text (SIGABRT); see
|
||||
//refreshResizeHandlesVisibility() for where that now happens
|
||||
//instead -- itemChange(), Qt's own safe hook for exactly this,
|
||||
//already used below for this item's own selection.
|
||||
if (m_left_resize_handle || m_right_resize_handle)
|
||||
updateResizeHandlesPos();
|
||||
|
||||
@@ -826,10 +836,7 @@ QVariant DynamicElementTextItem::itemChange(QGraphicsItem::GraphicsItemChange ch
|
||||
}
|
||||
else if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
if (value.toBool())
|
||||
addResizeHandles();
|
||||
else
|
||||
removeResizeHandles();
|
||||
refreshResizeHandlesVisibility();
|
||||
}
|
||||
else if (change == QGraphicsItem::ItemSceneHasChanged && !scene())
|
||||
{
|
||||
@@ -878,6 +885,31 @@ bool DynamicElementTextItem::sceneEventFilter(QGraphicsItem *watched, QEvent *ev
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DynamicElementTextItem::refreshResizeHandlesVisibility
|
||||
Show the resize handles when this text is selected directly, OR when its
|
||||
parent element is -- which is what an ordinary click without Shift
|
||||
selects (DynamicElementTextItem::mousePressEvent() forwards a plain
|
||||
click to the parent, so dragging a symbol by its label moves the whole
|
||||
symbol; a pre-existing, unrelated behaviour, left untouched here).
|
||||
Without this, the handles were reachable only via Shift+click or a
|
||||
right-click's context menu, neither of which a user reaches for to
|
||||
resize a text field (qelectrotech#591, reported by @arummler).
|
||||
|
||||
Called from itemChange() -- both this item's own ItemSelectedHasChanged,
|
||||
below, and Element::itemChange() on the parent's, which calls this on
|
||||
every one of its texts. Not from paint(): see the comment there for why
|
||||
that crashed.
|
||||
*/
|
||||
void DynamicElementTextItem::refreshResizeHandlesVisibility()
|
||||
{
|
||||
const bool handles_wanted = isSelected() || (m_parent_element && m_parent_element->isSelected());
|
||||
if (handles_wanted && !m_left_resize_handle)
|
||||
addResizeHandles();
|
||||
else if (!handles_wanted && m_left_resize_handle)
|
||||
removeResizeHandles();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief DynamicElementTextItem::addResizeHandles
|
||||
Create and show the two width-resize handles (left/right edge of
|
||||
@@ -917,20 +949,32 @@ void DynamicElementTextItem::removeResizeHandles()
|
||||
|
||||
/**
|
||||
@brief DynamicElementTextItem::updateResizeHandlesPos
|
||||
Keep the two resize handles at the vertical middle of frameRect()'s left
|
||||
and right edges, in scene coordinates -- called on every paint() so it
|
||||
stays correct across every kind of change that can move this item or
|
||||
Keep the two resize handles at the vertical middle of boundingRect()'s
|
||||
left and right edges, in scene coordinates -- called on every paint() so
|
||||
it stays correct across every kind of change that can move this item or
|
||||
change its size (position, rotation, font, text, textWidth...) without
|
||||
needing a dedicated hook for each one.
|
||||
|
||||
Deliberately boundingRect(), not frameRect(): frameRect() is a tight box
|
||||
around the text's own natural (idealWidth()) size, re-centred inside
|
||||
boundingRect() -- it does not grow with textWidth(). Once a text has
|
||||
been widened, that leaves a growing gap between the tight frame and the
|
||||
dashed selection outline QGraphicsView draws at boundingRect(), which is
|
||||
the box a user actually sees and expects a resize handle to sit on
|
||||
(qelectrotech#591, reported by @arummler: "the drag elements should be
|
||||
on the border of the box"). boundingRect() reflects the full
|
||||
textWidth() (it is QGraphicsTextItem's own, driven by the document's
|
||||
laid-out size), so the handles now track the box that is visibly
|
||||
resized rather than the text glyphs inside it.
|
||||
*/
|
||||
void DynamicElementTextItem::updateResizeHandlesPos()
|
||||
{
|
||||
if (!m_left_resize_handle || !m_right_resize_handle)
|
||||
return;
|
||||
|
||||
QRectF fr = frameRect();
|
||||
m_left_resize_handle->setPos(mapToScene(QPointF(fr.left(), fr.center().y())));
|
||||
m_right_resize_handle->setPos(mapToScene(QPointF(fr.right(), fr.center().y())));
|
||||
QRectF br = boundingRect();
|
||||
m_left_resize_handle->setPos(mapToScene(QPointF(br.left(), br.center().y())));
|
||||
m_right_resize_handle->setPos(mapToScene(QPointF(br.right(), br.center().y())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1289,9 +1333,15 @@ void DynamicElementTextItem::updateLabel()
|
||||
|
||||
|
||||
if(m_text_from == ElementInfo && element) {
|
||||
setPlainText(element->actualLabel());
|
||||
QString new_label = element->actualLabel();
|
||||
if (toPlainText() != new_label) {
|
||||
setPlainText(new_label);
|
||||
}
|
||||
}
|
||||
else if (m_text_from == CompositeText) {
|
||||
// Use actualLabel() to ensure %{label} reflects the current
|
||||
// resolved label (e.g. after a folio/page-number change)
|
||||
dc.addValue(QStringLiteral("label"), element->actualLabel());
|
||||
setPlainText(autonum::AssignVariables::replaceVariable(m_composite_text, dc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,12 @@ class DynamicElementTextItem : public DiagramTextItem
|
||||
void setRotationPointCenter(bool set);
|
||||
bool rotationPointCenter() const;
|
||||
|
||||
//Called by Element::itemChange() when the PARENT's selection
|
||||
//changes, so the parent can keep each of its texts' resize
|
||||
//handles in sync with its own selection state. Public for that;
|
||||
//see the .cpp for why it exists.
|
||||
void refreshResizeHandlesVisibility();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
@@ -1664,6 +1664,31 @@ void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::itemChange
|
||||
On ItemSelectedHasChanged, tell each of this element's own dynamic texts
|
||||
to re-check whether its resize handles should be showing --
|
||||
DynamicElementTextItem::refreshResizeHandlesVisibility() shows them when
|
||||
either the text itself or its parent (this) is selected. An ordinary
|
||||
click with no Shift selects the parent, not the text
|
||||
(DynamicElementTextItem::mousePressEvent() forwards it), so without this
|
||||
a plain click on a symbol never showed the resize handles this PR adds
|
||||
to its texts (qelectrotech#591, reported by @arummler) -- only
|
||||
Shift+click or a right-click's context menu did, since those are the
|
||||
paths that leave the text itself selected.
|
||||
*/
|
||||
QVariant Element::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
const QList<DynamicElementTextItem *> texts = dynamicTextItems();
|
||||
for (DynamicElementTextItem *deti : texts) {
|
||||
deti->refreshResizeHandlesVisibility();
|
||||
}
|
||||
}
|
||||
return QetGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::setUpFormula
|
||||
Set up the formula used to create the label of this element
|
||||
|
||||
@@ -255,6 +255,7 @@ class Element : public QetGraphicsItem
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override;
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override;
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||
|
||||
protected:
|
||||
//ATTRIBUTES related to linked element
|
||||
|
||||
Reference in New Issue
Block a user