diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-03 14:20:01 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-04 11:12:05 +0100 |
commit | ca2f44680cb97e7a7c46ee0ab26654822fe65e2d (patch) | |
tree | b9d85ad8ec1b18a6aa56b7657812cf3791bdf72e /tests/manual | |
parent | 28a21d98ef8d880a6dd86ee19dd803424bb5eae1 (diff) | |
parent | 83188c6499ccdc87c0a2c468bb497e287f5db369 (diff) |
Merge branch 'stable' into dev
Conflicts:
examples/widgets/painting/shared/shared.pri
src/corelib/tools/qharfbuzz_p.h
src/corelib/tools/qunicodetools.cpp
src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
src/plugins/platforms/windows/qwindowsfontdatabase.cpp
Change-Id: Ibc9860abf570e5ce8b052fb88feb73ec35e64bd3
Diffstat (limited to 'tests/manual')
23 files changed, 350 insertions, 27 deletions
diff --git a/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro b/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro index a7aa675d87..9546adea1c 100644 --- a/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro +++ b/tests/manual/cocoa/qmaccocoaviewcontainer/qmaccocoaviewcontainer.pro @@ -1,6 +1,5 @@ TEMPLATE = app TARGET = qmaccocoaviewcontainer -DEPENDPATH += . INCLUDEPATH += . QT += widgets LIBS += -framework Cocoa diff --git a/tests/manual/cocoa/wheelevent/wheelevent.pro b/tests/manual/cocoa/wheelevent/wheelevent.pro index cf32954750..f90302da95 100644 --- a/tests/manual/cocoa/wheelevent/wheelevent.pro +++ b/tests/manual/cocoa/wheelevent/wheelevent.pro @@ -3,5 +3,5 @@ TEMPLATE = app HEADERS += window.h SOURCES += window.cpp main.cpp -QT += core gui gui-private core-private +QT += core core-private gui gui-private widgets DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/manual/cocoa/wheelevent/window.cpp b/tests/manual/cocoa/wheelevent/window.cpp index ecf337f85b..70ce41d094 100644 --- a/tests/manual/cocoa/wheelevent/window.cpp +++ b/tests/manual/cocoa/wheelevent/window.cpp @@ -80,7 +80,6 @@ void Window::initialize() setSizeIncrement(QSize(10, 10)); setBaseSize(QSize(640, 480)); setMinimumSize(QSize(240, 160)); - setMaximumSize(QSize(800, 600)); } create(); @@ -102,6 +101,12 @@ void Window::mouseMoveEvent(QMouseEvent *event) { if (m_lastPos != QPoint(-1, -1)) { QPainter p(&m_image); + + QPen pen; + pen.setCosmetic(true); + pen.setWidth(1); + p.setPen(pen); + p.setRenderHint(QPainter::Antialiasing); p.drawLine(m_lastPos, event->pos()); m_lastPos = event->pos(); @@ -153,13 +158,16 @@ void Window::resizeEvent(QResizeEvent *) { QImage old = m_image; - //qDebug() << "Window::resizeEvent" << width << height; + qDebug() << "Window::resizeEvent" << geometry(); + + int width = qMax(geometry().width() * devicePixelRatio(), qreal(old.width())); + int height = qMax(geometry().height() * devicePixelRatio(), qreal(old.height())); - int width = qMax(geometry().width(), old.width()); - int height = qMax(geometry().height(), old.height()); + qDebug() << "Window::resizeEvent" << width << height; if (width > old.width() || height > old.height()) { m_image = QImage(width, height, QImage::Format_RGB32); + m_image.setDevicePixelRatio(devicePixelRatio()); m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); QPainter p(&m_image); @@ -221,6 +229,12 @@ void Window::render() // draw grid: int gridSpace = 80; + QPen pen; + pen.setCosmetic(true); + pen.setWidth(1); + p.setPen(pen); + + for (int y = 0; y < geometry().height() + gridSpace; y+= gridSpace) { int offset = scrollOffset.y() % gridSpace; //int color = ((y + offset) %255);// + scrollOffset.y()) % 255); @@ -229,6 +243,7 @@ void Window::render() //p.fillRect(0, y + offset, geometry().width(), gridSpace,QColor(color,0, 0)); } + for (int x = 0; x < geometry().width() + gridSpace; x+= gridSpace) { p.drawLine(x + scrollOffset.x() % gridSpace, 0, x + scrollOffset.x() % gridSpace, geometry().height()); } diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 4da3d6ee42..f33c27f502 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -105,9 +105,9 @@ inline void setComboBoxValue(QComboBox *c, int v) c->setCurrentIndex(c->findData(QVariant(v))); } -static inline void addButton(const QString &desription, QBoxLayout *layout, QObject *receiver, const char *slotFunc) +static inline void addButton(const QString &description, QBoxLayout *layout, QObject *receiver, const char *slotFunc) { - QPushButton *button = new QPushButton(desription); + QPushButton *button = new QPushButton(description); QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc); layout->addWidget(button); } diff --git a/tests/manual/filetest/filetest.pro b/tests/manual/filetest/filetest.pro new file mode 100644 index 0000000000..5d2ba9b82b --- /dev/null +++ b/tests/manual/filetest/filetest.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +QT = core +CONFIG += console +CONFIG -= app_bundle + +SOURCES += main.cpp diff --git a/tests/manual/filetest/main.cpp b/tests/manual/filetest/main.cpp new file mode 100644 index 0000000000..857d6c05a3 --- /dev/null +++ b/tests/manual/filetest/main.cpp @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QCoreApplication> +#include <QFileInfo> +#include <QFile> +#include <QDir> + +#include <iostream> + +static const char usage1[] = +"\nTests various file functionality in Qt\n\n" +"Usage: "; +static const char usage2[] =" [KEYWORD] [ARGUMENTS]\n\n" +"Keywords: ls FILES list file information\n" +" mv SOURCE TARGET rename files using QFile::rename\n" +" cp SOURCE TARGET copy files using QFile::copy\n" +" rm FILE remove file using QFile::remove\n" +" rmr DIR remove directory recursively\n" +" using QDir::removeRecursively\n"; + +static int ls(int argCount, char **args) +{ + for (int i = 0 ; i < argCount; ++i) { + const QFileInfo fi(QString::fromLocal8Bit(args[i])); + std::cout << QDir::toNativeSeparators(fi.absoluteFilePath()).toStdString() << ' ' << fi.size(); + if (fi.exists()) + std::cout << " [exists]"; + if (fi.isFile()) + std::cout << " [file]"; + if (fi.isSymLink()) { + std::cout << " [symlink to " + << QDir::toNativeSeparators(fi.symLinkTarget()).toStdString() << ']'; + } + if (fi.isDir()) + std::cout << " [dir]"; + std::cout << std::endl; + } + return 0; +} + +static int mv(const char *sourceFileName, const char *targetFileName) +{ + QFile sourceFile(QString::fromLocal8Bit(sourceFileName)); + if (!sourceFile.rename(QString::fromLocal8Bit(targetFileName))) { + qWarning().nospace() << sourceFile.errorString(); + return -1; + } + return 0; +} + +static int cp(const char *sourceFileName, const char *targetFileName) +{ + QFile sourceFile(QString::fromLocal8Bit(sourceFileName)); + if (!sourceFile.copy(QString::fromLocal8Bit(targetFileName))) { + qWarning().nospace() << sourceFile.errorString(); + return -1; + } + return 0; +} + +static int rm(const char *fileName) +{ + QFile file(QString::fromLocal8Bit(fileName)); + if (!file.remove()) { + qWarning().nospace() << file.errorString(); + return -1; + } + return 0; +} + +static int rmr(const char *dirName) +{ + QDir dir(QString::fromLocal8Bit(dirName)); + if (!dir.removeRecursively()) { + qWarning().nospace() << "Failed to remove " << dir.absolutePath(); + return -1; + } + return 0; +} + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + Q_UNUSED(a) + if (argc >= 3 && !qstrcmp(argv[1], "ls")) + return ls(argc -2, argv + 2); + + if (argc == 4 && !qstrcmp(argv[1], "mv")) + return mv(argv[2], argv[3]); + + if (argc == 4 && !qstrcmp(argv[1], "cp")) + return cp(argv[2], argv[3]); + + if (argc == 3 && !qstrcmp(argv[1], "rm")) + return rm(argv[2]); + + if (argc == 3 && !qstrcmp(argv[1], "rmr")) + return rmr(argv[2]); + + std::cerr << usage1 << argv[0] << usage2; + return 0; +} diff --git a/tests/manual/highdpi/highdpi.pro b/tests/manual/highdpi/highdpi.pro index 635ba37a38..b827456f9b 100644 --- a/tests/manual/highdpi/highdpi.pro +++ b/tests/manual/highdpi/highdpi.pro @@ -1,6 +1,5 @@ TEMPLATE = app TARGET = highdpi -DEPENDPATH += . INCLUDEPATH += . QT += widgets diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro index 6d1d7fa392..177ca0e40e 100644 --- a/tests/manual/lance/lance.pro +++ b/tests/manual/lance/lance.pro @@ -13,6 +13,6 @@ SOURCES += interactivewidget.cpp \ RESOURCES += icons.qrc \ $$LANCELOT_DIR/images.qrc -contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl +qtHaveModule(opengl): QT += opengl DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h index e5e21f4b35..a95658d215 100644 --- a/tests/manual/lance/widgets.h +++ b/tests/manual/lance/widgets.h @@ -99,7 +99,7 @@ public: m_filename(file), m_view_mode(RenderView) { - QSettings settings("Trolltech", "lance"); + QSettings settings("QtProject", "lance"); for (int i=0; i<10; ++i) { QPointF suggestion(100 + i * 40, 100 + 100 * qSin(i * 3.1415 / 10.0)); m_controlPoints << settings.value("cp" + QString::number(i), suggestion).toPointF(); @@ -154,7 +154,7 @@ public: ~OnScreenWidget() { - QSettings settings("Trolltech", "lance"); + QSettings settings("QtProject", "lance"); for (int i=0; i<10; ++i) { settings.setValue("cp" + QString::number(i), m_controlPoints.at(i)); } diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index cfa812aaba..525f596d0e 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -1,6 +1,7 @@ TEMPLATE=subdirs SUBDIRS = bearerex \ +filetest \ gestures \ inputmethodhints \ keypadnavigation \ diff --git a/tests/manual/network_remote_stresstest/network_remote_stresstest.pro b/tests/manual/network_remote_stresstest/network_remote_stresstest.pro index 02836f0a5d..736747e486 100644 --- a/tests/manual/network_remote_stresstest/network_remote_stresstest.pro +++ b/tests/manual/network_remote_stresstest/network_remote_stresstest.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TARGET = tst_network_remote_stresstest QT = core core-private network network-private testlib diff --git a/tests/manual/network_stresstest/network_stresstest.pro b/tests/manual/network_stresstest/network_stresstest.pro index 15a9156597..cefb064020 100644 --- a/tests/manual/network_stresstest/network_stresstest.pro +++ b/tests/manual/network_stresstest/network_stresstest.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TARGET = tst_network_stresstest QT = core-private network-private testlib diff --git a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro index c33c87cd04..8440453cb7 100644 --- a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TEMPLATE = app TARGET = tst_qhttpnetworkconnection diff --git a/tests/manual/qmetatype/declare_metatype_noninline.cpp b/tests/manual/qmetatype/declare_metatype_noninline.cpp new file mode 100644 index 0000000000..8054daba06 --- /dev/null +++ b/tests/manual/qmetatype/declare_metatype_noninline.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "declare_metatype_noninline.h" + +Q_DECLARE_METATYPE(ToBeDeclaredMetaTypeNonInline) + +int ToBeDeclaredMetaTypeNonInline::triggerRegistration() +{ + return qMetaTypeId<ToBeDeclaredMetaTypeNonInline>(); +} diff --git a/tests/manual/qmetatype/declare_metatype_noninline.h b/tests/manual/qmetatype/declare_metatype_noninline.h new file mode 100644 index 0000000000..74244a3fcf --- /dev/null +++ b/tests/manual/qmetatype/declare_metatype_noninline.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DECLARE_METATYPE_NONINLINE_H +#define DECLARE_METATYPE_NONINLINE_H + +#include <QtCore/qmetatype.h> + +struct ToBeDeclaredMetaTypeNonInline { + static int triggerRegistration(); +}; + +#endif // DECLARE_METATYPE_NONINLINE_H + diff --git a/tests/manual/qmetatype/qmetatype.pro b/tests/manual/qmetatype/qmetatype.pro new file mode 100644 index 0000000000..a4f941e577 --- /dev/null +++ b/tests/manual/qmetatype/qmetatype.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qmetatype_expect_fail +QT = core +HEADERS = declare_metatype_noninline.h +SOURCES = tst_qmetatype.cpp declare_metatype_noninline.cpp diff --git a/tests/manual/qmetatype/tst_qmetatype.cpp b/tests/manual/qmetatype/tst_qmetatype.cpp new file mode 100644 index 0000000000..bd17ca260c --- /dev/null +++ b/tests/manual/qmetatype/tst_qmetatype.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +#include "declare_metatype_noninline.h" + +int main(int argc, char **argv) +{ + qDebug("expect no warning here"); + const int id = qRegisterMetaType<ToBeDeclaredMetaTypeNonInline>("ToBeDeclaredMetaTypeNonInline"); + qDebug("expect a qfatal now"); + const int result = ToBeDeclaredMetaTypeNonInline::triggerRegistration(); + Q_ASSERT(id == result); + qDebug("if you read this, check that a qFatal was seen, " + "otherwise the test failed."); +} diff --git a/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro b/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro index 09cf2255f2..79de15933e 100644 --- a/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro +++ b/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TEMPLATE = app TARGET = tst_qnetworkconfigurationmanager diff --git a/tests/manual/qnetworkreply/qnetworkreply.pro b/tests/manual/qnetworkreply/qnetworkreply.pro index 2897e55857..3d98ee429f 100644 --- a/tests/manual/qnetworkreply/qnetworkreply.pro +++ b/tests/manual/qnetworkreply/qnetworkreply.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TEMPLATE = app TARGET = tst_qnetworkreply diff --git a/tests/manual/qssloptions/qssloptions.pro b/tests/manual/qssloptions/qssloptions.pro index c3487aa844..d4325b0fd1 100644 --- a/tests/manual/qssloptions/qssloptions.pro +++ b/tests/manual/qssloptions/qssloptions.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TARGET = tst_qssloptions QT -= gui diff --git a/tests/manual/socketengine/socketengine.pro b/tests/manual/socketengine/socketengine.pro index d9ac4cd2ca..3da17c2d49 100644 --- a/tests/manual/socketengine/socketengine.pro +++ b/tests/manual/socketengine/socketengine.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TEMPLATE = app TARGET = tst_socketengine diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp index d8c2de6398..186203e7d8 100644 --- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp +++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp @@ -69,11 +69,17 @@ public: protected: void mouseMoveEvent(QMouseEvent *event) { + QGraphicsView::mouseMoveEvent(event); + int rightmostInView = viewport()->mapToGlobal(viewport()->geometry().topRight()).x(); int xglobal = event->globalX(); if (xglobal > rightmostInView) horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 10); - QGraphicsView::mouseMoveEvent(event); + + int bottomPos = viewport()->mapToGlobal(viewport()->geometry().bottomRight()).y(); + int yglobal = event->globalY(); + if (yglobal > bottomPos) + verticalScrollBar()->setValue(verticalScrollBar()->value() + 10); } }; @@ -82,17 +88,18 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); MyGraphicsView v; - QGraphicsScene s(0.0, 0.0, 10000.0, 100.0); + QGraphicsScene s(0.0, 0.0, 5000.0, 5000.0); v.setScene(&s); v.setInteractive(true); v.setRubberBandSelectionMode(Qt::IntersectsItemBoundingRect); s.addRect( (qreal) 0.0, 0.0, 1000.0, 50.0, QPen(),QBrush(QColor(0,0,255))); - for (int u = 0; u < 100; ++u) { - MyGraphicsItem *item = new MyGraphicsItem(); - item->setRect(QRectF(u * 100, 50.0, 50.0, 20.0)); - s.addItem(item); - } + for (int u = 0; u < 100; ++u) + for (int v = 0; v < 100; ++v) { + MyGraphicsItem *item = new MyGraphicsItem(); + item->setRect(QRectF(v * 80.0, u * 80.0, 50.0, 20.0)); + s.addItem(item); + } v.show(); app.exec(); return 0; diff --git a/tests/manual/windowgeometry/windowgeometry.pro b/tests/manual/windowgeometry/windowgeometry.pro index f339dc4d09..c0c7ef0217 100644 --- a/tests/manual/windowgeometry/windowgeometry.pro +++ b/tests/manual/windowgeometry/windowgeometry.pro @@ -1,4 +1,5 @@ QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = windowgeometry TEMPLATE = app @@ -6,5 +7,4 @@ INCLUDEPATH += ../windowflags SOURCES += $$PWD/main.cpp controllerwidget.cpp ../windowflags/controls.cpp HEADERS += controllerwidget.h ../windowflags/controls.h -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 |