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,6 @@
if(QT_FEATURE_gtk3)
add_subdirectory(gtk-container)
endif()
add_subdirectory(qt-client-raster)
add_subdirectory(qt-client-widget)

View File

@ -0,0 +1,22 @@
qt_find_package(GTK3)
qt_find_package(X11)
#####################################################################
## gtk-container Binary:
#####################################################################
qt_internal_add_manual_test(gtk-container
GUI
SOURCES
gtk-container.cpp
DEFINES
GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
LIBRARIES
PkgConfig::GTK3
Qt::Core
Qt::CorePrivate
Qt::Gui
Qt::GuiPrivate
X11::X11
)

View File

@ -0,0 +1,43 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
gchar *cmd;
void launch_app(GtkButton */* btn */, guint32 *id)
{
gchar *command = g_strdup_printf("%s %u", cmd, *id);
g_spawn_command_line_async(command, NULL);
}
gint main(gint argc, gchar **argv)
{
if (argc <=1 || argc > 2) {
g_print("No client application defined.\n");
return 0;
}
cmd = g_strdup_printf("%s", argv[1]);
gtk_init(&argc, &argv);
GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget *sock = gtk_socket_new();
GtkWidget *btn = gtk_button_new_with_label("Hello, World!");
g_signal_connect(sock, "plug-removed", gtk_main_quit, NULL);
g_signal_connect(win, "delete-event", gtk_main_quit, NULL);
gtk_widget_set_size_request(sock, 200, 200);
gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), sock, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(win), vbox);
gtk_widget_show_all(win);
guint32 id = gtk_socket_get_id(GTK_SOCKET(sock));
g_signal_connect(btn, "clicked", G_CALLBACK(launch_app), &id);
gtk_main();
return 0;
}

View File

@ -0,0 +1,16 @@
TEMPLATE = app
TARGET = gtk-container
QT_FOR_CONFIG += widgets-private
INCLUDEPATH += .
CONFIG += X11
QMAKE_USE += gtk3
# You can make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# Please consult the documentation of the deprecated API in order to know
# how to port your code away from it.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier
# Input
SOURCES += gtk-container.cpp

View File

@ -0,0 +1,15 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## qt-client-raster Binary:
#####################################################################
qt_internal_add_manual_test(qt-client-raster
GUI
SOURCES
main.cpp
rasterwindow.cpp rasterwindow.h
LIBRARIES
Qt::Gui
)

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "rasterwindow.h"
#include <QDebug>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QStringList args = app.arguments();
WId winId = 0;
if (args.count() > 1) {
bool ok;
winId = args[1].toUInt(&ok);
Q_ASSERT(ok);
}
RasterWindow window;
QWindow *foreign = QWindow::fromWinId(winId);
Q_ASSERT(foreign != 0);
window.setParent(foreign);
window.show();
return app.exec();
}

View File

@ -0,0 +1,9 @@
TEMPLATE = app
TARGET= qt-client-raster
QT += gui
SOURCES += \
main.cpp \
rasterwindow.cpp
HEADERS += \
rasterwindow.h

View File

@ -0,0 +1,72 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "rasterwindow.h"
RasterWindow::RasterWindow(QWindow *parent)
: QWindow(parent)
, m_update_pending(false)
{
winId();
m_backingStore = new QBackingStore(this);
create();
setGeometry(100, 100, 300, 200);
}
bool RasterWindow::event(QEvent *event)
{
if (event->type() == QEvent::UpdateRequest) {
m_update_pending = false;
renderNow();
return true;
}
return QWindow::event(event);
}
void RasterWindow::renderLater()
{
if (!m_update_pending) {
m_update_pending = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
}
}
void RasterWindow::resizeEvent(QResizeEvent *resizeEvent)
{
m_backingStore->resize(resizeEvent->size());
if (isExposed())
renderNow();
}
void RasterWindow::exposeEvent(QExposeEvent *)
{
if (isExposed()) {
renderNow();
}
}
void RasterWindow::renderNow()
{
if (!isExposed())
return;
QRect rect(0, 0, width(), height());
m_backingStore->beginPaint(rect);
QPaintDevice *device = m_backingStore->paintDevice();
QPainter painter(device);
painter.fillRect(0, 0, width(), height(), Qt::white);
render(&painter);
m_backingStore->endPaint();
m_backingStore->flush(rect);
}
void RasterWindow::render(QPainter *painter)
{
painter->drawText(QRectF(0, 0, width(), height()), Qt::AlignCenter, QStringLiteral("QWindow"));
}

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef RASTERWINDOW_H
#define RASTERWINDOW_H
#include <QtGui>
class RasterWindow : public QWindow
{
Q_OBJECT
public:
explicit RasterWindow(QWindow *parent = nullptr);
virtual void render(QPainter *painter);
public slots:
void renderLater();
void renderNow();
protected:
bool event(QEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void exposeEvent(QExposeEvent *event) override;
private:
QBackingStore *m_backingStore;
bool m_update_pending;
};
#endif // RASTERWINDOW_H

View File

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

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QApplication>
#include <QDebug>
#include <QWindow>
#include "window.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStringList args = app.arguments();
WId winId = 0;
if (args.count() > 1) {
bool ok;
winId = args[1].toUInt(&ok);
Q_ASSERT(ok);
}
Window window;
QWindow *foreign = QWindow::fromWinId(winId);
Q_ASSERT(foreign != 0);
window.windowHandle()->setParent(foreign);
window.show();
return app.exec();
}

