From 38be0d13830efd2d98281c645c3a60afe05ffece Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 12:05:43 +0200 Subject: Initial import from the monolithic Qt. This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12 --- tests/manual/repaint/mainwindow/main.cpp | 69 +++++++++++++ tests/manual/repaint/mainwindow/mainwindow.pro | 15 +++ tests/manual/repaint/scrollarea/main.cpp | 65 ++++++++++++ tests/manual/repaint/scrollarea/scrollarea.pro | 15 +++ tests/manual/repaint/shared/shared.h | 130 ++++++++++++++++++++++++ tests/manual/repaint/splitter/main.cpp | 58 +++++++++++ tests/manual/repaint/splitter/splitter.pro | 15 +++ tests/manual/repaint/tableview/main.cpp | 77 ++++++++++++++ tests/manual/repaint/tableview/tableview.pro | 8 ++ tests/manual/repaint/task141091/main.cpp | 63 ++++++++++++ tests/manual/repaint/task141091/task141091.pro | 12 +++ tests/manual/repaint/toplevel/main.cpp | 52 ++++++++++ tests/manual/repaint/toplevel/toplevel.pro | 16 +++ tests/manual/repaint/widget/main.cpp | 135 +++++++++++++++++++++++++ tests/manual/repaint/widget/widget.pro | 15 +++ 15 files changed, 745 insertions(+) create mode 100644 tests/manual/repaint/mainwindow/main.cpp create mode 100644 tests/manual/repaint/mainwindow/mainwindow.pro create mode 100644 tests/manual/repaint/scrollarea/main.cpp create mode 100644 tests/manual/repaint/scrollarea/scrollarea.pro create mode 100644 tests/manual/repaint/shared/shared.h create mode 100644 tests/manual/repaint/splitter/main.cpp create mode 100644 tests/manual/repaint/splitter/splitter.pro create mode 100644 tests/manual/repaint/tableview/main.cpp create mode 100644 tests/manual/repaint/tableview/tableview.pro create mode 100644 tests/manual/repaint/task141091/main.cpp create mode 100644 tests/manual/repaint/task141091/task141091.pro create mode 100644 tests/manual/repaint/toplevel/main.cpp create mode 100644 tests/manual/repaint/toplevel/toplevel.pro create mode 100644 tests/manual/repaint/widget/main.cpp create mode 100644 tests/manual/repaint/widget/widget.pro (limited to 'tests/manual/repaint') diff --git a/tests/manual/repaint/mainwindow/main.cpp b/tests/manual/repaint/mainwindow/main.cpp new file mode 100644 index 0000000000..eb0316804b --- /dev/null +++ b/tests/manual/repaint/mainwindow/main.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QMainWindow mainWindow; + + mainWindow.setCentralWidget(new StaticWidget()); + mainWindow.setStatusBar(new QStatusBar()); + + QDockWidget *dockWidget = new QDockWidget(); + dockWidget->setWidget(new StaticWidget()); + mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget); + + QToolBar *toolBar = new QToolBar(); + + toolBar->addWidget(new StaticWidget())->setVisible(true);; + + toolBar->addWidget(new QSpinBox())->setVisible(true);; + mainWindow.addToolBar(toolBar); + + mainWindow.resize(600, 400); + mainWindow.show(); + + return app.exec(); +} diff --git a/tests/manual/repaint/mainwindow/mainwindow.pro b/tests/manual/repaint/mainwindow/mainwindow.pro new file mode 100644 index 0000000000..c269d57eff --- /dev/null +++ b/tests/manual/repaint/mainwindow/mainwindow.pro @@ -0,0 +1,15 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Wed Nov 8 15:46:28 2006 +###################################################################### + +TEMPLATE = app +TARGET = mainwindow +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += ../shared/shared.h +SOURCES += main.cpp +CONFIG += qt warn_on debug create_prl link_prl +OBJECTS_DIR = .obj/debug-shared +MOC_DIR = .moc/debug-shared diff --git a/tests/manual/repaint/scrollarea/main.cpp b/tests/manual/repaint/scrollarea/main.cpp new file mode 100644 index 0000000000..83435efade --- /dev/null +++ b/tests/manual/repaint/scrollarea/main.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QScrollArea scrollView; + + QWidget * staticWidget = new StaticWidget(); + staticWidget->resize(400, 200); + scrollView.setWidget(staticWidget); + + scrollView.setAttribute(Qt::WA_StaticContents); + + scrollView.resize(600, 400); + scrollView.show(); + + + return app.exec(); +} + + diff --git a/tests/manual/repaint/scrollarea/scrollarea.pro b/tests/manual/repaint/scrollarea/scrollarea.pro new file mode 100644 index 0000000000..e1a40ad6ad --- /dev/null +++ b/tests/manual/repaint/scrollarea/scrollarea.pro @@ -0,0 +1,15 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Wed Nov 8 15:28:57 2006 +###################################################################### + +TEMPLATE = app +TARGET = scrollarea +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += ../shared/shared.h +SOURCES += main.cpp +CONFIG += qt warn_on debug create_prl link_prl +OBJECTS_DIR = .obj/debug-shared +MOC_DIR = .moc/debug-shared diff --git a/tests/manual/repaint/shared/shared.h b/tests/manual/repaint/shared/shared.h new file mode 100644 index 0000000000..d27a94ccae --- /dev/null +++ b/tests/manual/repaint/shared/shared.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +class StaticWidget : public QWidget +{ +Q_OBJECT +public: + int hue; + bool pressed; + StaticWidget(QWidget *parent = 0) + :QWidget(parent) + { + setAttribute(Qt::WA_StaticContents); + setAttribute(Qt::WA_OpaquePaintEvent); + hue = 200; + pressed = false; + } + + // Update 4 rects in a checkerboard pattern, using either + // a QRegion or separate rects (see the useRegion switch) + void updatePattern(QPoint pos) + { + const int rectSize = 10; + QRect rect(pos.x() - rectSize, pos.y() - rectSize, rectSize *2, rectSize * 2); + + QVector updateRects; + updateRects.append(rect.translated(rectSize * 2, rectSize * 2)); + updateRects.append(rect.translated(rectSize * 2, -rectSize * 2)); + updateRects.append(rect.translated(-rectSize * 2, rectSize * 2)); + updateRects.append(rect.translated(-rectSize * 2, -rectSize * 2)); + + + bool useRegion = false; + if (useRegion) { + QRegion region; + region.setRects(updateRects.data(), 4); + update(region); + } else { + foreach (QRect rect, updateRects) + update(rect); + } + } + + + void resizeEvent(QResizeEvent *) + { + // qDebug() << "static widget resize from" << e->oldSize() << "to" << e->size(); + } + + void mousePressEvent(QMouseEvent *event) + { +// qDebug() << "mousePress at" << event->pos(); + pressed = true; + updatePattern(event->pos()); + } + + void mouseReleaseEvent(QMouseEvent *) + { + pressed = false; + } + + void mouseMoveEvent(QMouseEvent *event) + { + if (pressed) + updatePattern(event->pos()); + } + + void paintEvent(QPaintEvent *e) + { + QPainter p(this); + static int color = 200; + color = (color + 41) % 205 + 50; +// color = ((color + 45) %150) + 100; + qDebug() << "static widget repaint" << e->rect(); + if (pressed) + p.fillRect(e->rect(), QColor::fromHsv(100, 255, color)); + else + p.fillRect(e->rect(), QColor::fromHsv(hue, 255, color)); + p.setPen(QPen(QColor(Qt::white))); + + for (int y = e->rect().top(); y <= e->rect().bottom() + 1; ++y) { + if (y % 20 == 0) + p.drawLine(e->rect().left(), y, e->rect().right(), y); + } + + for (int x = e->rect().left(); x <= e->rect().right() +1 ; ++x) { + if (x % 20 == 0) + p.drawLine(x, e->rect().top(), x, e->rect().bottom()); + } + } +}; diff --git a/tests/manual/repaint/splitter/main.cpp b/tests/manual/repaint/splitter/main.cpp new file mode 100644 index 0000000000..666f7bd06e --- /dev/null +++ b/tests/manual/repaint/splitter/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QSplitter splitter; + + splitter.addWidget(new StaticWidget()); + splitter.addWidget(new StaticWidget()); + + splitter.resize(600, 400); + splitter.show(); + + return app.exec(); +} diff --git a/tests/manual/repaint/splitter/splitter.pro b/tests/manual/repaint/splitter/splitter.pro new file mode 100644 index 0000000000..0afc0630ba --- /dev/null +++ b/tests/manual/repaint/splitter/splitter.pro @@ -0,0 +1,15 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Wed Nov 8 15:39:53 2006 +###################################################################### + +TEMPLATE = app +TARGET = splitter +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += ../shared/shared.h +SOURCES += main.cpp +CONFIG += qt warn_on debug create_prl link_prl +OBJECTS_DIR = .obj/debug-shared +MOC_DIR = .moc/debug-shared diff --git a/tests/manual/repaint/tableview/main.cpp b/tests/manual/repaint/tableview/main.cpp new file mode 100644 index 0000000000..9e49b46a53 --- /dev/null +++ b/tests/manual/repaint/tableview/main.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + +class CellWidget : public QWidget +{ +public: + CellWidget (QWidget *parent = 0) : QWidget(parent) { } + void paintEvent(QPaintEvent * event) + { + static int value = 200; + value = (value + 41) % 205 + 50; + QPainter p(this); + p.fillRect(event->rect(), QColor::fromHsv(100, 255, value)); + } +}; + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QTableWidget tableWidget; +// tableWidget.setAttribute(Qt::WA_StaticContents); + tableWidget.viewport()->setAttribute(Qt::WA_StaticContents); + tableWidget.setRowCount(15); + tableWidget.setColumnCount(4); + for (int row = 0; row < 15; ++row) + for (int col = 0; col < 4; ++col) +// tableWidget.setCellWidget(row, col, new StaticWidget()); + tableWidget.setCellWidget(row, col, new CellWidget()); + tableWidget.resize(400, 600); + tableWidget.show(); + + + return app.exec(); +} + + diff --git a/tests/manual/repaint/tableview/tableview.pro b/tests/manual/repaint/tableview/tableview.pro new file mode 100644 index 0000000000..4fccf4abc9 --- /dev/null +++ b/tests/manual/repaint/tableview/tableview.pro @@ -0,0 +1,8 @@ +HEADERS +=../shared/shared.h +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp diff --git a/tests/manual/repaint/task141091/main.cpp b/tests/manual/repaint/task141091/main.cpp new file mode 100644 index 0000000000..4ecd9ebc07 --- /dev/null +++ b/tests/manual/repaint/task141091/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +class MyWidget : public QWidget +{ +public: + MyWidget() : QWidget() { + + + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_StaticContents); } +protected: + void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); } +}; + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + MyWidget w; + w.show(); + return a.exec(); +} \ No newline at end of file diff --git a/tests/manual/repaint/task141091/task141091.pro b/tests/manual/repaint/task141091/task141091.pro new file mode 100644 index 0000000000..db89bd35b8 --- /dev/null +++ b/tests/manual/repaint/task141091/task141091.pro @@ -0,0 +1,12 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Mar 6 13:44:00 2007 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +CONFIG+=console + +# Input +SOURCES += main.cpp diff --git a/tests/manual/repaint/toplevel/main.cpp b/tests/manual/repaint/toplevel/main.cpp new file mode 100644 index 0000000000..b7efe33e01 --- /dev/null +++ b/tests/manual/repaint/toplevel/main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + StaticWidget widget; + widget.show(); + return app.exec(); +} + diff --git a/tests/manual/repaint/toplevel/toplevel.pro b/tests/manual/repaint/toplevel/toplevel.pro new file mode 100644 index 0000000000..568ea8e062 --- /dev/null +++ b/tests/manual/repaint/toplevel/toplevel.pro @@ -0,0 +1,16 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Nov 7 10:15:42 2006 +###################################################################### + +TEMPLATE = app +TARGET = toplevel +DEPENDPATH += . +INCLUDEPATH += . +CONFIG += console + +# Input +HEADERS += ../shared/shared.h +SOURCES += main.cpp +CONFIG += qt warn_on debug create_prl link_prl +OBJECTS_DIR = .obj/debug-shared +MOC_DIR = .moc/debug-shared diff --git a/tests/manual/repaint/widget/main.cpp b/tests/manual/repaint/widget/main.cpp new file mode 100644 index 0000000000..4061f9a169 --- /dev/null +++ b/tests/manual/repaint/widget/main.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../shared/shared.h" + +class Child : public StaticWidget +{ +Q_OBJECT +public: + Child(QWidget *parent) + :StaticWidget(parent) + { + hue = 0; + } +}; + +QWidget *c; + +class TopLevel : public StaticWidget +{ +Q_OBJECT +public: + TopLevel() + { + resizeButton = new QPushButton("resize", this); + connect(resizeButton, SIGNAL(clicked()), SLOT(buttonResizeClicked())); + + movebutton = new QPushButton("move", this); + connect(movebutton, SIGNAL(clicked()), SLOT(buttonMoveClicked())); + movebutton->move(70, 0); + + moveResizebutton = new QPushButton("move + resize", this); + connect(moveResizebutton, SIGNAL(clicked()), SLOT(buttonMoveResizeClicked())); + moveResizebutton->move(150, 0); + + scrollbutton = new QPushButton("scroll", this); + connect(scrollbutton, SIGNAL(clicked()), SLOT(buttonScrollClicked())); + scrollbutton->move(280, 0); + } + +public slots: + void buttonResizeClicked() + { + c->resize(c->size() + QSize(15, 15)); + qDebug() << "child new size" << c->size(); + } + + void buttonMoveClicked() + { + c->move(c->pos() + QPoint(15, 15)); + qDebug() << "child moved" << c->pos(); + } + + void buttonMoveResizeClicked() + { + QRect g = c->geometry(); + g.adjust(15,15,30,30); + c->setGeometry(g); + qDebug() << "child moved" << c->pos() << "rezied" << c->size(); + } + + + void buttonScrollClicked() + { + c->scroll(10, 10); + } + +protected: + QPushButton * resizeButton; + QPushButton * movebutton; + QPushButton * moveResizebutton; + QPushButton * scrollbutton; +}; + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + TopLevel bc; + bc.resize(500, 500); + + c = new Child(&bc); + c->move(100, 100); + c->resize(100, 100); + + QWidget *gc = new StaticWidget(c); + gc->move(20, 20); + gc->resize(50,50); + + + bc.show(); + return app.exec(); +} + +#include "main.moc" + diff --git a/tests/manual/repaint/widget/widget.pro b/tests/manual/repaint/widget/widget.pro new file mode 100644 index 0000000000..c9d8f872e8 --- /dev/null +++ b/tests/manual/repaint/widget/widget.pro @@ -0,0 +1,15 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Tue Nov 7 11:16:05 2006 +###################################################################### + +TEMPLATE = app +TARGET = widget +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += ../shared/shared.h +SOURCES += main.cpp +CONFIG += qt warn_on debug create_prl link_prl +OBJECTS_DIR = .obj/debug-shared +MOC_DIR = .moc/debug-shared -- cgit v1.2.3