@@ -25,6 +25,7 @@ using namespace qReal::gui::editor;
2525
2626Label::Label (models::GraphicalModelAssistApi &graphicalAssistApi
2727 , models::LogicalModelAssistApi &logicalAssistApi
28+ // NOLINTNEXTLINE(modernize-pass-by-value)
2829 , const Id &elementId
2930 , const QSharedPointer<LabelProperties> &properties)
3031 : mIsStretched(false )
@@ -44,9 +45,7 @@ Label::Label(models::GraphicalModelAssistApi &graphicalAssistApi
4445 setAcceptDrops (true );
4546}
4647
47- Label::~Label ()
48- {
49- }
48+ Label::~Label () = default ;
5049
5150const LabelProperties &Label::info () const
5251{
@@ -188,7 +187,7 @@ QString Label::location() const
188187void Label::updateData (bool withUndoRedo)
189188{
190189 const QString value = toPlainText ();
191- Element * const parent = dynamic_cast <Element *>(parentItem ());
190+ auto * const parent = dynamic_cast <Element *>(parentItem ());
192191 if (!mProperties ->nameForRoleProperty ().isEmpty ()) {
193192 if (mEnumValues .isEmpty ()) {
194193 parent->setLogicalProperty (mProperties ->nameForRoleProperty ()
@@ -197,7 +196,8 @@ void Label::updateData(bool withUndoRedo)
197196 , withUndoRedo
198197 );
199198 } else {
200- const QString repoValue = mEnumValues .values ().contains (value)
199+ const auto &values = mEnumValues .values ();
200+ const QString repoValue = values.contains (value)
201201 ? mEnumValues .key (value)
202202 : (withUndoRedo ? enumText (value) : value);
203203 parent->setLogicalProperty (mProperties ->nameForRoleProperty ()
@@ -234,7 +234,8 @@ void Label::updateData(bool withUndoRedo)
234234
235235 parent->setLogicalProperty (mProperties ->binding (), mTextBeforeTextInteraction , value, withUndoRedo);
236236 } else {
237- const QString repoValue = mEnumValues .values ().contains (value)
237+ const auto &values = mEnumValues .values ();
238+ const QString repoValue = values.contains (value)
238239 ? mEnumValues .key (value)
239240 : (withUndoRedo ? enumText (value) : value);
240241 parent->setLogicalProperty (mProperties ->binding (), mTextBeforeTextInteraction , repoValue, withUndoRedo);
@@ -264,7 +265,8 @@ void Label::mousePressEvent(QGraphicsSceneMouseEvent *event)
264265{
265266 if (dynamic_cast <EdgeElement *>(parentItem ())) {
266267 // Passing event to edge because users usially want to edit its property when clicking on it.
267- QGraphicsItem::mousePressEvent (event);
268+ // NOLINTNEXTLINE(bugprone-parent-virtual-call)
269+ QGraphicsItem::mousePressEvent (event); // clazy:exclude=skipped-base-method
268270 return ;
269271 }
270272
@@ -350,12 +352,14 @@ bool Label::isReadOnly() const
350352 return mProperties ->isReadOnly ();
351353}
352354
355+ // https://qt-project.atlassian.net/browse/QTBUG-88309#icft=QTBUG-88309
356+ // TODO: Just remove this Label::contextMenuEvent override when upgrading to Qt >= 5.15.3
357+ #if QT_VERSION < QT_VERSION_CHECK(5, 15, 3)
353358void Label::contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
354359{
355- // TODO: https://qt-project.atlassian.net/browse/QTBUG-88309#icft=QTBUG-88309
356- // Just remove this Label::contextMenuEvent override when upgrading to Qt >= 5.15.3
357360 event->accept ();
358361}
362+ #endif
359363
360364void Label::focusOutEvent (QFocusEvent *event)
361365{
0 commit comments