mirror of https://github.com/qt/qtgraphs.git
Graphs: rename textElide to textElideMode
Based on API review: Renamed the textElide property to textElideMode
to improve clarity and align with Qt naming conventions.
Task-number: QTBUG-137478
Change-Id: I5261055f686dd8b96576809ca266599a5c258fee
Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io>
(cherry picked from commit 49468e7019)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
8dcf112a20
commit
30d9763c31
|
|
@ -179,19 +179,20 @@ QT_BEGIN_NAMESPACE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QAbstractAxis::textElide
|
\property QAbstractAxis::textElideMode
|
||||||
\since 6.10
|
\since 6.10
|
||||||
\brief The textElide of the axis labels.
|
\brief Property specifies ellipsis placement for overflowing text.
|
||||||
|
|
||||||
Can be Qt::ElideLeft, Qt::ElideRight, Qt::ElideMiddle, or Qt::ElideNone.
|
Can be Qt::ElideLeft, Qt::ElideRight, Qt::ElideMiddle, or Qt::ElideNone.
|
||||||
By default, the value is \c Qt::ElideNone.
|
By default, the value is \c Qt::ElideNone.
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty enumeration AbstractAxis::textElide
|
\qmlproperty enumeration AbstractAxis::textElideMode
|
||||||
\since 6.10
|
\since 6.10
|
||||||
The textElide of the axis labels. Can be \l{Qt::ElideLeft}{Qt.ElideLeft},
|
This enum specifies ellipsis placement for overflowing text.
|
||||||
\l{Qt::ElideRight}{Qt.ElideRight}, \l{Qt::ElideMiddle}{Qt.ElideMiddle}, or
|
Can be \l{Qt::ElideLeft}{Qt.ElideLeft}, \l{Qt::ElideRight}{Qt.ElideRight},
|
||||||
\l{Qt::ElideNone}{Qt.ElideNone}. By default, the value is \c Qt.ElideNone.
|
\l{Qt::ElideMiddle}{Qt.ElideMiddle}, or \l{Qt::ElideNone}{Qt.ElideNone}.
|
||||||
|
By default, the value is \c Qt.ElideNone.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -257,8 +258,8 @@ QT_BEGIN_NAMESPACE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlsignal AbstractAxis::textElideChanged(enumeration elide)
|
\qmlsignal AbstractAxis::textElideModeChanged(enumeration elideMode)
|
||||||
This signal is emitted when the \l textElide changes. \a elide is the
|
This signal is emitted when the \l textElideMode changes. \a elideMode is the
|
||||||
new value of the \l Qt::TextElideMode type.
|
new value of the \l Qt::TextElideMode type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -594,13 +595,13 @@ void QAbstractAxis::setAlignment(Qt::Alignment alignment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::TextElideMode QAbstractAxis::textElide() const
|
Qt::TextElideMode QAbstractAxis::textElideMode() const
|
||||||
{
|
{
|
||||||
Q_D(const QAbstractAxis);
|
Q_D(const QAbstractAxis);
|
||||||
return d->m_textElide;
|
return d->m_textElide;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAbstractAxis::setTextElide(Qt::TextElideMode elide)
|
void QAbstractAxis::setTextElideMode(Qt::TextElideMode elide)
|
||||||
{
|
{
|
||||||
Q_D(QAbstractAxis);
|
Q_D(QAbstractAxis);
|
||||||
if (d->m_textElide == elide) {
|
if (d->m_textElide == elide) {
|
||||||
|
|
@ -610,7 +611,7 @@ void QAbstractAxis::setTextElide(Qt::TextElideMode elide)
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_textElide = elide;
|
d->m_textElide = elide;
|
||||||
Q_EMIT textElideChanged(d->m_textElide);
|
Q_EMIT textElideModeChanged(d->m_textElide);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ class Q_GRAPHS_EXPORT QAbstractAxis : public QObject
|
||||||
//alignment
|
//alignment
|
||||||
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY
|
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY
|
||||||
alignmentChanged REVISION(6, 9))
|
alignmentChanged REVISION(6, 9))
|
||||||
Q_PROPERTY(Qt::TextElideMode textElide READ textElide WRITE setTextElide NOTIFY textElideChanged
|
Q_PROPERTY(Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode NOTIFY
|
||||||
REVISION(6, 10))
|
textElideModeChanged REVISION(6, 10))
|
||||||
|
|
||||||
QML_FOREIGN(QAbstractAxis)
|
QML_FOREIGN(QAbstractAxis)
|
||||||
QML_UNCREATABLE("")
|
QML_UNCREATABLE("")
|
||||||
|
|
@ -109,8 +109,8 @@ public:
|
||||||
Qt::Alignment alignment() const;
|
Qt::Alignment alignment() const;
|
||||||
void setAlignment(Qt::Alignment alignment);
|
void setAlignment(Qt::Alignment alignment);
|
||||||
|
|
||||||
Qt::TextElideMode textElide() const;
|
Qt::TextElideMode textElideMode() const;
|
||||||
void setTextElide(Qt::TextElideMode elide);
|
void setTextElideMode(Qt::TextElideMode elideMode);
|
||||||
|
|
||||||
//range handling
|
//range handling
|
||||||
void setMin(const QVariant &min);
|
void setMin(const QVariant &min);
|
||||||
|
|
@ -130,7 +130,7 @@ Q_SIGNALS:
|
||||||
void titleVisibleChanged(bool visible);
|
void titleVisibleChanged(bool visible);
|
||||||
void titleFontChanged(const QFont &font);
|
void titleFontChanged(const QFont &font);
|
||||||
Q_REVISION(6, 9) void alignmentChanged(Qt::Alignment alignment);
|
Q_REVISION(6, 9) void alignmentChanged(Qt::Alignment alignment);
|
||||||
Q_REVISION(6, 10) void textElideChanged(Qt::TextElideMode elide);
|
Q_REVISION(6, 10) void textElideModeChanged(Qt::TextElideMode elideMode);
|
||||||
void update();
|
void update();
|
||||||
void rangeChanged(qreal min, qreal max);
|
void rangeChanged(qreal min, qreal max);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1212,12 +1212,12 @@ void AxisRenderer::updateBarXAxisLabels(AxisProperties &ax, const QRectF rect)
|
||||||
setLabelTextProperties(textItem, category, true,
|
setLabelTextProperties(textItem, category, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignBottom,
|
QQuickText::VAlignment::AlignBottom,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, category, true,
|
setLabelTextProperties(textItem, category, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignTop,
|
QQuickText::VAlignment::AlignTop,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(rect.height());
|
textItem->setHeight(rect.height());
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
@ -1254,12 +1254,12 @@ void AxisRenderer::updateBarYAxisLabels(AxisProperties &ax, const QRectF rect)
|
||||||
setLabelTextProperties(textItem, category, false,
|
setLabelTextProperties(textItem, category, false,
|
||||||
QQuickText::HAlignment::AlignLeft,
|
QQuickText::HAlignment::AlignLeft,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, category, false,
|
setLabelTextProperties(textItem, category, false,
|
||||||
QQuickText::HAlignment::AlignRight,
|
QQuickText::HAlignment::AlignRight,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(rect.height() / categoriesCount);
|
textItem->setHeight(rect.height() / categoriesCount);
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
@ -1325,12 +1325,12 @@ void AxisRenderer::updateValueYAxisLabels(AxisProperties &ax, const QRectF rect)
|
||||||
setLabelTextProperties(textItem, label, false,
|
setLabelTextProperties(textItem, label, false,
|
||||||
QQuickText::HAlignment::AlignLeft,
|
QQuickText::HAlignment::AlignLeft,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, label, false,
|
setLabelTextProperties(textItem, label, false,
|
||||||
QQuickText::HAlignment::AlignRight,
|
QQuickText::HAlignment::AlignRight,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(0);
|
textItem->setHeight(0);
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
@ -1397,12 +1397,12 @@ void AxisRenderer::updateValueXAxisLabels(AxisProperties &ax, const QRectF rect)
|
||||||
setLabelTextProperties(textItem, label, true,
|
setLabelTextProperties(textItem, label, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignBottom,
|
QQuickText::VAlignment::AlignBottom,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, label, true,
|
setLabelTextProperties(textItem, label, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignTop,
|
QQuickText::VAlignment::AlignTop,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(rect.height());
|
textItem->setHeight(rect.height());
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
@ -1450,12 +1450,12 @@ void AxisRenderer::updateDateTimeYAxisLabels(AxisProperties &ax, const QRectF re
|
||||||
setLabelTextProperties(textItem, label, false,
|
setLabelTextProperties(textItem, label, false,
|
||||||
QQuickText::HAlignment::AlignLeft,
|
QQuickText::HAlignment::AlignLeft,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, label, false,
|
setLabelTextProperties(textItem, label, false,
|
||||||
QQuickText::HAlignment::AlignRight,
|
QQuickText::HAlignment::AlignRight,
|
||||||
QQuickText::VAlignment::AlignVCenter,
|
QQuickText::VAlignment::AlignVCenter,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(0);
|
textItem->setHeight(0);
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
@ -1504,12 +1504,12 @@ void AxisRenderer::updateDateTimeXAxisLabels(AxisProperties &ax, const QRectF re
|
||||||
setLabelTextProperties(textItem, label, true,
|
setLabelTextProperties(textItem, label, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignBottom,
|
QQuickText::VAlignment::AlignBottom,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
} else {
|
} else {
|
||||||
setLabelTextProperties(textItem, label, true,
|
setLabelTextProperties(textItem, label, true,
|
||||||
QQuickText::HAlignment::AlignHCenter,
|
QQuickText::HAlignment::AlignHCenter,
|
||||||
QQuickText::VAlignment::AlignTop,
|
QQuickText::VAlignment::AlignTop,
|
||||||
axis->textElide());
|
axis->textElideMode());
|
||||||
}
|
}
|
||||||
textItem->setHeight(rect.height());
|
textItem->setHeight(rect.height());
|
||||||
textItem->setVisible(true);
|
textItem->setVisible(true);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ void tst_abstractaxis::initialProperties()
|
||||||
QCOMPARE(m_axis->isTitleVisible(), true);
|
QCOMPARE(m_axis->isTitleVisible(), true);
|
||||||
QCOMPARE(m_axis->titleFont(), QFont());
|
QCOMPARE(m_axis->titleFont(), QFont());
|
||||||
QCOMPARE(m_axis->alignment(), Qt::AlignAbsolute);
|
QCOMPARE(m_axis->alignment(), Qt::AlignAbsolute);
|
||||||
QCOMPARE(m_axis->textElide(), Qt::ElideNone);
|
QCOMPARE(m_axis->textElideMode(), Qt::ElideNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_abstractaxis::initializeProperties()
|
void tst_abstractaxis::initializeProperties()
|
||||||
|
|
@ -74,7 +74,7 @@ void tst_abstractaxis::initializeProperties()
|
||||||
QSignalSpy spy9(m_axis, &QAbstractAxis::titleVisibleChanged);
|
QSignalSpy spy9(m_axis, &QAbstractAxis::titleVisibleChanged);
|
||||||
QSignalSpy spy10(m_axis, &QAbstractAxis::titleFontChanged);
|
QSignalSpy spy10(m_axis, &QAbstractAxis::titleFontChanged);
|
||||||
QSignalSpy spy11(m_axis, &QAbstractAxis::alignmentChanged);
|
QSignalSpy spy11(m_axis, &QAbstractAxis::alignmentChanged);
|
||||||
QSignalSpy spy12(m_axis, &QAbstractAxis::textElideChanged);
|
QSignalSpy spy12(m_axis, &QAbstractAxis::textElideModeChanged);
|
||||||
|
|
||||||
auto font = QFont("Arial", 20, 2, true);
|
auto font = QFont("Arial", 20, 2, true);
|
||||||
auto labelDelegate = new QQmlComponent(this);
|
auto labelDelegate = new QQmlComponent(this);
|
||||||
|
|
@ -91,7 +91,7 @@ void tst_abstractaxis::initializeProperties()
|
||||||
m_axis->setTitleVisible(false);
|
m_axis->setTitleVisible(false);
|
||||||
m_axis->setTitleFont(font);
|
m_axis->setTitleFont(font);
|
||||||
m_axis->setAlignment(Qt::AlignTop);
|
m_axis->setAlignment(Qt::AlignTop);
|
||||||
m_axis->setTextElide(Qt::ElideRight);
|
m_axis->setTextElideMode(Qt::ElideRight);
|
||||||
|
|
||||||
QCOMPARE(m_axis->isVisible(), false);
|
QCOMPARE(m_axis->isVisible(), false);
|
||||||
QCOMPARE(m_axis->isLineVisible(), false);
|
QCOMPARE(m_axis->isLineVisible(), false);
|
||||||
|
|
@ -105,7 +105,7 @@ void tst_abstractaxis::initializeProperties()
|
||||||
QCOMPARE(m_axis->isTitleVisible(), false);
|
QCOMPARE(m_axis->isTitleVisible(), false);
|
||||||
QCOMPARE(m_axis->titleFont(), font);
|
QCOMPARE(m_axis->titleFont(), font);
|
||||||
QCOMPARE(m_axis->alignment(), Qt::AlignTop);
|
QCOMPARE(m_axis->alignment(), Qt::AlignTop);
|
||||||
QCOMPARE(m_axis->textElide(), Qt::ElideRight);
|
QCOMPARE(m_axis->textElideMode(), Qt::ElideRight);
|
||||||
|
|
||||||
QCOMPARE(spy0.size(), 1);
|
QCOMPARE(spy0.size(), 1);
|
||||||
QCOMPARE(spy1.size(), 1);
|
QCOMPARE(spy1.size(), 1);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ Item {
|
||||||
titleText: "Initialized"
|
titleText: "Initialized"
|
||||||
titleVisible: false
|
titleVisible: false
|
||||||
visible: false
|
visible: false
|
||||||
textElide: Qt.ElideLeft
|
textElideMode: Qt.ElideLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCase {
|
TestCase {
|
||||||
|
|
@ -65,7 +65,7 @@ Item {
|
||||||
compare(initial.titleText, "")
|
compare(initial.titleText, "")
|
||||||
compare(initial.titleVisible, true)
|
compare(initial.titleVisible, true)
|
||||||
compare(initial.visible, true)
|
compare(initial.visible, true)
|
||||||
compare(initial.textElide, Qt.ElideNone)
|
compare(initial.textElideMode, Qt.ElideNone)
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_3_initial_change() {
|
function test_3_initial_change() {
|
||||||
|
|
@ -87,7 +87,7 @@ Item {
|
||||||
initial.titleText = "Dummy"
|
initial.titleText = "Dummy"
|
||||||
initial.titleVisible = false
|
initial.titleVisible = false
|
||||||
initial.visible = false
|
initial.visible = false
|
||||||
initial.textElide = Qt.ElideRight
|
initial.textElideMode = Qt.ElideRight
|
||||||
|
|
||||||
// Properties from BarCategoryAxis
|
// Properties from BarCategoryAxis
|
||||||
compare(initial.categories, ["one", "two"])
|
compare(initial.categories, ["one", "two"])
|
||||||
|
|
@ -107,7 +107,7 @@ Item {
|
||||||
compare(initial.titleText, "Dummy")
|
compare(initial.titleText, "Dummy")
|
||||||
compare(initial.titleVisible, false)
|
compare(initial.titleVisible, false)
|
||||||
compare(initial.visible, false)
|
compare(initial.visible, false)
|
||||||
compare(initial.textElide, Qt.ElideRight)
|
compare(initial.textElideMode, Qt.ElideRight)
|
||||||
}
|
}
|
||||||
function test_4_initial_modify() {
|
function test_4_initial_modify() {
|
||||||
initial.clear()
|
initial.clear()
|
||||||
|
|
@ -160,7 +160,7 @@ Item {
|
||||||
compare(initialized.titleText, "Initialized")
|
compare(initialized.titleText, "Initialized")
|
||||||
compare(initialized.titleVisible, false)
|
compare(initialized.titleVisible, false)
|
||||||
compare(initialized.visible, false)
|
compare(initialized.visible, false)
|
||||||
compare(initialized.textElide, Qt.ElideLeft)
|
compare(initialized.textElideMode, Qt.ElideLeft)
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_2_initialized_change() {
|
function test_2_initialized_change() {
|
||||||
|
|
@ -180,7 +180,7 @@ Item {
|
||||||
initialized.titleText = "Dummy"
|
initialized.titleText = "Dummy"
|
||||||
initialized.titleVisible = true
|
initialized.titleVisible = true
|
||||||
initialized.visible = true
|
initialized.visible = true
|
||||||
initialized.textElide = Qt.ElideMiddle
|
initialized.textElideMode = Qt.ElideMiddle
|
||||||
|
|
||||||
// Properties from BarCategoryAxis
|
// Properties from BarCategoryAxis
|
||||||
compare(initialized.categories, ["one", "two"])
|
compare(initialized.categories, ["one", "two"])
|
||||||
|
|
@ -200,7 +200,7 @@ Item {
|
||||||
compare(initialized.titleText, "Dummy")
|
compare(initialized.titleText, "Dummy")
|
||||||
compare(initialized.titleVisible, true)
|
compare(initialized.titleVisible, true)
|
||||||
compare(initialized.visible, true)
|
compare(initialized.visible, true)
|
||||||
compare(initialized.textElide, Qt.ElideMiddle)
|
compare(initialized.textElideMode, Qt.ElideMiddle)
|
||||||
|
|
||||||
// Signals
|
// Signals
|
||||||
compare(countSpy.count, 1)
|
compare(countSpy.count, 1)
|
||||||
|
|
@ -220,7 +220,7 @@ Item {
|
||||||
compare(titleColorSpy.count, 1)
|
compare(titleColorSpy.count, 1)
|
||||||
compare(titleVisibleSpy.count, 1)
|
compare(titleVisibleSpy.count, 1)
|
||||||
compare(alignmentSpy.count, 0)
|
compare(alignmentSpy.count, 0)
|
||||||
compare(textElideSpy.count, 1)
|
compare(textElideModeSpy.count, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_3_initialized_clear() {
|
function test_3_initialized_clear() {
|
||||||
|
|
@ -389,8 +389,8 @@ Item {
|
||||||
signalName: "alignmentChanged"
|
signalName: "alignmentChanged"
|
||||||
}
|
}
|
||||||
SignalSpy {
|
SignalSpy {
|
||||||
id: textElideSpy
|
id: textElideModeSpy
|
||||||
target: initialized
|
target: initialized
|
||||||
signalName: "textElideChanged"
|
signalName: "textElideModeChanged"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue