File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -208,10 +208,11 @@ void Edge::setArrowHeadPen(const QPen & pen)
208
208
void Edge::setLabelVisible (bool visible, EdgeTextEdit::VisibilityChangeReason vcr)
209
209
{
210
210
if (m_enableLabel) {
211
- const bool isEnoughSpaceForLabel = !m_label->sceneBoundingRect ().intersects (sourceNode ().sceneBoundingRect ()) && //
211
+ // Note: We need to test for scene(), because sceneBoundingRect() will crash if the item has not been added to any scene (yet).
212
+ const bool isEnoughSpaceForLabel = m_label->scene () && !m_label->sceneBoundingRect ().intersects (sourceNode ().sceneBoundingRect ()) && //
212
213
!m_label->sceneBoundingRect ().intersects (targetNode ().sceneBoundingRect ());
213
214
const bool dummyLabelTextIsShoterThanLabelText = m_dummyLabel->text ().length () < m_label->text ().length ();
214
- const bool isEnoughSpaceForDummyLabel = !m_dummyLabel->sceneBoundingRect ().intersects (sourceNode ().sceneBoundingRect ()) && //
215
+ const bool isEnoughSpaceForDummyLabel = m_dummyLabel-> scene () && !m_dummyLabel->sceneBoundingRect ().intersects (sourceNode ().sceneBoundingRect ()) && //
215
216
!m_dummyLabel->sceneBoundingRect ().intersects (targetNode ().sceneBoundingRect ());
216
217
switch (vcr) {
217
218
case EdgeTextEdit::VisibilityChangeReason::AvailableSpaceChanged: {
@@ -288,13 +289,9 @@ void Edge::setDashedLine(bool enable)
288
289
void Edge::setText (const QString & text)
289
290
{
290
291
m_edgeModel->text = text;
291
- if (!TestMode::enabled ()) {
292
- if (m_enableLabel) {
293
- m_label->setText (text);
294
- setLabelVisible (!text.isEmpty ());
295
- }
296
- } else {
297
- TestMode::logDisabledCode (" Set label text" );
292
+ if (m_enableLabel) {
293
+ m_label->setText (text);
294
+ setLabelVisible (!text.isEmpty ());
298
295
}
299
296
}
300
297
You can’t perform that action at this time.
0 commit comments