qt 6.5.1 original

This commit is contained in:
kleuter
2023-10-29 23:33:08 +01:00
parent 71d22ab6b0
commit 85d238dfda
21202 changed files with 5499099 additions and 0 deletions

View File

@ -0,0 +1,10 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(mainwindow)
add_subdirectory(scrollarea)
add_subdirectory(splitter)
add_subdirectory(tableview)
add_subdirectory(task141091)
add_subdirectory(toplevel)
add_subdirectory(widget)

View File

@ -0,0 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_manual_mainwindow Binary:
#####################################################################
qt_internal_add_manual_test(tst_manual_mainwindow
GUI
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,38 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QApplication>
#include <QMainWindow>
#include <QToolBar>
#include <QDockWidget>
#include <QStatusBar>
#include <QSpinBox>
#include <QAction>
#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();
}

View File

@ -0,0 +1,4 @@
TARGET = tst_manual_mainwindow
QT += widgets
HEADERS += ../shared/shared.h
SOURCES += main.cpp

View File

@ -0,0 +1,9 @@
TEMPLATE=subdirs
SUBDIRS = mainwindow \
scrollarea \
splitter \
tableview \
task141091 \
toplevel \
widget

View File

@ -0,0 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_manual_scrollarea Binary:
#####################################################################
qt_internal_add_manual_test(tst_manual_scrollarea
GUI
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QApplication>
#include <QMainWindow>
#include <QScrollArea>
#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();
}

View File

@ -0,0 +1,4 @@
QT += widgets
TARGET = tst_manual_scrollarea
HEADERS += ../shared/shared.h
SOURCES += main.cpp

View File

@ -0,0 +1,96 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QWidget>
#include <QPainter>
#include <QMouseEvent>
#include <QDebug>
class StaticWidget : public QWidget
{
Q_OBJECT
public:
int hue;
bool pressed;
StaticWidget(QWidget *parent = nullptr)
: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);
QList<QRect> 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());
}
}
};

View File

@ -0,0 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## splitter Binary:
#####################################################################
qt_internal_add_manual_test(splitter
GUI
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,23 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../shared/shared.h"
#include <QApplication>
#include <QMainWindow>
#include <QSplitter>
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();
}

View File

@ -0,0 +1,3 @@
QT += widgets
HEADERS += ../shared/shared.h
SOURCES += main.cpp

View File

@ -0,0 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tableview Binary:
#####################################################################
qt_internal_add_manual_test(tableview
GUI
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,42 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../shared/shared.h"
#include <QApplication>
#include <QMainWindow>
#include <QTableWidget>
#include <QPaintEvent>
class CellWidget : public QWidget
{
public:
CellWidget(QWidget *parent = nullptr) : 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();
}

View File

@ -0,0 +1,3 @@
QT += widgets
HEADERS +=../shared/shared.h
SOURCES += main.cpp

View File

@ -0,0 +1,14 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## task141091 Binary:
#####################################################################
qt_internal_add_manual_test(task141091
SOURCES
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QApplication>
#include <QMainWindow>
#include <QPaintEvent>
#include <QDebug>
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();
}

View File

@ -0,0 +1,3 @@
CONFIG += console
QT += widgets
SOURCES += main.cpp

View File

@ -0,0 +1,15 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_manual_toplevel Binary:
#####################################################################
qt_internal_add_manual_test(tst_manual_toplevel
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,15 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../shared/shared.h"
#include <QApplication>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
StaticWidget widget;
widget.show();
return app.exec();
}

View File

@ -0,0 +1,6 @@
CONFIG += console
QT += widgets
TARGET = tst_manual_toplevel
HEADERS += ../shared/shared.h
SOURCES += main.cpp

View File

@ -0,0 +1,16 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## widget Binary:
#####################################################################
qt_internal_add_manual_test(widget
GUI
SOURCES
../shared/shared.h
main.cpp
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -0,0 +1,99 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../shared/shared.h"
#include <QApplication>
#include <QPushButton>
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"

View File

@ -0,0 +1,3 @@
QT += widgets
HEADERS += ../shared/shared.h
SOURCES += main.cpp