View File

@ -0,0 +1,9 @@
TEMPLATE = app
TARGET= qt-client-widget
QT += widgets
SOURCES += \
main.cpp \
window.cpp
HEADERS += \
window.h

View File

@ -0,0 +1,206 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtWidgets>
#include "window.h"
Window::Window()
{
setAttribute(Qt::WA_NativeWindow);
setAttribute(Qt::WA_DontCreateNativeAncestors);
createWinId();
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
QLabel *echoLabel = new QLabel(tr("Mode:"));
QComboBox *echoComboBox = new QComboBox;
echoComboBox->addItem(tr("Normal"));
echoComboBox->addItem(tr("Password"));
echoComboBox->addItem(tr("PasswordEchoOnEdit"));
echoComboBox->addItem(tr("No Echo"));
echoLineEdit = new QLineEdit;
echoLineEdit->setFocus();
QGroupBox *validatorGroup = new QGroupBox(tr("Validator"));
QLabel *validatorLabel = new QLabel(tr("Type:"));
QComboBox *validatorComboBox = new QComboBox;
validatorComboBox->addItem(tr("No validator"));
validatorComboBox->addItem(tr("Integer validator"));
validatorComboBox->addItem(tr("Double validator"));
validatorLineEdit = new QLineEdit;
QGroupBox *alignmentGroup = new QGroupBox(tr("Alignment"));
QLabel *alignmentLabel = new QLabel(tr("Type:"));
QComboBox *alignmentComboBox = new QComboBox;
alignmentComboBox->addItem(tr("Left"));
alignmentComboBox->addItem(tr("Centered"));
alignmentComboBox->addItem(tr("Right"));
alignmentLineEdit = new QLineEdit;
QGroupBox *inputMaskGroup = new QGroupBox(tr("Input mask"));
QLabel *inputMaskLabel = new QLabel(tr("Type:"));
QComboBox *inputMaskComboBox = new QComboBox;
inputMaskComboBox->addItem(tr("No mask"));
inputMaskComboBox->addItem(tr("Phone number"));
inputMaskComboBox->addItem(tr("ISO date"));
inputMaskComboBox->addItem(tr("License key"));
inputMaskLineEdit = new QLineEdit;
QGroupBox *accessGroup = new QGroupBox(tr("Access"));
QLabel *accessLabel = new QLabel(tr("Read-only:"));
QComboBox *accessComboBox = new QComboBox;
accessComboBox->addItem(tr("False"));
accessComboBox->addItem(tr("True"));
accessLineEdit = new QLineEdit;
QGroupBox *testGroup = new QGroupBox(tr("Test"));
QLabel *testLabel = new QLabel(tr("Drag and Drop:"));
textEdit = new QTextEdit;
connect(echoComboBox, SIGNAL(activated(int)),
this, SLOT(echoChanged(int)));
connect(validatorComboBox, SIGNAL(activated(int)),
this, SLOT(validatorChanged(int)));
connect(alignmentComboBox, SIGNAL(activated(int)),
this, SLOT(alignmentChanged(int)));
connect(inputMaskComboBox, SIGNAL(activated(int)),
this, SLOT(inputMaskChanged(int)));
connect(accessComboBox, SIGNAL(activated(int)),
this, SLOT(accessChanged(int)));
QGridLayout *echoLayout = new QGridLayout;
echoLayout->addWidget(echoLabel, 0, 0);
echoLayout->addWidget(echoComboBox, 0, 1);
echoLayout->addWidget(echoLineEdit, 1, 0, 1, 2);
echoGroup->setLayout(echoLayout);
QGridLayout *validatorLayout = new QGridLayout;
validatorLayout->addWidget(validatorLabel, 0, 0);
validatorLayout->addWidget(validatorComboBox, 0, 1);
validatorLayout->addWidget(validatorLineEdit, 1, 0, 1, 2);
validatorGroup->setLayout(validatorLayout);
QGridLayout *alignmentLayout = new QGridLayout;
alignmentLayout->addWidget(alignmentLabel, 0, 0);
alignmentLayout->addWidget(alignmentComboBox, 0, 1);
alignmentLayout->addWidget(alignmentLineEdit, 1, 0, 1, 2);
alignmentGroup-> setLayout(alignmentLayout);
QGridLayout *inputMaskLayout = new QGridLayout;
inputMaskLayout->addWidget(inputMaskLabel, 0, 0);
inputMaskLayout->addWidget(inputMaskComboBox, 0, 1);
inputMaskLayout->addWidget(inputMaskLineEdit, 1, 0, 1, 2);
inputMaskGroup->setLayout(inputMaskLayout);
QGridLayout *accessLayout = new QGridLayout;
accessLayout->addWidget(accessLabel, 0, 0);
accessLayout->addWidget(accessComboBox, 0, 1);
accessLayout->addWidget(accessLineEdit, 1, 0, 1, 2);
accessGroup->setLayout(accessLayout);
QGridLayout *testLayout = new QGridLayout;
testLayout->addWidget(testLabel, 0, 0);
testLayout->addWidget(textEdit, 1, 0, 1, 2);
testGroup->setLayout(testLayout);
QGridLayout *layout = new QGridLayout;
layout->addWidget(echoGroup, 0, 0);
layout->addWidget(validatorGroup, 1, 0);
layout->addWidget(alignmentGroup, 2, 0);
layout->addWidget(inputMaskGroup, 0, 1);
layout->addWidget(accessGroup, 1, 1);
layout->addWidget(testGroup, 2, 1);
setLayout(layout);
setWindowTitle(tr("Line Edits"));
}
void Window::echoChanged(int index)
{
switch (index) {
case 0:
echoLineEdit->setEchoMode(QLineEdit::Normal);
break;
case 1:
echoLineEdit->setEchoMode(QLineEdit::Password);
break;
case 2:
echoLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
break;
case 3:
echoLineEdit->setEchoMode(QLineEdit::NoEcho);
}
}
void Window::validatorChanged(int index)
{
switch (index) {
case 0:
validatorLineEdit->setValidator(0);
break;
case 1:
validatorLineEdit->setValidator(new QIntValidator(
validatorLineEdit));
break;
case 2:
validatorLineEdit->setValidator(new QDoubleValidator(-999.0,
999.0, 2, validatorLineEdit));
}
validatorLineEdit->clear();
}
void Window::alignmentChanged(int index)
{
switch (index) {
case 0:
alignmentLineEdit->setAlignment(Qt::AlignLeft);
break;
case 1:
alignmentLineEdit->setAlignment(Qt::AlignCenter);
break;
case 2:
alignmentLineEdit->setAlignment(Qt::AlignRight);
}
}
void Window::inputMaskChanged(int index)
{
switch (index) {
case 0:
inputMaskLineEdit->setInputMask("");
break;
case 1:
inputMaskLineEdit->setInputMask("+99 99 99 99 99;_");
break;
case 2:
inputMaskLineEdit->setInputMask("0000-00-00");
inputMaskLineEdit->setText("00000000");
inputMaskLineEdit->setCursorPosition(0);
break;
case 3:
inputMaskLineEdit->setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#");
}
}
void Window::accessChanged(int index)
{
switch (index) {
case 0:
accessLineEdit->setReadOnly(false);
break;
case 1:
accessLineEdit->setReadOnly(true);
}
}

View File

@ -0,0 +1,38 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QComboBox;
class QLineEdit;
class QTextEdit;
QT_END_NAMESPACE
class Window : public QWidget
{
Q_OBJECT
public:
Window();
public slots:
void echoChanged(int);
void validatorChanged(int);
void alignmentChanged(int);
void inputMaskChanged(int);
void accessChanged(int);
private:
QLineEdit *echoLineEdit;
QLineEdit *validatorLineEdit;
QLineEdit *alignmentLineEdit;
QLineEdit *inputMaskLineEdit;
QLineEdit *accessLineEdit;
QTextEdit *textEdit;
};
#endif

View File

@ -0,0 +1,11 @@
TEMPLATE=subdirs
QT_FOR_CONFIG += network-private gui-private
TEMPLATE = subdirs
QT_FOR_CONFIG += widgets-private
SUBDIRS = \
qt-client-raster \
qt-client-widget
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk-container