]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/flag.cpp
Flags: Always save raw text, not display text in session setup
[pulseview.git] / pv / views / trace / flag.cpp
index b0518b646d87c493d8c13de606570f8dccf92522..c356b15bf62bba31341b0f22f8a24a2ed5813dd1 100644 (file)
@@ -57,7 +57,11 @@ bool Flag::enabled() const
        return true;
 }
 
-QString Flag::get_text() const
+/**
+ * Returns the text used to display this flag item. This is not necessarily the
+ * name that the user has given it.
+ */
+QString Flag::get_display_text() const
 {
        QString s;
 
@@ -73,6 +77,14 @@ QString Flag::get_text() const
        return s;
 }
 
+/**
+ * Returns the text of this flag item, i.e. the user-editable name.
+ */
+QString Flag::get_text() const
+{
+       return text_;
+}
+
 void Flag::set_text(const QString &text)
 {
        text_ = text;
@@ -92,7 +104,7 @@ QRectF Flag::label_rect(const QRectF &rect) const
                const float x = get_x();
 
                QFontMetrics m(QApplication::font());
-               QSize text_size = m.boundingRect(get_text()).size();
+               QSize text_size = m.boundingRect(get_display_text()).size();
 
                const QSizeF label_size(
                        text_size.width() + LabelPadding.width() * 2,