Avoid initializing QFlags with 0 or nullptr in tests
Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Change-Id: Ib5d17611e43e7ab2c63c7f0587f549377f262e32 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
c54b1d273f
commit
d556d7a6b8
@ -528,7 +528,7 @@ void tst_QDir::removeRecursivelyFailure()
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile dirAsFile(path); // yay, I have to use QFile to change a dir's permissions...
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions
|
||||
QVERIFY(dirAsFile.setPermissions({})); // no permissions
|
||||
|
||||
QVERIFY(!QDir().rmdir(path));
|
||||
QDir dir(path);
|
||||
|
@ -236,7 +236,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
QTest::addColumn<QStringList>("entries");
|
||||
|
||||
QTest::newRow("no flags")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/.,"
|
||||
@ -252,7 +252,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/..,"
|
||||
@ -267,7 +267,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDotDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/.,"
|
||||
@ -282,7 +282,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDotAndDotDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDotAndDotDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/file,"
|
||||
@ -335,12 +335,12 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("empty, default")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("empty") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString("empty/.,empty/..").split(',');
|
||||
|
||||
QTest::newRow("empty, QDir::NoDotAndDotDot")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("empty") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoDotAndDotDot) << QStringList("*")
|
||||
<< QStringList();
|
||||
}
|
||||
@ -399,13 +399,13 @@ void tst_QDirIterator::iterateResource_data()
|
||||
QTest::addColumn<QStringList>("nameFilters");
|
||||
QTest::addColumn<QStringList>("entries");
|
||||
|
||||
QTest::newRow("invalid") << QString::fromLatin1(":/testdata/burpaburpa") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow("invalid") << QString::fromLatin1(":/testdata/burpaburpa") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QStringList();
|
||||
QTest::newRow(":/testdata") << QString::fromLatin1(":/testdata/") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow(":/testdata") << QString::fromLatin1(":/testdata/") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QString::fromLatin1(":/testdata/entrylist").split(QLatin1String(","));
|
||||
QTest::newRow(":/testdata/entrylist") << QString::fromLatin1(":/testdata/entrylist") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow(":/testdata/entrylist") << QString::fromLatin1(":/testdata/entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QString::fromLatin1(":/testdata/entrylist/directory,:/testdata/entrylist/file").split(QLatin1String(","));
|
||||
QTest::newRow(":/testdata recursive") << QString::fromLatin1(":/testdata") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories)
|
||||
|
@ -444,7 +444,7 @@ void tst_QLockFile::noPermissions()
|
||||
|
||||
const QString fileName = dir.path() + "/staleLock";
|
||||
QFile dirAsFile(dir.path()); // I have to use QFile to change a dir's permissions...
|
||||
QVERIFY2(dirAsFile.setPermissions(QFile::Permissions(0)), qPrintable(dir.path())); // no permissions
|
||||
QVERIFY2(dirAsFile.setPermissions(QFile::Permissions{}), qPrintable(dir.path())); // no permissions
|
||||
PermissionRestorer permissionRestorer(dir.path());
|
||||
|
||||
QLockFile lockFile(fileName);
|
||||
|
@ -356,7 +356,7 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
|
||||
#ifdef Q_OS_UNIX
|
||||
// Make rename() fail for lack of permissions in the directory
|
||||
QFile dirAsFile(dir.path()); // yay, I have to use QFile to change a dir's permissions...
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions{})); // no permissions
|
||||
PermissionRestorer permissionRestorer(dir.path());
|
||||
#else
|
||||
// Windows: Make rename() fail for lack of permissions on an existing target file
|
||||
|
@ -136,7 +136,7 @@ void tst_QAbstractProxyModel::flags_data()
|
||||
{
|
||||
QTest::addColumn<QModelIndex>("index");
|
||||
QTest::addColumn<Qt::ItemFlags>("flags");
|
||||
QTest::newRow("null") << QModelIndex() << (Qt::ItemFlags)0;
|
||||
QTest::newRow("null") << QModelIndex() << Qt::ItemFlags{};
|
||||
}
|
||||
|
||||
// public Qt::ItemFlags flags(QModelIndex const& index) const
|
||||
|
@ -243,7 +243,7 @@ void tst_QPluginLoader::loadHints()
|
||||
QSKIP("This test requires Qt to create shared libraries.");
|
||||
#endif
|
||||
QPluginLoader loader;
|
||||
QCOMPARE(loader.loadHints(), (QLibrary::LoadHints)0); //Do not crash
|
||||
QCOMPARE(loader.loadHints(), QLibrary::LoadHints{}); //Do not crash
|
||||
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
|
||||
loader.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin
|
||||
QCOMPARE(loader.loadHints(), QLibrary::ResolveAllSymbolsHint);
|
||||
|
@ -365,22 +365,22 @@ void tst_QRegularExpression::provideRegularExpressions()
|
||||
QTest::addColumn<QRegularExpression::PatternOptions>("patternOptions");
|
||||
|
||||
QTest::newRow("emptynull01") << QString()
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("emptynull02") << QString()
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::MultilineOption);
|
||||
QTest::newRow("emptynull03") << ""
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("emptynull04") << ""
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::MultilineOption);
|
||||
|
||||
QTest::newRow("regexp01") << "a pattern"
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("regexp02") << "^a (.*) more complicated(?<P>pattern)$"
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("regexp03") << "(?:a) pAttErN"
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||
QTest::newRow("regexp04") << "a\nmultiline\npattern"
|
||||
@ -397,13 +397,13 @@ void tst_QRegularExpression::provideRegularExpressions()
|
||||
| QRegularExpression::InvertedGreedinessOption);
|
||||
|
||||
QTest::newRow("unicode01") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("unicode02") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::InvertedGreedinessOption);
|
||||
QTest::newRow("unicode03") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("unicode04") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
|
@ -1739,7 +1739,7 @@ void tst_QPainter::renderHints()
|
||||
|
||||
// Turn off all...
|
||||
p.setRenderHints(QPainter::RenderHints(0xffffffff), false);
|
||||
QCOMPARE(p.renderHints(), QPainter::RenderHints(0));
|
||||
QCOMPARE(p.renderHints(), QPainter::RenderHints{});
|
||||
|
||||
// Single set/get
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
@ -302,7 +302,7 @@ static void netChat(int port, const QList<Chat> &chat)
|
||||
if (it + 1 != chat.constEnd())
|
||||
break;
|
||||
|
||||
// fall through:
|
||||
Q_FALLTHROUGH();
|
||||
case Chat::RemoteDisconnect:
|
||||
case Chat::DiscardUntilDisconnect:
|
||||
qDebug() << i << "Waiting for remote disconnect";
|
||||
|
@ -571,14 +571,15 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
||||
dialog->close();
|
||||
fd.close();
|
||||
|
||||
QFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), 0);
|
||||
QFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), {});
|
||||
QSortFilterProxyModel *pm = new QSortFilterProxyModel;
|
||||
fd2.setProxyModel(pm);
|
||||
fd2.show();
|
||||
QSidebar *sidebar = fd2.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::qWait(250);
|
||||
//We shouldn't crash
|
||||
}
|
||||
@ -613,7 +614,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
|
||||
QVERIFY(list);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
QTest::mouseClick(list->viewport(), Qt::LeftButton,0);
|
||||
QTest::mouseClick(list->viewport(), Qt::LeftButton, {});
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Backspace);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
@ -972,7 +973,8 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
|
||||
QVERIFY(sidebar);
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
// give the background processes more time on windows mobile
|
||||
QTest::qWait(250);
|
||||
|
||||
@ -1027,7 +1029,8 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
||||
sidebar->setFocus();
|
||||
//We enter in the first bookmark
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
@ -1040,7 +1043,8 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
||||
sidebar->setFocus();
|
||||
//We enter in the second bookmark which is invalid
|
||||
sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
|
||||
//We fallback to root because the entry in the bookmark is invalid
|
||||
QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
|
||||
|
@ -190,7 +190,8 @@ void tst_QSidebar::goToUrl()
|
||||
qsidebar.show();
|
||||
|
||||
QSignalSpy spy(&qsidebar, SIGNAL(goToUrl(QUrl)));
|
||||
QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, 0, qsidebar.visualRect(qsidebar.model()->index(0, 0)).center());
|
||||
QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, {},
|
||||
qsidebar.visualRect(qsidebar.model()->index(0, 0)).center());
|
||||
#ifdef Q_OS_WINRT
|
||||
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
||||
#endif
|
||||
|
@ -237,7 +237,7 @@ void tst_QWizard::setButtonLayout()
|
||||
|
||||
QWizard wizard;
|
||||
wizard.setWizardStyle(QWizard::ClassicStyle);
|
||||
wizard.setOptions(0);
|
||||
wizard.setOptions({});
|
||||
wizard.setButtonLayout(layout);
|
||||
wizard.show();
|
||||
qApp->processEvents();
|
||||
|
@ -159,12 +159,7 @@ public:
|
||||
struct ItemDesc
|
||||
{
|
||||
ItemDesc(int row, int col)
|
||||
: m_pos(qMakePair(row, col)),
|
||||
m_rowSpan(1),
|
||||
m_colSpan(1),
|
||||
m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
|
||||
m_align(0),
|
||||
m_fnConstraint(0)
|
||||
: m_pos(qMakePair(row, col))
|
||||
{
|
||||
}
|
||||
|
||||
@ -278,17 +273,17 @@ struct ItemDesc
|
||||
|
||||
//private:
|
||||
QPair<int,int> m_pos; // row,col
|
||||
int m_rowSpan;
|
||||
int m_colSpan;
|
||||
QSizePolicy m_sizePolicy;
|
||||
int m_rowSpan = 1;
|
||||
int m_colSpan = 1;
|
||||
QSizePolicy m_sizePolicy{QSizePolicy::Preferred, QSizePolicy::Preferred};
|
||||
|
||||
// Initializer {} is a workaround for gcc bug 68949
|
||||
QSizeF m_sizeHints[Qt::NSizeHints] {};
|
||||
QSizeF m_sizes[Qt::NSizeHints] {};
|
||||
Qt::Alignment m_align;
|
||||
|
||||
Qt::Orientation m_constraintOrientation;
|
||||
QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
|
||||
Qt::Orientation m_constraintOrientation = Qt::Horizontal;
|
||||
QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &) = nullptr;
|
||||
};
|
||||
|
||||
typedef QList<ItemDesc> ItemList;
|
||||
|
@ -245,7 +245,7 @@ void tst_QGraphicsLinearLayout::alignment()
|
||||
widget->setLayout(&layout);
|
||||
|
||||
static const Qt::Alignment alignmentsToTest[] = {
|
||||
(Qt::Alignment)0,
|
||||
Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter,
|
||||
@ -253,7 +253,7 @@ void tst_QGraphicsLinearLayout::alignment()
|
||||
Qt::AlignBottom,
|
||||
Qt::AlignVCenter,
|
||||
Qt::AlignCenter,
|
||||
(Qt::Alignment)0,
|
||||
Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter,
|
||||
|
@ -81,21 +81,21 @@ Q_DECLARE_METATYPE(ScrollBarCount)
|
||||
|
||||
static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseButtonPress, point, widget->mapToGlobal(point), button, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, point, widget->mapToGlobal(point), button, {}, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
|
||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
|
||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = {})
|
||||
{
|
||||
QTest::mouseMove(widget, point);
|
||||
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
static void sendMouseRelease(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseButtonRelease, point, widget->mapToGlobal(point), button, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseButtonRelease, point, widget->mapToGlobal(point), button, {}, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ void tst_QGraphicsView::renderHints()
|
||||
QCOMPARE(view.renderHints(), QPainter::TextAntialiasing);
|
||||
view.setRenderHint(QPainter::Antialiasing);
|
||||
QCOMPARE(view.renderHints(), QPainter::TextAntialiasing | QPainter::Antialiasing);
|
||||
view.setRenderHints(0);
|
||||
view.setRenderHints({});
|
||||
QCOMPARE(view.renderHints(), 0);
|
||||
|
||||
TestItem *item = new TestItem;
|
||||
@ -380,7 +380,7 @@ void tst_QGraphicsView::alignment()
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
Qt::Alignment alignment = 0;
|
||||
Qt::Alignment alignment;
|
||||
switch (i) {
|
||||
case 0:
|
||||
alignment |= Qt::AlignLeft;
|
||||
@ -740,7 +740,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -757,7 +757,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(10, 0),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -769,7 +769,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -783,7 +783,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -805,14 +805,14 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
{
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -877,7 +877,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(100, 0),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -892,7 +892,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(100, 100),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -904,7 +904,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(100, 100),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -1009,7 +1009,8 @@ void tst_QGraphicsView::rubberBandExtendSelection()
|
||||
// now rubberband with modifier key
|
||||
{
|
||||
QPoint clickPoint = view.mapFromScene(20, 115);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, clickPoint, view.viewport()->mapToGlobal(clickPoint), Qt::LeftButton, 0, Qt::ControlModifier);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, clickPoint, view.viewport()->mapToGlobal(clickPoint),
|
||||
Qt::LeftButton, {}, Qt::ControlModifier);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
sendMouseMove(view.viewport(), view.mapFromScene(20, 300), Qt::LeftButton, Qt::LeftButton);
|
||||
@ -2162,14 +2163,14 @@ void tst_QGraphicsView::sendEvent()
|
||||
QCOMPARE(item->events.at(item->events.size() - 1), QEvent::GraphicsSceneMousePress);
|
||||
|
||||
QMouseEvent mouseMoveEvent(QEvent::MouseMove, itemPoint, view.viewport()->mapToGlobal(itemPoint),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &mouseMoveEvent);
|
||||
QCOMPARE(item->events.size(), 5);
|
||||
QCOMPARE(item->events.last(), QEvent::GraphicsSceneMouseMove);
|
||||
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, itemPoint,
|
||||
view.viewport()->mapToGlobal(itemPoint),
|
||||
Qt::LeftButton, 0, 0);
|
||||
Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &mouseReleaseEvent);
|
||||
QCOMPARE(item->events.size(), 7);
|
||||
QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease);
|
||||
@ -3283,7 +3284,7 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
|
||||
|
||||
QCOMPARE(view.mouseMoves, 0);
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
QCOMPARE(view.mouseMoves, 1);
|
||||
@ -3291,7 +3292,7 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
|
||||
QTRY_COMPARE(view.mouseMoves, 1);
|
||||
QTest::qWait(25);
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
QCOMPARE(view.mouseMoves, 2);
|
||||
@ -3337,8 +3338,8 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// Enable and do a drag
|
||||
{
|
||||
view.setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
QMouseEvent press(QEvent::MouseButtonPress, origPos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent move(QEvent::MouseMove, step1Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent press(QEvent::MouseButtonPress, origPos, Qt::LeftButton, {}, {});
|
||||
QMouseEvent move(QEvent::MouseMove, step1Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &press);
|
||||
QApplication::sendEvent(view.viewport(), &move);
|
||||
}
|
||||
@ -3346,7 +3347,7 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// unset drag and release mouse, inverse order
|
||||
{
|
||||
view.setDragMode(QGraphicsView::NoDrag);
|
||||
QMouseEvent release(QEvent::MouseButtonRelease, step1Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent release(QEvent::MouseButtonRelease, step1Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &release);
|
||||
}
|
||||
|
||||
@ -3355,7 +3356,7 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// reset drag, and move mouse without holding button down.
|
||||
{
|
||||
view.setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
QMouseEvent move(QEvent::MouseMove, step2Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent move(QEvent::MouseMove, step2Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &move);
|
||||
}
|
||||
|
||||
@ -3806,7 +3807,7 @@ void tst_QGraphicsView::mouseTracking2()
|
||||
EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove);
|
||||
QCOMPARE(spy.count(), 0);
|
||||
QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton,
|
||||
Qt::MouseButtons(Qt::NoButton), 0);
|
||||
Qt::MouseButtons(Qt::NoButton), {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
}
|
||||
|
@ -1297,7 +1297,7 @@ void tst_QTableView::moveCursorStrikesBack()
|
||||
int newRow = -1;
|
||||
int newColumn = -1;
|
||||
for (auto cursorMoveAction : cursorMoveActions) {
|
||||
QModelIndex newIndex = view.moveCursor(cursorMoveAction, nullptr);
|
||||
QModelIndex newIndex = view.moveCursor(cursorMoveAction, {});
|
||||
view.setCurrentIndex(newIndex);
|
||||
newRow = newIndex.row();
|
||||
newColumn = newIndex.column();
|
||||
|
@ -4918,7 +4918,7 @@ void tst_QTreeView::taskQTBUG_61476()
|
||||
QEvent::MouseButtonPress)
|
||||
QTRY_VERIFY(!tv.isExpanded(mi));
|
||||
|
||||
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos);
|
||||
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, {}, pos);
|
||||
QTRY_VERIFY(!tv.isExpanded(mi));
|
||||
QCOMPARE(lastTopLevel->checkState(), Qt::Checked);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ public:
|
||||
QSize minimumSize() const { return QSize(m_descr.minimumSize, 0); }
|
||||
QSize maximumSize() const { return QSize(m_descr.maximumSize, QLAYOUTSIZE_MAX); }
|
||||
Qt::Orientations expandingDirections() const
|
||||
{ return m_descr.expanding ? Qt::Horizontal : Qt::Orientations(0); }
|
||||
{ return m_descr.expanding ? Qt::Horizontal : Qt::Orientations{}; }
|
||||
void setGeometry(const QRect &r) { m_pos = r.x(); m_size = r.width();}
|
||||
QRect geometry() const { return QRect(m_pos, 0, m_size, 100); }
|
||||
bool isEmpty() const { return m_descr.empty; }
|
||||
|
@ -163,7 +163,7 @@ void tst_QLayout::smartMaxSize()
|
||||
QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::Ignored
|
||||
};
|
||||
Qt::Alignment alignments[] = { 0,
|
||||
Qt::Alignment alignments[] = { Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter
|
||||
|
@ -845,12 +845,12 @@ void tst_QWidget_window::tst_dnd_propagation()
|
||||
auto posInsideLabel = QHighDpi::toNativePixels(QPoint(60, 60), window->screen());
|
||||
|
||||
// Enter DropTarget.
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideDropTarget, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideDropTarget, supportedActions, {}, {});
|
||||
// Enter QLabel. This will propagate because default QLabel does
|
||||
// not accept the drop event in dragEnterEvent().
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideLabel, supportedActions, {}, {});
|
||||
// Drop on QLabel. DropTarget will get dropEvent(), because it accepted the event.
|
||||
QWindowSystemInterface::handleDrop(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrop(window, &mimeData, posInsideLabel, supportedActions, {}, {});
|
||||
|
||||
QGuiApplication::processEvents();
|
||||
|
||||
|
@ -1836,9 +1836,10 @@ void tst_QAbstractSlider::sliderPressedReleased()
|
||||
if (qApp->style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition))
|
||||
QSKIP("The result depends on system setting on mac");
|
||||
|
||||
QTest::mousePress(slider, Qt::LeftButton, 0, QPoint(rect.center().x() + 2, rect.center().y() + 2));
|
||||
QTest::mousePress(slider, Qt::LeftButton, {},
|
||||
QPoint(rect.center().x() + 2, rect.center().y() + 2));
|
||||
QCOMPARE(spy1.count(), expectedCount);
|
||||
QTest::mouseRelease(slider, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseRelease(slider, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(spy2.count(), expectedCount);
|
||||
|
||||
delete slider;
|
||||
|
@ -837,16 +837,16 @@ void tst_QComboBox::virtualAutocompletion()
|
||||
// well, and send a keypress & keyrelease right after each other.
|
||||
// This provokes the actual error, as there's no events in between to do
|
||||
// the text completion.
|
||||
QKeyEvent kp1(QEvent::KeyPress, Qt::Key_B, 0, "b");
|
||||
QKeyEvent kr1(QEvent::KeyRelease, Qt::Key_B, 0, "b");
|
||||
QKeyEvent kp1(QEvent::KeyPress, Qt::Key_B, {}, "b");
|
||||
QKeyEvent kr1(QEvent::KeyRelease, Qt::Key_B, {}, "b");
|
||||
QApplication::sendEvent(testWidget, &kp1);
|
||||
QApplication::sendEvent(testWidget, &kr1);
|
||||
|
||||
qApp->processEvents(); // Process events to trigger autocompletion
|
||||
QTRY_COMPARE(testWidget->currentIndex(), 1);
|
||||
|
||||
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, 0, "o");
|
||||
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, 0, "o");
|
||||
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, {}, "o");
|
||||
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, {}, "o");
|
||||
|
||||
QApplication::sendEvent(testWidget, &kp2);
|
||||
QApplication::sendEvent(testWidget, &kr2);
|
||||
@ -1722,7 +1722,7 @@ void tst_QComboBox::setCustomModelAndView()
|
||||
// why this happens.
|
||||
QTest::qWait(QApplication::doubleClickInterval());
|
||||
|
||||
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center()));
|
||||
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, {}, view->mapTo(window, subItemRect.center()));
|
||||
#ifdef Q_OS_WINRT
|
||||
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
||||
#endif
|
||||
|
@ -2303,7 +2303,7 @@ void tst_QDateTimeEdit::mousePress()
|
||||
QRect rectUp = testWidget->style()->subControlRect(QStyle::CC_SpinBox, &so, QStyle::SC_SpinBoxUp, testWidget);
|
||||
|
||||
// Send mouseClick to center of SC_SpinBoxUp
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, 0, rectUp.center());
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, {}, rectUp.center());
|
||||
QCOMPARE(testWidget->date().year(), 2005);
|
||||
}
|
||||
|
||||
@ -2916,7 +2916,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.editable = true;
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
QRect rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, testWidget);
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid = testWidget->findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(wid != 0);
|
||||
testWidget->hide();
|
||||
@ -2928,7 +2929,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.initFrom(&timeEdit);
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &timeEdit);
|
||||
QTest::mouseClick(&timeEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(&timeEdit, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid2 = timeEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(!wid2);
|
||||
timeEdit.hide();
|
||||
@ -2942,7 +2944,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.initFrom(&dateEdit);
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &dateEdit);
|
||||
QTest::mouseClick(&dateEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(&dateEdit, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid3 = dateEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(!wid3);
|
||||
dateEdit.hide();
|
||||
|
@ -98,7 +98,7 @@ void tst_QDial::sliderMoved()
|
||||
QPoint init(dial.width()/4, dial.height()/2);
|
||||
|
||||
QMouseEvent pressevent(QEvent::MouseButtonPress, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &pressevent);
|
||||
|
||||
QSignalSpy sliderspy(&dial, SIGNAL(sliderMoved(int)));
|
||||
@ -108,7 +108,7 @@ void tst_QDial::sliderMoved()
|
||||
{ //move on top of the slider
|
||||
init = QPoint(dial.width()/2, dial.height()/4);
|
||||
QMouseEvent moveevent(QEvent::MouseMove, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &moveevent);
|
||||
QCOMPARE( sliderspy.count(), 1);
|
||||
QCOMPARE( valuespy.count(), 0);
|
||||
@ -118,14 +118,14 @@ void tst_QDial::sliderMoved()
|
||||
{ //move on the right of the slider
|
||||
init = QPoint(dial.width()*3/4, dial.height()/2);
|
||||
QMouseEvent moveevent(QEvent::MouseMove, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &moveevent);
|
||||
QCOMPARE( sliderspy.count(), 2);
|
||||
QCOMPARE( valuespy.count(), 0);
|
||||
}
|
||||
|
||||
QMouseEvent releaseevent(QEvent::MouseButtonRelease, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &releaseevent);
|
||||
QCOMPARE( valuespy.count(), 1); // valuechanged signal should be called at this point
|
||||
|
||||
|
@ -163,7 +163,7 @@ void tst_QDialogButtonBox::testConstructor3_data()
|
||||
QTest::addColumn<QDialogButtonBox::StandardButtons>("buttons");
|
||||
QTest::addColumn<int>("buttonCount");
|
||||
|
||||
QTest::newRow("nothing") << int(Qt::Horizontal) << (QDialogButtonBox::StandardButtons)0 << 0;
|
||||
QTest::newRow("nothing") << int(Qt::Horizontal) << QDialogButtonBox::StandardButtons{} << 0;
|
||||
QTest::newRow("only 1") << int(Qt::Horizontal) << QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok) << 1;
|
||||
QTest::newRow("only 1.. twice") << int(Qt::Horizontal)
|
||||
<< (QDialogButtonBox::Ok | QDialogButtonBox::Ok)
|
||||
@ -199,7 +199,7 @@ void tst_QDialogButtonBox::testConstructor4_data()
|
||||
QTest::addColumn<QDialogButtonBox::StandardButtons>("buttons");
|
||||
QTest::addColumn<int>("buttonCount");
|
||||
|
||||
QTest::newRow("nothing") << (QDialogButtonBox::StandardButtons)0 << 0;
|
||||
QTest::newRow("nothing") << QDialogButtonBox::StandardButtons{} << 0;
|
||||
QTest::newRow("only 1") << QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok) << 1;
|
||||
QTest::newRow("only 1.. twice")
|
||||
<< (QDialogButtonBox::Ok | QDialogButtonBox::Ok)
|
||||
|
@ -387,7 +387,7 @@ void tst_QGroupBox::clicked()
|
||||
QStyle::SubControl(areaToHit), &testWidget);
|
||||
|
||||
if (rect.isValid())
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, {}, rect.center());
|
||||
else
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton);
|
||||
|
||||
@ -420,7 +420,7 @@ void tst_QGroupBox::toggledVsClicked()
|
||||
QRect rect = groupBox.style()->subControlRect(QStyle::CC_GroupBox, &option,
|
||||
QStyle::SC_GroupBoxCheckBox, &groupBox);
|
||||
|
||||
QTest::mouseClick(&groupBox, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&groupBox, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(toggleSpy.count(), 2);
|
||||
QVERIFY(toggleTimeStamp < clickTimeStamp);
|
||||
@ -500,11 +500,11 @@ void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleaseEvent()
|
||||
QRect rect = box.style()->subControlRect(QStyle::CC_GroupBox, &option,
|
||||
QStyle::SC_GroupBoxCheckBox, &box);
|
||||
|
||||
QTest::mouseClick(&box, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&box, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(box.isChecked(), true);
|
||||
|
||||
box.setChecked(false);
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(box.isChecked(), false);
|
||||
}
|
||||
|
||||
@ -558,19 +558,19 @@ void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents()
|
||||
// Without a checkbox, all mouse events should propagate
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
@ -586,19 +586,19 @@ void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents()
|
||||
box.setCheckable(true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mousePressed, false);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mouseReleased, false);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
|
@ -316,8 +316,8 @@ protected slots:
|
||||
|
||||
private:
|
||||
// keyClicks(..) is moved to QtTestCase
|
||||
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
|
||||
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
|
||||
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = {});
|
||||
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = {});
|
||||
bool unselectingWithLeftOrRightChangesCursorPosition();
|
||||
void addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey);
|
||||
QLineEdit *ensureTestWidget();
|
||||
@ -2280,7 +2280,7 @@ void tst_QLineEdit::deleteSelectedText()
|
||||
|
||||
edit.selectAll();
|
||||
|
||||
QTest::keyClick(&edit, Qt::Key_Delete, 0);
|
||||
QTest::keyClick(&edit, Qt::Key_Delete, {});
|
||||
QVERIFY(edit.text().isEmpty());
|
||||
|
||||
edit.setText(text);
|
||||
@ -3580,7 +3580,7 @@ void tst_QLineEdit::textMargin()
|
||||
QCOMPARE(bottom, b);
|
||||
#endif
|
||||
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, 0, mousePressPos);
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, {}, mousePressPos);
|
||||
QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition);
|
||||
}
|
||||
|
||||
@ -4492,7 +4492,7 @@ void tst_QLineEdit::clearButton()
|
||||
QTRY_COMPARE(filterModel->rowCount(), 1); // matches 'ab'
|
||||
QSignalSpy spyEdited(filterLineEdit, &QLineEdit::textEdited);
|
||||
const QPoint clearButtonCenterPos = QRect(QPoint(0, 0), clearButton->size()).center();
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, 0, clearButtonCenterPos);
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, {}, clearButtonCenterPos);
|
||||
QCOMPARE(spyEdited.count(), 1);
|
||||
QTRY_COMPARE(clearButton->cursor().shape(), filterLineEdit->cursor().shape());
|
||||
QTRY_COMPARE(filterModel->rowCount(), 3);
|
||||
@ -4537,7 +4537,7 @@ void tst_QLineEdit::clearButtonVisibleAfterSettingText_QTBUG_45518()
|
||||
QTRY_VERIFY(clearButton->opacity() > 0);
|
||||
QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor);
|
||||
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, nullptr, clearButton->rect().center());
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, {}, clearButton->rect().center());
|
||||
QTRY_COMPARE(edit.text(), QString());
|
||||
|
||||
QTRY_COMPARE(clearButton->opacity(), qreal(0));
|
||||
|
@ -67,13 +67,13 @@ public:
|
||||
}
|
||||
void timerEvent(QTimerEvent*)
|
||||
{
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), Qt::LeftButton, 0, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), Qt::LeftButton, 0, 0));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), Qt::LeftButton, {}, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), Qt::LeftButton, {}, {}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -91,8 +91,8 @@ public:
|
||||
|
||||
void timerEvent(QTimerEvent*)
|
||||
{
|
||||
qApp->postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), Qt::LeftButton, 0, 0));
|
||||
qApp->postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), Qt::LeftButton, 0, 0));
|
||||
QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), Qt::LeftButton, {}, {}));
|
||||
QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), Qt::LeftButton, {}, {}));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -331,7 +331,7 @@ void tst_QMdiArea::subWindowActivated()
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
QWidget *widget = new QWidget(workspace, 0);
|
||||
QWidget *widget = new QWidget(workspace, {});
|
||||
widget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
widget->setFocus();
|
||||
workspace->addSubWindow(widget)->show();
|
||||
|
@ -319,12 +319,12 @@ void tst_QMenu::mouseActivation()
|
||||
menu.addAction("Menu Action");
|
||||
menu.move(topLevel.geometry().topRight() + QPoint(50, 0));
|
||||
menu.show();
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300);
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.rect().center(), 300);
|
||||
QVERIFY(!menu.isVisible());
|
||||
|
||||
//context menus can always be accessed with right click except on windows
|
||||
menu.show();
|
||||
QTest::mouseClick(&menu, Qt::RightButton, 0, menu.rect().center(), 300);
|
||||
QTest::mouseClick(&menu, Qt::RightButton, {}, menu.rect().center(), 300);
|
||||
QVERIFY(!menu.isVisible());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -643,7 +643,7 @@ void tst_QMenu::tearOff()
|
||||
MenuMetrics mm(menu.data());
|
||||
const int tearOffOffset = mm.fw + mm.vmargin + mm.tearOffHeight / 2;
|
||||
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(10, tearOffOffset), 10);
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, {}, QPoint(10, tearOffOffset), 10);
|
||||
QTRY_VERIFY(menu->isTearOffMenuVisible());
|
||||
QPointer<QMenu> torn = getTornOffMenu();
|
||||
QVERIFY(torn);
|
||||
@ -723,7 +723,7 @@ void tst_QMenu::submenuTearOffDontClose()
|
||||
const QPoint submenuPos(submenuRect.topLeft() + QPoint(3, 3));
|
||||
// Move then click to avoid the submenu moves from causing it to close
|
||||
QTest::mouseMove(menu, submenuPos, 100);
|
||||
QTest::mouseClick(menu, Qt::LeftButton, 0, submenuPos, 100);
|
||||
QTest::mouseClick(menu, Qt::LeftButton, {}, submenuPos, 100);
|
||||
QVERIFY(QTest::qWaitFor([&]() { return submenu->window()->windowHandle(); }));
|
||||
QVERIFY(QTest::qWaitForWindowActive(submenu));
|
||||
// Make sure we enter the submenu frame directly on the tear-off area
|
||||
@ -888,7 +888,7 @@ void tst_QMenu::task176201_clear()
|
||||
QAction *action = menu.addAction("test");
|
||||
menu.connect(action, SIGNAL(triggered()), SLOT(clear()));
|
||||
menu.popup(QPoint());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.rect().center());
|
||||
}
|
||||
|
||||
void tst_QMenu::task250673_activeMultiColumnSubMenuPosition()
|
||||
@ -1212,13 +1212,13 @@ void tst_QMenu::click_while_dismissing_submenu()
|
||||
QVERIFY(sub.isVisible());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&sub));
|
||||
//press over the submenu entry
|
||||
QTest::mousePress(menuWindow, Qt::LeftButton, 0, menu.rect().center() + QPoint(0,2), 300);
|
||||
QTest::mousePress(menuWindow, Qt::LeftButton, {}, menu.rect().center() + QPoint(0, 2), 300);
|
||||
//move over the main action
|
||||
QTest::mouseMove(menuWindow, menu.rect().center() - QPoint(0,2));
|
||||
QVERIFY(menuHiddenSpy.wait());
|
||||
//the submenu must have been hidden for the bug to be triggered
|
||||
QVERIFY(!sub.isVisible());
|
||||
QTest::mouseRelease(menuWindow, Qt::LeftButton, 0, menu.rect().center() - QPoint(0,2), 300);
|
||||
QTest::mouseRelease(menuWindow, Qt::LeftButton, {}, menu.rect().center() - QPoint(0, 2), 300);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
}
|
||||
#endif
|
||||
@ -1476,7 +1476,7 @@ void tst_QMenu::QTBUG_56917_wideSubmenuScreenNumber()
|
||||
menu.popup(screen->geometry().center());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&menu));
|
||||
QVERIFY(menu.isVisible());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.actionGeometry(action).center());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.actionGeometry(action).center());
|
||||
QTest::qWait(100);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&submenu));
|
||||
QVERIFY(submenu.isVisible());
|
||||
@ -1688,7 +1688,7 @@ void tst_QMenu::tearOffMenuNotDisplayed()
|
||||
MenuMetrics mm(menu.data());
|
||||
const int tearOffOffset = mm.fw + mm.vmargin + mm.tearOffHeight / 2;
|
||||
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(10, tearOffOffset), 10);
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, {}, QPoint(10, tearOffOffset), 10);
|
||||
QTRY_VERIFY(menu->isTearOffMenuVisible());
|
||||
QPointer<QMenu> torn = getTornOffMenu();
|
||||
QVERIFY(torn);
|
||||
|
@ -1257,7 +1257,7 @@ void tst_QMenuBar::check_menuPosition()
|
||||
const QPoint bottomRight = mb->actionGeometry(menu.menuAction()).bottomRight() - QPoint(1, 1);
|
||||
const QPoint localPos = widgetToWindowPos(mb, bottomRight);
|
||||
const QPoint globalPos = w.mapToGlobal(localPos);
|
||||
QTest::mouseClick(w.windowHandle(), Qt::LeftButton, 0, localPos);
|
||||
QTest::mouseClick(w.windowHandle(), Qt::LeftButton, {}, localPos);
|
||||
QTRY_VERIFY(menu.isActiveWindow());
|
||||
QCOMPARE(menu.geometry().right() - 1, globalPos.x());
|
||||
menu.close();
|
||||
@ -1322,9 +1322,9 @@ void tst_QMenuBar::task256322_highlight()
|
||||
|
||||
const QPoint filePos = menuBarActionWindowPos(win.menuBar(), file);
|
||||
QWindow *window = win.windowHandle();
|
||||
QTest::mousePress(window, Qt::LeftButton, 0, filePos);
|
||||
QTest::mousePress(window, Qt::LeftButton, {}, filePos);
|
||||
QTest::mouseMove(window, filePos);
|
||||
QTest::mouseRelease(window, Qt::LeftButton, 0, filePos);
|
||||
QTest::mouseRelease(window, Qt::LeftButton, {}, filePos);
|
||||
QTRY_VERIFY(menu.isVisible());
|
||||
QVERIFY(!menu2.isVisible());
|
||||
QCOMPARE(win.menuBar()->activeAction(), file);
|
||||
@ -1495,11 +1495,11 @@ void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu
|
||||
|
||||
QWindow *window = mainWindow.windowHandle();
|
||||
QTest::mouseMove(window, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, center);
|
||||
QTRY_VERIFY(fileMenu->isVisible());
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, fileMenu->mapFromGlobal(globalPos));
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, fileMenu->mapFromGlobal(globalPos));
|
||||
QTRY_VERIFY(!fileMenu->isVisible());
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, center);
|
||||
QTRY_VERIFY(fileMenu->isVisible());
|
||||
}
|
||||
|
||||
@ -1588,12 +1588,12 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
|
||||
// they can't be windows
|
||||
QWidget hiddenParent(&mainWindow, 0);
|
||||
QWidget hiddenParent(&mainWindow, {});
|
||||
//this one is going to be moved around
|
||||
QWidget movingParent(&hiddenParent, 0);
|
||||
QWidget movingParent(&hiddenParent, {});
|
||||
|
||||
//set up the container widget
|
||||
QWidget containerWidget(&movingParent,0);
|
||||
QWidget containerWidget(&movingParent, {});
|
||||
|
||||
//set the new parent, a window
|
||||
QScopedPointer<QWidget> windowedParent;
|
||||
@ -1604,7 +1604,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(windowedParent.data()));
|
||||
|
||||
//set the "container", can't be a window
|
||||
QWidget containedWidget(&containerWidget, 0);
|
||||
QWidget containedWidget(&containerWidget, {});
|
||||
|
||||
taskQTBUG53205MenuBar = new QMenuBar(&containedWidget);
|
||||
|
||||
@ -1612,13 +1612,13 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
//now, move things around
|
||||
//from : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
//to windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
movingParent.setParent(windowedParent.data(),0);
|
||||
movingParent.setParent(windowedParent.data(), {});
|
||||
// this resets the parenting and the menu bar's window
|
||||
taskQTBUG53205MenuBar->setParent(nullptr);
|
||||
taskQTBUG53205MenuBar->setParent(&containedWidget);
|
||||
//from windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
//to : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
movingParent.setParent(&hiddenParent,0);
|
||||
movingParent.setParent(&hiddenParent, {});
|
||||
windowedParent.reset(); //make the old window invalid
|
||||
// trigger the aciton, reset the menu bar's window, this used to crash here.
|
||||
testMenus.actions[0]->trigger();
|
||||
|
@ -120,11 +120,11 @@ void tst_QScrollBar::task_209492()
|
||||
const QPoint pressPoint(verticalScrollBar->width() / 2, verticalScrollBar->height() - 10);
|
||||
const QPoint globalPressPoint = verticalScrollBar->mapToGlobal(globalPressPoint);
|
||||
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(verticalScrollBar, &mousePressEvent);
|
||||
QTest::qWait(1);
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent);
|
||||
|
||||
// Check that the action was triggered once.
|
||||
@ -189,11 +189,11 @@ void tst_QScrollBar::QTBUG_42871()
|
||||
const QPoint pressPoint(scrollBarWidget.width() / 2, scrollBarWidget.height() - 10);
|
||||
const QPoint globalPressPoint = scrollBarWidget.mapToGlobal(pressPoint);
|
||||
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(&scrollBarWidget, &mousePressEvent);
|
||||
QTest::qWait(1);
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(&scrollBarWidget, &mouseReleaseEvent);
|
||||
// Check that the action was triggered once.
|
||||
QCOMPARE(myHandler.updatesCount, 1);
|
||||
|
@ -605,7 +605,7 @@ void tst_QTabBar::changeTitleWhileDoubleClickingTab()
|
||||
QPoint tabPos = bar.tabRect(0).center();
|
||||
|
||||
for(int i=0; i < 10; i++)
|
||||
QTest::mouseDClick(&bar, Qt::LeftButton, 0, tabPos);
|
||||
QTest::mouseDClick(&bar, Qt::LeftButton, {}, tabPos);
|
||||
}
|
||||
|
||||
class Widget10052 : public QWidget
|
||||
@ -655,12 +655,12 @@ void tst_QTabBar::tabBarClicked()
|
||||
while (button <= Qt::MaxMouseButton) {
|
||||
const QPoint tabPos = tabBar.tabRect(0).center();
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
@ -668,12 +668,12 @@ void tst_QTabBar::tabBarClicked()
|
||||
|
||||
const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y());
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
|
@ -668,12 +668,12 @@ void tst_QTabWidget::tabBarClicked()
|
||||
while (button <= Qt::MaxMouseButton) {
|
||||
const QPoint tabPos = tabBar.tabRect(0).center();
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
@ -681,12 +681,12 @@ void tst_QTabWidget::tabBarClicked()
|
||||
|
||||
const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y());
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
|
@ -760,7 +760,7 @@ void tst_QTextEdit::cursorPositionChanged()
|
||||
ed->setTextCursor(cursor);
|
||||
spy.clear();
|
||||
QVERIFY(!ed->textCursor().hasSelection());
|
||||
QTest::mouseDClick(ed->viewport(), Qt::LeftButton, 0, ed->cursorRect().center());
|
||||
QTest::mouseDClick(ed->viewport(), Qt::LeftButton, {}, ed->cursorRect().center());
|
||||
QVERIFY(ed->textCursor().hasSelection());
|
||||
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
@ -551,7 +551,7 @@ void tst_QToolBar::actionGeometry()
|
||||
QToolBarExtension *extension = extensions.at(0);
|
||||
if (extension->isVisible()) {
|
||||
QRect rect0 = extension->geometry();
|
||||
QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 );
|
||||
QTest::mouseClick( extension, Qt::LeftButton, {}, rect0.center(), -1 );
|
||||
QApplication::processEvents();
|
||||
popupMenu = qobject_cast<QMenu *>(extension->menu());
|
||||
rect01 = popupMenu->actionGeometry(&action1);
|
||||
@ -873,7 +873,7 @@ void tst_QToolBar::actionTriggered()
|
||||
QToolBarExtension *extension = extensions.at(0);
|
||||
if (extension->isVisible()) {
|
||||
QRect rect0 = extension->geometry();
|
||||
QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 );
|
||||
QTest::mouseClick( extension, Qt::LeftButton, {}, rect0.center(), -1 );
|
||||
QApplication::processEvents();
|
||||
popupMenu = qobject_cast<QMenu *>(extension->menu());
|
||||
rect01 = popupMenu->actionGeometry(&action1);
|
||||
@ -914,28 +914,28 @@ void tst_QToolBar::actionTriggered()
|
||||
if (!rect01.isValid())
|
||||
QTest::mouseClick(button1, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect01.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect01.center(), -1 );
|
||||
QCOMPARE(::triggered, &action1);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect02.isValid())
|
||||
QTest::mouseClick(button2, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect02.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect02.center(), -1 );
|
||||
QCOMPARE(::triggered, &action2);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect03.isValid())
|
||||
QTest::mouseClick(button3, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect03.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect03.center(), -1 );
|
||||
QCOMPARE(::triggered, &action3);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect04.isValid())
|
||||
QTest::mouseClick(button4, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect04.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect04.center(), -1 );
|
||||
QCOMPARE(::triggered, &action4);
|
||||
}
|
||||
|
||||
|
@ -215,14 +215,14 @@ void tst_QToolButton::task176137_autoRepeatOfAction()
|
||||
|
||||
QSignalSpy spy(&action,SIGNAL(triggered()));
|
||||
QTest::mousePress (toolButton, Qt::LeftButton);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, 0, QPoint (), 2000);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 2000);
|
||||
QCOMPARE(spy.count(),1);
|
||||
|
||||
// try again with auto repeat
|
||||
toolButton->setAutoRepeat (true);
|
||||
QSignalSpy repeatSpy(&action,SIGNAL(triggered())); // new spy
|
||||
QTest::mousePress (toolButton, Qt::LeftButton);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, 0, QPoint (), 3000);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 3000);
|
||||
const qreal expected = (3000 - toolButton->autoRepeatDelay()) / toolButton->autoRepeatInterval() + 1;
|
||||
//we check that the difference is small (on some systems timers are not super accurate)
|
||||
qreal diff = (expected - repeatSpy.count()) / expected;
|
||||
@ -242,7 +242,7 @@ void tst_QToolButton::sendMouseClick()
|
||||
}
|
||||
if (!m_menu->isVisible())
|
||||
return;
|
||||
QTest::mouseClick(m_menu.data(), Qt::LeftButton, 0, QPoint(7, 7));
|
||||
QTest::mouseClick(m_menu.data(), Qt::LeftButton, {}, QPoint(7, 7));
|
||||
if (QTimer *timer = qobject_cast<QTimer *>(sender())) {
|
||||
timer->stop();
|
||||
timer->deleteLater();
|
||||
|
@ -133,7 +133,7 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
|
||||
bool ok;
|
||||
QMessageBox::StandardButtons btns = (QMessageBox::StandardButtons) btnHexText.toUInt(&ok, 16);
|
||||
box.setStandardButtons((QMessageBox::StandardButtons) btns);
|
||||
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
|
||||
if (box.standardButtons() == QMessageBox::StandardButtons())
|
||||
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
@ -198,7 +198,7 @@ void WizardOptionsControl::setWizardOptions(int options)
|
||||
class Wizard : public QWizard {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Wizard(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
|
||||
public slots:
|
||||
void changeWizardStyle(int newStyle);
|
||||
|
@ -74,7 +74,7 @@ class Window;
|
||||
|
||||
class SlowWidget : public QGraphicsWidget {
|
||||
public:
|
||||
SlowWidget(QGraphicsWidget *w = 0, Qt::WindowFlags wFlags = 0) : QGraphicsWidget(w, wFlags)
|
||||
SlowWidget(QGraphicsWidget *w = nullptr, Qt::WindowFlags wFlags = {}) : QGraphicsWidget(w, wFlags)
|
||||
{
|
||||
m_window = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user