Remove usages of deprecated APIs of qtbase/gui
- Replaced the usages of deprecated APIs by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
e89b2f72c7
commit
2f33e030b8
@ -140,10 +140,10 @@ void GLWidget::initializeGL()
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
|
||||
qglClearColor(qtPurple.dark());
|
||||
qglClearColor(qtPurple.darker());
|
||||
|
||||
logo = new QtLogo(this, 64);
|
||||
logo->setColor(qtGreen.dark());
|
||||
logo->setColor(qtGreen.darker());
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
@ -130,7 +130,7 @@ void GLWidget::initializeGL()
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
||||
logo = new QtLogo(this);
|
||||
logo->setColor(qtGreen.dark());
|
||||
logo->setColor(qtGreen.darker());
|
||||
}
|
||||
//! [2]
|
||||
|
||||
@ -163,7 +163,7 @@ void GLWidget::paintEvent(QPaintEvent *event)
|
||||
//! [4]
|
||||
|
||||
//! [6]
|
||||
qglClearColor(qtPurple.dark());
|
||||
qglClearColor(qtPurple.darker());
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
@ -457,7 +457,7 @@ void ArthurStyle::polish(QWidget *widget)
|
||||
|
||||
QPalette pal = widget->palette();
|
||||
if (widget->isWindow()) {
|
||||
pal.setColor(QPalette::Background, QColor(241, 241, 241));
|
||||
pal.setColor(QPalette::Window, QColor(241, 241, 241));
|
||||
widget->setPalette(pal);
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ void ArthurStyle::unpolish(QWidget *widget)
|
||||
|
||||
void ArthurStyle::polish(QPalette &palette)
|
||||
{
|
||||
palette.setColor(QPalette::Background, QColor(241, 241, 241));
|
||||
palette.setColor(QPalette::Window, QColor(241, 241, 241));
|
||||
}
|
||||
|
||||
QRect ArthurStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
|
||||
|
@ -153,7 +153,7 @@ void ArthurFrame::paintEvent(QPaintEvent *e)
|
||||
|
||||
int o = 10;
|
||||
|
||||
QBrush bg = palette().brush(QPalette::Background);
|
||||
QBrush bg = palette().brush(QPalette::Window);
|
||||
painter.fillRect(0, 0, o, o, bg);
|
||||
painter.fillRect(width() - o, 0, o, o, bg);
|
||||
painter.fillRect(0, height() - o, o, o, bg);
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// ### Qt 6: remove when the deprecated constructor is removed
|
||||
class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate
|
||||
{
|
||||
bool setPageLayout(const QPageLayout &newPageLayout) override
|
||||
|
@ -290,6 +290,7 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
|
||||
setUrlHandler(scheme, 0, 0);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
/*!
|
||||
\enum QDesktopServices::StandardLocation
|
||||
\since 4.4
|
||||
@ -344,6 +345,7 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme)
|
||||
\obsolete
|
||||
Use QStandardPaths::displayName()
|
||||
*/
|
||||
#endif
|
||||
|
||||
extern Q_CORE_EXPORT QString qt_applicationName_noFallback();
|
||||
|
||||
|
@ -1366,7 +1366,9 @@ void tst_QSettings::testVariantTypes()
|
||||
if (format >= QSettings::InvalidFormat) {
|
||||
testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QKeySequence, KeySequence);
|
||||
} else {
|
||||
testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QString, String);
|
||||
testVal("keysequence",
|
||||
QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
|
||||
QString, String);
|
||||
}
|
||||
|
||||
#undef testVal
|
||||
|
@ -2391,10 +2391,10 @@ void tst_QDataStream::setVersion()
|
||||
|
||||
if (vers == 1) {
|
||||
for (int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) {
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::Foreground)
|
||||
== inPal1.color((QPalette::ColorGroup)grp, QPalette::Foreground));
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::Background)
|
||||
== inPal1.color((QPalette::ColorGroup)grp, QPalette::Background));
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::WindowText)
|
||||
== inPal1.color((QPalette::ColorGroup)grp, QPalette::WindowText));
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::Window)
|
||||
== inPal1.color((QPalette::ColorGroup)grp, QPalette::Window));
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::Light)
|
||||
== inPal1.color((QPalette::ColorGroup)grp, QPalette::Light));
|
||||
QVERIFY(pal1.color((QPalette::ColorGroup)grp, QPalette::Dark)
|
||||
|
@ -104,18 +104,28 @@ void tst_QPixmapCache::cacheLimit()
|
||||
|
||||
void tst_QPixmapCache::setCacheLimit()
|
||||
{
|
||||
QPixmap res;
|
||||
QPixmap *p1 = new QPixmap(2, 3);
|
||||
QPixmapCache::insert("P1", *p1);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1") != 0);
|
||||
#endif
|
||||
QVERIFY(QPixmapCache::find("P1", &res));
|
||||
delete p1;
|
||||
|
||||
QPixmapCache::setCacheLimit(0);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(!QPixmapCache::find("P1"));
|
||||
#endif
|
||||
QVERIFY(!QPixmapCache::find("P1", &res));
|
||||
|
||||
p1 = new QPixmap(2, 3);
|
||||
QPixmapCache::setCacheLimit(1000);
|
||||
QPixmapCache::insert("P1", *p1);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1") != 0);
|
||||
#endif
|
||||
QVERIFY(QPixmapCache::find("P1", &res));
|
||||
|
||||
delete p1;
|
||||
|
||||
@ -200,6 +210,7 @@ void tst_QPixmapCache::find()
|
||||
QVERIFY(QPixmapCache::insert("P1", p1));
|
||||
|
||||
QPixmap p2;
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1", p2));
|
||||
QCOMPARE(p2.width(), 10);
|
||||
QCOMPARE(p2.height(), 10);
|
||||
@ -209,6 +220,12 @@ void tst_QPixmapCache::find()
|
||||
QPixmap *p3 = QPixmapCache::find("P1");
|
||||
QVERIFY(p3);
|
||||
QCOMPARE(p1, *p3);
|
||||
#endif
|
||||
|
||||
QVERIFY(QPixmapCache::find("P1", &p2));
|
||||
QCOMPARE(p2.width(), 10);
|
||||
QCOMPARE(p2.height(), 10);
|
||||
QCOMPARE(p1, p2);
|
||||
|
||||
//The int part of the API
|
||||
QPixmapCache::Key key = QPixmapCache::insert(p1);
|
||||
@ -261,6 +278,7 @@ void tst_QPixmapCache::insert()
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
for (int k = 0; k < numberOfKeys; ++k) {
|
||||
if (QPixmapCache::find(QString::number(k)))
|
||||
++num;
|
||||
@ -268,6 +286,16 @@ void tst_QPixmapCache::insert()
|
||||
|
||||
if (QPixmapCache::find("0"))
|
||||
++num;
|
||||
num = 0;
|
||||
#endif
|
||||
QPixmap res;
|
||||
for (int k = 0; k < numberOfKeys; ++k) {
|
||||
if (QPixmapCache::find(QString::number(k), &res))
|
||||
++num;
|
||||
}
|
||||
|
||||
if (QPixmapCache::find("0", &res))
|
||||
++num;
|
||||
|
||||
QVERIFY(num <= estimatedNum);
|
||||
QPixmap p3;
|
||||
@ -340,17 +368,17 @@ void tst_QPixmapCache::remove()
|
||||
p1.fill(Qt::yellow);
|
||||
|
||||
QPixmap p2;
|
||||
QVERIFY(QPixmapCache::find("red", p2));
|
||||
QVERIFY(QPixmapCache::find("red", &p2));
|
||||
QVERIFY(p1.toImage() != p2.toImage());
|
||||
QVERIFY(p1.toImage() == p1.toImage()); // sanity check
|
||||
|
||||
QPixmapCache::remove("red");
|
||||
QVERIFY(!QPixmapCache::find("red"));
|
||||
QVERIFY(!QPixmapCache::find("red", &p2));
|
||||
QPixmapCache::remove("red");
|
||||
QVERIFY(!QPixmapCache::find("red"));
|
||||
QVERIFY(!QPixmapCache::find("red", &p2));
|
||||
|
||||
QPixmapCache::remove("green");
|
||||
QVERIFY(!QPixmapCache::find("green"));
|
||||
QVERIFY(!QPixmapCache::find("green", &p2));
|
||||
|
||||
//The int part of the API
|
||||
QPixmapCache::clear();
|
||||
@ -392,7 +420,7 @@ void tst_QPixmapCache::remove()
|
||||
key = QPixmapCache::insert(p1);
|
||||
QPixmapCache::remove(key);
|
||||
QVERIFY(QPixmapCache::find(key, &p1) == 0);
|
||||
QVERIFY(QPixmapCache::find("red") != 0);
|
||||
QVERIFY(QPixmapCache::find("red", &p1) != 0);
|
||||
}
|
||||
|
||||
void tst_QPixmapCache::clear()
|
||||
@ -408,14 +436,14 @@ void tst_QPixmapCache::clear()
|
||||
const int numberOfKeys = estimatedNum + 1000;
|
||||
|
||||
for (int i = 0; i < numberOfKeys; ++i)
|
||||
QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0);
|
||||
QVERIFY(!QPixmapCache::find("x" + QString::number(i), &p1));
|
||||
|
||||
for (int j = 0; j < numberOfKeys; ++j)
|
||||
QPixmapCache::insert(QString::number(j), p1);
|
||||
|
||||
int num = 0;
|
||||
for (int k = 0; k < numberOfKeys; ++k) {
|
||||
if (QPixmapCache::find(QString::number(k), p1))
|
||||
if (QPixmapCache::find(QString::number(k), &p1))
|
||||
++num;
|
||||
}
|
||||
QVERIFY(num > 0);
|
||||
@ -423,7 +451,7 @@ void tst_QPixmapCache::clear()
|
||||
QPixmapCache::clear();
|
||||
|
||||
for (int k = 0; k < numberOfKeys; ++k)
|
||||
QVERIFY(!QPixmapCache::find(QString::number(k)));
|
||||
QVERIFY(!QPixmapCache::find(QString::number(k), &p1));
|
||||
|
||||
//The int part of the API
|
||||
QPixmap p2(10, 10);
|
||||
|
@ -68,10 +68,17 @@ void tst_QDrag::getSetCheck()
|
||||
QCOMPARE((QMimeData *)0, obj1.mimeData());
|
||||
// delete var1; // No delete, since QDrag takes ownership
|
||||
|
||||
Qt::DropAction result = obj1.start();
|
||||
Qt::DropAction result = obj1.exec();
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
result = obj1.exec(Qt::MoveAction | Qt::LinkAction);
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
result = obj1.start();
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
result = obj1.start(Qt::MoveAction | Qt::LinkAction);
|
||||
QCOMPARE(result, Qt::IgnoreAction);
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QDrag)
|
||||
|
@ -191,7 +191,7 @@ template<> struct TestValueFactory<QMetaType::QTextLength> {
|
||||
static QTextLength *create() { return new QTextLength(QTextLength::PercentageLength, 50); }
|
||||
};
|
||||
template<> struct TestValueFactory<QMetaType::QTextFormat> {
|
||||
static QTextFormat *create() { return new QTextFormat(QTextFormat::TableFormat); }
|
||||
static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); }
|
||||
};
|
||||
template<> struct TestValueFactory<QMetaType::QMatrix> {
|
||||
static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); }
|
||||
|
@ -2861,8 +2861,10 @@ void tst_QMatrixNxN::convertGeneric()
|
||||
QMatrix4x4 m4(m1);
|
||||
QVERIFY(isSame(m4, unique4x4));
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QMatrix4x4 m5 = qGenericMatrixToMatrix4x4(m1);
|
||||
QVERIFY(isSame(m5, unique4x4));
|
||||
#endif
|
||||
|
||||
static float const conv4x4[12] = {
|
||||
1.0f, 2.0f, 3.0f, 4.0f,
|
||||
@ -2874,8 +2876,10 @@ void tst_QMatrixNxN::convertGeneric()
|
||||
QMatrix4x3 m10 = m9.toGenericMatrix<4, 3>();
|
||||
QVERIFY(isSame(m10, conv4x4));
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QMatrix4x3 m11 = qGenericMatrixFromMatrix4x4<4, 3>(m9);
|
||||
QVERIFY(isSame(m11, conv4x4));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Copy of "flagBits" in qmatrix4x4.h.
|
||||
|
@ -778,7 +778,10 @@ void tst_QQuaternion::conjugate()
|
||||
QQuaternion v1(w1, x1, y1, z1);
|
||||
QQuaternion v2(w1, -x1, -y1, -z1);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
QCOMPARE(v1.conjugate(), v2);
|
||||
#endif
|
||||
QCOMPARE(v1.conjugated(), v2);
|
||||
}
|
||||
|
||||
// Test quaternion creation from an axis and an angle.
|
||||
|
@ -123,14 +123,18 @@ private slots:
|
||||
void drawPath2();
|
||||
void drawPath3();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
void drawRoundRect_data() { fillData(); }
|
||||
void drawRoundRect();
|
||||
#endif
|
||||
void drawRoundedRect_data() { fillData(); }
|
||||
void drawRoundedRect();
|
||||
|
||||
void qimageFormats_data();
|
||||
void qimageFormats();
|
||||
void textOnTransparentImage();
|
||||
|
||||
#ifndef QT_NO_WIDGETS
|
||||
#if !defined(QT_NO_WIDGETS) && QT_DEPRECATED_SINCE(5, 13)
|
||||
void initFrom();
|
||||
#endif
|
||||
|
||||
@ -679,12 +683,14 @@ static QRect getPaintedSize(const QPixmap &pm, const QColor &background)
|
||||
}
|
||||
|
||||
#ifndef QT_NO_WIDGETS
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
void tst_QPainter::initFrom()
|
||||
{
|
||||
QWidget *widget = new QWidget();
|
||||
QPalette pal = widget->palette();
|
||||
pal.setColor(QPalette::Foreground, QColor(255, 0, 0));
|
||||
pal.setBrush(QPalette::Background, QColor(0, 255, 0));
|
||||
pal.setColor(QPalette::WindowText, QColor(255, 0, 0));
|
||||
pal.setBrush(QPalette::Window, QColor(0, 255, 0));
|
||||
widget->setPalette(pal);
|
||||
widget->show();
|
||||
|
||||
@ -698,11 +704,12 @@ void tst_QPainter::initFrom()
|
||||
p.initFrom(widget);
|
||||
|
||||
QCOMPARE(p.font(), font);
|
||||
QCOMPARE(p.pen().color(), pal.color(QPalette::Foreground));
|
||||
QCOMPARE(p.pen().color(), pal.color(QPalette::WindowText));
|
||||
QCOMPARE(p.background(), pal.window());
|
||||
|
||||
delete widget;
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QPainter::drawBorderPixmap()
|
||||
{
|
||||
@ -1546,6 +1553,7 @@ void tst_QPainter::drawClippedEllipse()
|
||||
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
void tst_QPainter::drawRoundRect()
|
||||
{
|
||||
QFETCH(QRect, rect);
|
||||
@ -1580,6 +1588,42 @@ void tst_QPainter::drawRoundRect()
|
||||
QCOMPARE(painted.height(), rect.height() + increment);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QPainter::drawRoundedRect()
|
||||
{
|
||||
QFETCH(QRect, rect);
|
||||
QFETCH(bool, usePen);
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
if (QTest::currentDataTag() == QByteArray("rect(6, 12, 3, 14) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(6, 17, 3, 25) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(10, 6, 10, 3) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(10, 12, 10, 14) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(13, 45, 17, 80) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(13, 50, 17, 91) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(17, 6, 24, 3) with pen") ||
|
||||
QTest::currentDataTag() == QByteArray("rect(24, 12, 38, 14) with pen"))
|
||||
QSKIP("The Mac paint engine is off-by-one on certain rect sizes");
|
||||
#endif
|
||||
QPixmap pixmap(rect.x() + rect.width() + 10,
|
||||
rect.y() + rect.height() + 10);
|
||||
{
|
||||
pixmap.fill(Qt::white);
|
||||
QPainter p(&pixmap);
|
||||
p.setRenderHint(QPainter::Qt4CompatiblePainting);
|
||||
p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen));
|
||||
p.setBrush(Qt::black);
|
||||
p.drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
|
||||
p.end();
|
||||
|
||||
int increment = usePen ? 1 : 0;
|
||||
|
||||
const QRect painted = getPaintedSize(pixmap, Qt::white);
|
||||
QCOMPARE(painted.width(), rect.width() + increment);
|
||||
QCOMPARE(painted.height(), rect.height() + increment);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QPainter::qimageFormats_data()
|
||||
{
|
||||
@ -1662,9 +1706,13 @@ void tst_QPainter::combinedMatrix()
|
||||
|
||||
p.translate(0.5, 0.5);
|
||||
|
||||
QTransform ct = p.combinedTransform();
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QMatrix cm = p.combinedMatrix();
|
||||
QCOMPARE(cm, ct.toAffine());
|
||||
#endif
|
||||
|
||||
QPointF pt = QPointF(0, 0) * cm;
|
||||
QPointF pt = QPointF(0, 0) * ct.toAffine();
|
||||
|
||||
QCOMPARE(pt.x(), 48.0);
|
||||
QCOMPARE(pt.y(), 16.0);
|
||||
@ -1979,7 +2027,7 @@ void tst_QPainter::clippedFillPath_data()
|
||||
<< pen2;
|
||||
|
||||
path = QPainterPath();
|
||||
path.addRoundRect(QRect(15, 15, 50, 50), 20);
|
||||
path.addRoundedRect(QRect(15, 15, 50, 50), 20, Qt::RelativeSize);
|
||||
QTest::newRow("round rect 0") << QSize(100, 100) << path
|
||||
<< QRect(15, 15, 49, 49)
|
||||
<< QBrush(Qt::NoBrush)
|
||||
@ -4088,14 +4136,18 @@ void tst_QPainter::inactivePainter()
|
||||
p.setClipRegion(region);
|
||||
p.setClipping(true);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
p.combinedMatrix();
|
||||
#endif
|
||||
p.combinedTransform();
|
||||
|
||||
p.compositionMode();
|
||||
p.setCompositionMode(QPainter::CompositionMode_Plus);
|
||||
|
||||
p.device();
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
p.deviceMatrix();
|
||||
#endif
|
||||
p.deviceTransform();
|
||||
|
||||
p.font();
|
||||
@ -4119,7 +4171,9 @@ void tst_QPainter::inactivePainter()
|
||||
p.setRenderHint(QPainter::Antialiasing, true);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
p.resetMatrix();
|
||||
#endif
|
||||
p.resetTransform();
|
||||
p.rotate(1);
|
||||
p.scale(2, 2);
|
||||
@ -4135,8 +4189,10 @@ void tst_QPainter::inactivePainter()
|
||||
p.window();
|
||||
p.setWindow(QRect(10, 10, 620, 460));
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
p.worldMatrix();
|
||||
p.setWorldMatrix(QMatrix().translate(43, 21), true);
|
||||
#endif
|
||||
p.setWorldMatrixEnabled(true);
|
||||
|
||||
p.transform();
|
||||
|
@ -578,7 +578,7 @@ QPainterPath Paths::node()
|
||||
m_rect.setHeight(100);
|
||||
|
||||
QPainterPath shape;
|
||||
shape.addRoundRect(m_rect, 25);
|
||||
shape.addRoundedRect(m_rect, 25, Qt::RelativeSize);
|
||||
|
||||
const int conWidth = 10;
|
||||
const int xOffset = 7;
|
||||
|
@ -58,7 +58,9 @@ private slots:
|
||||
void insertAndRemoveSubstitutions();
|
||||
void serialize_data();
|
||||
void serialize();
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
void lastResortFont();
|
||||
#endif
|
||||
void styleName();
|
||||
void defaultFamily_data();
|
||||
void defaultFamily();
|
||||
@ -484,6 +486,7 @@ void tst_QFont::serialize()
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
// QFont::lastResortFont() may abort with qFatal() on QWS/QPA
|
||||
// if absolutely no font is found. Just as ducumented for QFont::lastResortFont().
|
||||
// This happens on our CI machines which run QWS autotests.
|
||||
@ -494,6 +497,7 @@ void tst_QFont::lastResortFont()
|
||||
QFont font;
|
||||
QVERIFY(!font.lastResortFont().isEmpty());
|
||||
}
|
||||
#endif
|
||||
|
||||
void tst_QFont::styleName()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qtexttable
|
||||
QT += testlib
|
||||
QT += testlib gui-private
|
||||
qtHaveModule(widgets): QT += widgets
|
||||
SOURCES += tst_qtexttable.cpp
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPaintEngine>
|
||||
#endif
|
||||
#include <private/qpagedpaintdevice_p.h>
|
||||
|
||||
typedef QList<int> IntList;
|
||||
|
||||
@ -91,7 +92,7 @@ private slots:
|
||||
void QTBUG11282_insertBeforeMergedEnding();
|
||||
#endif
|
||||
void QTBUG22011_insertBeforeRowSpan();
|
||||
#ifndef QT_NO_PRINTER
|
||||
#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL)
|
||||
void QTBUG31330_renderBackground();
|
||||
#endif
|
||||
|
||||
@ -1025,7 +1026,7 @@ void tst_QTextTable::QTBUG22011_insertBeforeRowSpan()
|
||||
QCOMPARE(table->columns(), 6);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_PRINTER
|
||||
#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL)
|
||||
namespace {
|
||||
class QTBUG31330_PaintDevice : public QPagedPaintDevice
|
||||
{
|
||||
@ -1065,11 +1066,46 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate
|
||||
{
|
||||
bool setPageLayout(const QPageLayout &newPageLayout) override
|
||||
{
|
||||
m_pageLayout = newPageLayout;
|
||||
return m_pageLayout.isEquivalentTo(newPageLayout);
|
||||
}
|
||||
|
||||
bool setPageSize(const QPageSize &pageSize) override
|
||||
{
|
||||
m_pageLayout.setPageSize(pageSize);
|
||||
return m_pageLayout.pageSize().isEquivalentTo(pageSize);
|
||||
}
|
||||
|
||||
bool setPageOrientation(QPageLayout::Orientation orientation) override
|
||||
{
|
||||
m_pageLayout.setOrientation(orientation);
|
||||
return m_pageLayout.orientation() == orientation;
|
||||
}
|
||||
|
||||
bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
|
||||
{
|
||||
m_pageLayout.setUnits(units);
|
||||
m_pageLayout.setMargins(margins);
|
||||
return m_pageLayout.margins() == margins && m_pageLayout.units() == units;
|
||||
}
|
||||
|
||||
QPageLayout pageLayout() const override
|
||||
{
|
||||
return m_pageLayout;
|
||||
}
|
||||
|
||||
QPageLayout m_pageLayout;
|
||||
};
|
||||
|
||||
int pages;
|
||||
QPaintEngine* engine;
|
||||
|
||||
QTBUG31330_PaintDevice(QPaintEngine* engine)
|
||||
: pages(1), engine(engine)
|
||||
: QPagedPaintDevice(new QDummyPagedPaintDevicePrivate), pages(1), engine(engine)
|
||||
{
|
||||
QPageLayout layout = pageLayout();
|
||||
layout.setUnits(QPageLayout::Point);
|
||||
|
@ -39,7 +39,9 @@ class tst_qdesktopservices : public QObject
|
||||
private slots:
|
||||
void openUrl();
|
||||
void handlers();
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
void testDataLocation();
|
||||
#endif
|
||||
};
|
||||
|
||||
void tst_qdesktopservices::openUrl()
|
||||
@ -89,6 +91,7 @@ void tst_qdesktopservices::handlers()
|
||||
#define Q_XDG_PLATFORM
|
||||
#endif
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
void tst_qdesktopservices::testDataLocation()
|
||||
{
|
||||
// This is the one point where QDesktopServices and QStandardPaths differ.
|
||||
@ -115,6 +118,7 @@ void tst_qdesktopservices::testDataLocation()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_qdesktopservices)
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ void PaintCommands::command_drawRoundRect(QRegularExpressionMatch re)
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
m_painter->drawRoundRect(x, y, w, h, xs, ys);
|
||||
m_painter->drawRoundedRect(x, y, w, h, xs, ys, Qt::RelativeSize);
|
||||
QT_WARNING_POP
|
||||
}
|
||||
|
||||
|
@ -2905,7 +2905,7 @@ public:
|
||||
Q_UNUSED(widget);
|
||||
qreal w = rect().width();
|
||||
QRectF box(0, 0, w, 2400/w);
|
||||
painter->drawRoundRect(box);
|
||||
painter->drawRoundedRect(box, 25, 25, Qt::RelativeSize);
|
||||
painter->drawLine(box.topLeft(), box.bottomRight());
|
||||
painter->drawLine(box.bottomLeft(), box.topRight());
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void tst_QPixmapCache::find()
|
||||
if (cacheType) {
|
||||
QBENCHMARK {
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
QPixmapCache::find(QString::asprintf("my-key-%d", i), p);
|
||||
QPixmapCache::find(QString::asprintf("my-key-%d", i), &p);
|
||||
}
|
||||
} else {
|
||||
QBENCHMARK {
|
||||
@ -155,7 +155,7 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
|
||||
QPixmapCache::insert(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
|
||||
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
QPixmapCache::find(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
|
||||
QPixmapCache::find(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), &p);
|
||||
}
|
||||
} else {
|
||||
QHash<styleStruct, QPixmapCache::Key> hash;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->drawRoundRect(rect());
|
||||
painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize);
|
||||
painter->drawLine(rect().topLeft(), rect().bottomRight());
|
||||
painter->drawLine(rect().bottomLeft(), rect().topRight());
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->drawRoundRect(rect());
|
||||
painter->drawRoundedRect(rect(), 25, 25, Qt::RelativeSize);
|
||||
painter->drawLine(rect().topLeft(), rect().bottomRight());
|
||||
painter->drawLine(rect().bottomLeft(), rect().topRight());
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
|
||||
QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color;
|
||||
QColor fillColor = (option->state & QStyle::State_Selected) ? color.darker(150) : color;
|
||||
if (option->state & QStyle::State_MouseOver)
|
||||
fillColor = fillColor.light(125);
|
||||
fillColor = fillColor.lighter(125);
|
||||
|
||||
if (option->levelOfDetail < 0.2) {
|
||||
if (option->levelOfDetail < 0.125) {
|
||||
@ -82,7 +82,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
||||
|
||||
pen.setWidth(width);
|
||||
QBrush b = painter->brush();
|
||||
painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100)));
|
||||
painter->setBrush(QBrush(fillColor.darker(option->state & QStyle::State_Sunken ? 120 : 100)));
|
||||
|
||||
painter->drawRect(QRect(14, 14, 79, 39));
|
||||
painter->setBrush(b);
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->setBrush(m_brush);
|
||||
painter->drawRoundRect(rect());
|
||||
painter->drawRoundedRect(rect(), Qt::RelativeSize);
|
||||
painter->drawLine(rect().topLeft(), rect().bottomRight());
|
||||
painter->drawLine(rect().bottomLeft(), rect().topRight());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user