diff options
Diffstat (limited to 'src/gui/doc')
35 files changed, 657 insertions, 233 deletions
diff --git a/src/gui/doc/images/qpainter-concentriccircles.png b/src/gui/doc/images/qpainter-concentriccircles.png Binary files differindex 4889dcd76d..d9489a4162 100644 --- a/src/gui/doc/images/qpainter-concentriccircles.png +++ b/src/gui/doc/images/qpainter-concentriccircles.png diff --git a/src/gui/doc/includes/QtGuiDoc b/src/gui/doc/includes/QtGuiDoc index 00d01afa9c..e8fa73786e 100644 --- a/src/gui/doc/includes/QtGuiDoc +++ b/src/gui/doc/includes/QtGuiDoc @@ -16,4 +16,8 @@ #include <QtGui/qpa/qplatformscreen_p.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qkeymapper_p.h> -#include <QtGui/private/qwindowsmime_p.h> + +// rhi +#include <QtGui/rhi/qrhi.h> +#include <QtGui/rhi/qshader.h> +#include <QtGui/rhi/qshaderdescription.h> diff --git a/src/gui/doc/includes/windows.h b/src/gui/doc/includes/windows.h index e900698255..b4824c2e93 100644 --- a/src/gui/doc/includes/windows.h +++ b/src/gui/doc/includes/windows.h @@ -15,7 +15,7 @@ // // Dummy declarations for generating docs on non-Windows platforms -#if !defined(Q_OS_WIN) && defined(Q_CLANG_QDOC) +#if !defined(Q_OS_WIN) && defined(Q_QDOC) typedef struct _FORMATETC {} FORMATETC; typedef struct _STGMEDIUM {} STGMEDIUM; typedef void *IDataObject; diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index 15e98ad385..b94f11849c 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -39,6 +39,7 @@ depends += \ qtdoc \ qmake \ qtcmake \ + qtshadertools \ qttestlib \ qtplatformintegration \ qthelp @@ -62,7 +63,7 @@ imagedirs += images \ excludefiles += ../kernel/qtestsupport_gui.cpp \ ../painting/qdrawhelper_ssse3.cpp -# manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example" +manifestmeta.highlighted.names = "QtGui/Hello Vulkan Cubes Example" navigation.landingpage = "Qt GUI" navigation.cppclassespage = "Qt GUI C++ Classes" @@ -72,6 +73,7 @@ spurious += "Undocumented enum item '.*' in QGradient::Preset" # \svgcolor {#ffdead} macro.svgcolor.HTML = "<div style=\"padding:10px;color:#fff;background:\1;\"></div>" +macro.svgcolor.DocBook = "<db:phrase role=\"color:\1\">          </db:phrase>" -# Fail the documentation build if there are more warnings than the limit +# Enforce zero documentation warnings warninglimit = 0 diff --git a/src/gui/doc/snippets/code/doc_src_richtext.qdoc b/src/gui/doc/snippets/code/doc_src_richtext.qdoc index 39e29caa8d..0c69514210 100644 --- a/src/gui/doc/snippets/code/doc_src_richtext.qdoc +++ b/src/gui/doc/snippets/code/doc_src_richtext.qdoc @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only //! [7] <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" /> diff --git a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp index d446f16c3c..a7f27a7fdd 100644 --- a/src/gui/doc/snippets/code/src_gui_image_qicon.cpp +++ b/src/gui/doc/snippets/code/src_gui_image_qicon.cpp @@ -8,7 +8,7 @@ namespace src_gui_image_qicon { struct MyWidget : public QWidget { - void drawIcon(QPainter *painter, QPoint pos); + void drawIcon(QPainter *painter, const QRect &rect); bool isChecked() { return true; } QIcon icon; }; @@ -17,9 +17,13 @@ void wrapper0() { //! [0] QToolButton *button = new QToolButton; -button->setIcon(QIcon("open.xpm")); +button->setIcon(QIcon("open.png")); //! [0] +//! [addFile] +QIcon openIcon("open.png"); +openIcon.addFile("open-disabled.png", QIcon::Disabled); +//! [addFile] //! [1] button->setIcon(QIcon()); @@ -29,29 +33,27 @@ button->setIcon(QIcon()); //! [2] -void MyWidget::drawIcon(QPainter *painter, QPoint pos) +void MyWidget::drawIcon(QPainter *painter, const QRect &rect) { - QPixmap pixmap = icon.pixmap(QSize(22, 22), - isEnabled() ? QIcon::Normal - : QIcon::Disabled, - isChecked() ? QIcon::On - : QIcon::Off); - painter->drawPixmap(pos, pixmap); + icon.paint(painter, rect, Qt::AlignCenter, isEnabled() ? QIcon::Normal + : QIcon::Disabled, + isChecked() ? QIcon::On + : QIcon::Off); } //! [2] void wrapper1() { -//! [3] -QIcon undoicon = QIcon::fromTheme("edit-undo"); -//! [3] +//! [fromTheme] +QIcon undoicon = QIcon::fromTheme(QIcon::ThemeIcon::EditUndo); +//! [fromTheme] } // wrapper1 //! [4] -QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png")); +QIcon undoicon = QIcon::fromTheme(QIcon::ThemeIcon::EditUndo, QIcon(":/undo.png")); //! [4] diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp index ab8521b465..9455cacf1c 100644 --- a/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/gui/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -19,70 +19,6 @@ struct MyWidget int manhattanLength() { return 0; } }; - -//! [0] -QCoreApplication *createApplication(int &argc, char *argv[]) -{ - for (int i = 1; i < argc; ++i) - if (!qstrcmp(argv[i], "-no-gui")) - return new QCoreApplication(argc, argv); - return new QApplication(argc, argv); -} - -int main(int argc, char *argv[]) -{ - QScopedPointer<QCoreApplication> app(createApplication(argc, argv)); - - if (qobject_cast<QApplication *>(app.data())) { - // start GUI version... - } else { - // start non-GUI version... - } - - return app->exec(); -} -//! [0] - - -void wrapper0() { - -//! [1] -QApplication::setStyle(QStyleFactory::create("fusion")); -//! [1] - -} // wrapper0 - - -//! [3] -QSize MyWidget::sizeHint() const -{ - return QSize(80, 25); -} -//! [3] - - -//! [4] -void showAllHiddenTopLevelWidgets() -{ - const auto topLevelWidgets = QApplication::topLevelWidgets(); - for (QWidget *widget : topLevelWidgets) { - if (widget->isHidden()) - widget->show(); - } -} -//! [4] - - -//! [5] -void updateAllWidgets() -{ - const auto topLevelWidgets = QApplication::topLevelWidgets(); - for (QWidget *widget : topLevelWidgets) - widget->update(); -} -//! [5] - - void startTheDrag() {}; void wrapper1() { MyWidget startPos; @@ -96,25 +32,6 @@ if ((startPos - currentPos).manhattanLength() >= startTheDrag(); //! [6] - -//! [7] -QWidget *widget = qApp->widgetAt(x, y); -if (widget) - widget = widget->window(); -//! [7] - } // wrapper1 - -void wrapper2() { -QPoint point; - -//! [8] -QWidget *widget = qApp->widgetAt(point); -if (widget) - widget = widget->window(); -//! [8] - - -} // wrapper2 } // src_gui_kernel_qapplication diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp index e9a2446b91..347b47403e 100644 --- a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp +++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp @@ -74,26 +74,4 @@ appname -session id */ // wrap snippet 2 - -void wrapper0() { - - -//! [3] -const QStringList commands = mySession.restartCommand(); -for (const QString &command : commands) - do_something(command); -//! [3] - -} // wrapper0 - - -void wrapper1() { -//! [4] -const QStringList commands = mySession.discardCommand(); -for (const QString &command : mySession.discardCommand()) - do_something(command); -//! [4] - - -} // wrapper1 } // src_gui_kernel_qguiapplication diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp index 0e4c56d8a4..0f335dd0a0 100644 --- a/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp +++ b/src/gui/doc/snippets/code/src_gui_kernel_qkeysequence.cpp @@ -32,7 +32,7 @@ void Wrapper::wrapper() { //! [2] QMenu *file = new QMenu(this); file->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")), - this, SLOT(open())); + this, &MainWindow::open); //! [2] } // Wrapper::wrapper diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp index 17436c9de5..cfbf3e44a2 100644 --- a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp +++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp @@ -63,6 +63,7 @@ struct MyWidget : public QWidget void wrapper13(); void wrapper14(); void wrapper15(); + void concentricCircles(); }; QLine drawingCode; @@ -97,15 +98,6 @@ struct QPainter { void setWorldTransform(QTransform matrix, bool); }; -//! [4] -void QPainter::rotate(qreal angle) -{ - QTransform matrix; - matrix.rotate(angle); - setWorldTransform(matrix, true); -} -//! [4] - } // QPainterWrapper void MyWidget::wrapper1() { @@ -123,7 +115,7 @@ painter.drawPath(path); //! [6] QLineF line(10.0, 80.0, 90.0, 20.0); -QPainter(this); +QPainter painter(this); painter.drawLine(line); //! [6] } // MyWidget::wrapper1() @@ -260,7 +252,7 @@ QRectF target(10.0, 20.0, 80.0, 60.0); QRectF source(0.0, 0.0, 70.0, 40.0); QPixmap pixmap(":myPixmap.png"); -QPainter(this); +QPainter painter(this); painter.drawPixmap(target, pixmap, source); //! [16] @@ -364,4 +356,21 @@ painter.drawRect(rectangle.adjusted(0, 0, -pen.width(), -pen.width())); } // MyWidget::wrapper15 -} // src_gui_painting_qpainter2 + +void MyWidget::concentricCircles() +{ +//! [renderHint] + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing, true); +//! [renderHint] + int diameter = 50; +//! [floatBased] + painter.drawEllipse(QRectF(-diameter / 2.0, -diameter / 2.0, diameter, diameter)); +//! [floatBased] +//! [intBased] + painter.drawEllipse(QRect(-diameter / 2, -diameter / 2, diameter, diameter)); +//! [intBased] + +} // MyWidget::concentricCircles + +} // src_gui_painting_qpainter2
\ No newline at end of file diff --git a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp index 33a82f8dd1..4650ad8d8f 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp @@ -9,7 +9,7 @@ void wrapper0() { //! [0] QFont font("times", 24); QFontMetrics fm(font); -int pixelsWide = fm.horizontalAdvance("What's the width of this text?"); +int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?"); int pixelsHigh = fm.height(); //! [0] @@ -22,7 +22,7 @@ void wrapper1() { //! [1] QFont font("times", 24); QFontMetricsF fm(font); -qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?"); +qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?"); qreal pixelsHigh = fm.height(); //! [1] diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp deleted file mode 100644 index 570728f41d..0000000000 --- a/src/gui/doc/snippets/code/src_gui_text_qtextdocument.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -namespace src_gui_text_qtextdocument { - -/* wrap non-code snippet - -//! [0] -<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>... -//! [0] - -*/ // wrap non-code snippet -} // src_gui_text_qtextdocument diff --git a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp index 2602c2ced0..70ec6b01ea 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qtextlayout.cpp @@ -10,6 +10,7 @@ namespace src_gui_text_qtextlayout { struct Wrapper : public QPaintDevice { void wrapper1(); + void elided(); }; QTextLayout textLayout; @@ -24,7 +25,7 @@ int leading = fontMetrics.leading(); qreal height = 0; textLayout.setCacheEnabled(true); textLayout.beginLayout(); -while (1) { +while (true) { QTextLine line = textLayout.createLine(); if (!line.isValid()) break; @@ -49,4 +50,41 @@ textLayout.draw(&painter, QPoint(0, 0)); } // Wrapper::wrapper1 +void Wrapper::elided() { + +QString content; + +//! [elided] +QPainter painter(this); +QFontMetrics fontMetrics = painter.fontMetrics(); + +int lineSpacing = fontMetrics.lineSpacing(); +int y = 0; + +QTextLayout textLayout(content, painter.font()); +textLayout.beginLayout(); +while (true) { + QTextLine line = textLayout.createLine(); + + if (!line.isValid()) + break; + + line.setLineWidth(width()); + const int nextLineY = y + lineSpacing; + + if (height() >= nextLineY + lineSpacing) { + line.draw(&painter, QPoint(0, y)); + y = nextLineY; + } else { + const QString lastLine = content.mid(line.textStart()); + const QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width()); + painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine); + line = textLayout.createLine(); + break; + } +} +textLayout.endLayout(); +//! [elided] +} + } // src_gui_text_qtextlayout diff --git a/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp index 96c8040eb2..13deb88bc8 100644 --- a/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp +++ b/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp @@ -65,15 +65,6 @@ QDesktopServices::openUrl(QUrl("file:///C:/Program Files", QUrl::TolerantMode)); */ // comment wrapper 2 - -void wrapper3() { -//! [6] -QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - "/data/organization/application"; -//! [6] -} // wrapper3 - - /* comment wrapper 3 //! [7] <key>com.apple.developer.associated-domains</key> diff --git a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp index a83c6eb7f9..700d933f43 100644 --- a/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp +++ b/src/gui/doc/snippets/code/src_gui_vulkan_qvulkanfunctions.cpp @@ -8,20 +8,18 @@ namespace src_gui_vulkan_qvulkanfunctions { struct Window { - void render(); + void init(); QVulkanInstance *vulkanInstance() { return nullptr; } }; -VkDevice_T *device = nullptr; -VkCommandBufferAllocateInfo cmdBufInfo; -VkCommandBuffer cmdBuf; //! [0] -void Window::render() +void Window::init() { QVulkanInstance *inst = vulkanInstance(); QVulkanFunctions *f = inst->functions(); // ... - VkResult err = f->vkAllocateCommandBuffers(device, &cmdBufInfo, &cmdBuf); + uint32_t count = 0; + VkResult err = f->vkEnumeratePhysicalDevices(inst->vkInstance(), &count, nullptr); // ... } //! [0] diff --git a/src/gui/doc/snippets/image/image.cpp b/src/gui/doc/snippets/image/image.cpp index b1c42d62da..82703c5c0f 100644 --- a/src/gui/doc/snippets/image/image.cpp +++ b/src/gui/doc/snippets/image/image.cpp @@ -25,13 +25,6 @@ buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format //! [1] - -//! [2] -QPixmap alpha("image-with-alpha.png"); -QPixmap alphacopy = alpha; -alphacopy.setMask(alphacopy.mask()); -//! [2] - } // wrapper1 } // image diff --git a/src/gui/doc/snippets/qfileopenevent/main.cpp b/src/gui/doc/snippets/qfileopenevent/main.cpp index b733bfc320..a94ff58137 100644 --- a/src/gui/doc/snippets/qfileopenevent/main.cpp +++ b/src/gui/doc/snippets/qfileopenevent/main.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2016 Samuel Gaist <samuel.gaist@edeltech.ch> +// Copyright (C) 2023 Samuel Gaist <samuel.gaist@edeltech.ch> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [QApplication subclass] @@ -19,7 +19,15 @@ public: { if (event->type() == QEvent::FileOpen) { QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event); - qDebug() << "Open file" << openEvent->file(); + const QUrl url = openEvent->url(); + if (url.isLocalFile()) { + QFile localFile(url.toLocalFile()); + // read from local file + } else if (url.isValid()) { + // process according to the URL's schema + } else { + // parse openEvent->file() + } } return QApplication::event(event); diff --git a/src/gui/doc/snippets/rhioffscreen/color.frag b/src/gui/doc/snippets/rhioffscreen/color.frag new file mode 100644 index 0000000000..ad9d953d02 --- /dev/null +++ b/src/gui/doc/snippets/rhioffscreen/color.frag @@ -0,0 +1,16 @@ +//! [0] +#version 440 + +layout(location = 0) in vec3 v_color; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 mvp; + float opacity; +}; + +void main() +{ + fragColor = vec4(v_color * opacity, opacity); +} +//! [0] diff --git a/src/gui/doc/snippets/rhioffscreen/color.vert b/src/gui/doc/snippets/rhioffscreen/color.vert new file mode 100644 index 0000000000..0010e55561 --- /dev/null +++ b/src/gui/doc/snippets/rhioffscreen/color.vert @@ -0,0 +1,18 @@ +//! [0] +#version 440 + +layout(location = 0) in vec4 position; +layout(location = 1) in vec3 color; +layout(location = 0) out vec3 v_color; + +layout(std140, binding = 0) uniform buf { + mat4 mvp; + float opacity; +}; + +void main() +{ + v_color = color; + gl_Position = mvp * position; +} +//! [0] diff --git a/src/gui/doc/snippets/rhioffscreen/main.cpp b/src/gui/doc/snippets/rhioffscreen/main.cpp new file mode 100644 index 0000000000..c2c6f74dc1 --- /dev/null +++ b/src/gui/doc/snippets/rhioffscreen/main.cpp @@ -0,0 +1,151 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +//! [0] +#include <QGuiApplication> +#include <QImage> +#include <QFile> +#include <rhi/qrhi.h> + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + +#if QT_CONFIG(vulkan) + QVulkanInstance inst; +#endif + std::unique_ptr<QRhi> rhi; +#if defined(Q_OS_WIN) + QRhiD3D12InitParams params; + rhi.reset(QRhi::create(QRhi::D3D12, ¶ms)); +#elif QT_CONFIG(metal) + QRhiMetalInitParams params; + rhi.reset(QRhi::create(QRhi::Metal, ¶ms)); +#elif QT_CONFIG(vulkan) + inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions()); + if (inst.create()) { + QRhiVulkanInitParams params; + params.inst = &inst; + rhi.reset(QRhi::create(QRhi::Vulkan, ¶ms)); + } else { + qFatal("Failed to create Vulkan instance"); + } +#endif + if (rhi) + qDebug() << rhi->backendName() << rhi->driverInfo(); + else + qFatal("Failed to initialize RHI"); + + float rotation = 0.0f; + float opacity = 1.0f; + int opacityDir = 1; + + std::unique_ptr<QRhiTexture> tex(rhi->newTexture(QRhiTexture::RGBA8, + QSize(1280, 720), + 1, + QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource)); + tex->create(); + std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget({ tex.get() })); + std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor()); + rt->setRenderPassDescriptor(rp.get()); + rt->create(); + + QMatrix4x4 viewProjection = rhi->clipSpaceCorrMatrix(); + viewProjection.perspective(45.0f, 1280 / 720.f, 0.01f, 1000.0f); + viewProjection.translate(0, 0, -4); + + static float vertexData[] = { // Y up, CCW + 0.0f, 0.5f, 1.0f, 0.0f, 0.0f, + -0.5f, -0.5f, 0.0f, 1.0f, 0.0f, + 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, + }; + + std::unique_ptr<QRhiBuffer> vbuf(rhi->newBuffer(QRhiBuffer::Immutable, + QRhiBuffer::VertexBuffer, + sizeof(vertexData))); + vbuf->create(); + + std::unique_ptr<QRhiBuffer> ubuf(rhi->newBuffer(QRhiBuffer::Dynamic, + QRhiBuffer::UniformBuffer, + 64 + 4)); + ubuf->create(); + + std::unique_ptr<QRhiShaderResourceBindings> srb(rhi->newShaderResourceBindings()); + srb->setBindings({ + QRhiShaderResourceBinding::uniformBuffer(0, + QRhiShaderResourceBinding::VertexStage | QRhiShaderResourceBinding::FragmentStage, + ubuf.get()) + }); + srb->create(); + + std::unique_ptr<QRhiGraphicsPipeline> ps(rhi->newGraphicsPipeline()); + QRhiGraphicsPipeline::TargetBlend premulAlphaBlend; + premulAlphaBlend.enable = true; + ps->setTargetBlends({ premulAlphaBlend }); + static auto getShader = [](const QString &name) { + QFile f(name); + return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader(); + }; + ps->setShaderStages({ + { QRhiShaderStage::Vertex, getShader(QLatin1String("color.vert.qsb")) }, + { QRhiShaderStage::Fragment, getShader(QLatin1String("color.frag.qsb")) } + }); + QRhiVertexInputLayout inputLayout; + inputLayout.setBindings({ + { 5 * sizeof(float) } + }); + inputLayout.setAttributes({ + { 0, 0, QRhiVertexInputAttribute::Float2, 0 }, + { 0, 1, QRhiVertexInputAttribute::Float3, 2 * sizeof(float) } + }); + ps->setVertexInputLayout(inputLayout); + ps->setShaderResourceBindings(srb.get()); + ps->setRenderPassDescriptor(rp.get()); + ps->create(); + + QRhiCommandBuffer *cb; + for (int frame = 0; frame < 20; ++frame) { + rhi->beginOffscreenFrame(&cb); + + QRhiResourceUpdateBatch *u = rhi->nextResourceUpdateBatch(); + if (frame == 0) + u->uploadStaticBuffer(vbuf.get(), vertexData); + + QMatrix4x4 mvp = viewProjection; + mvp.rotate(rotation, 0, 1, 0); + u->updateDynamicBuffer(ubuf.get(), 0, 64, mvp.constData()); + rotation += 5.0f; + + u->updateDynamicBuffer(ubuf.get(), 64, 4, &opacity); + opacity += opacityDir * 0.2f; + if (opacity < 0.0f || opacity > 1.0f) { + opacityDir *= -1; + opacity = qBound(0.0f, opacity, 1.0f); + } + + cb->beginPass(rt.get(), Qt::green, { 1.0f, 0 }, u); + cb->setGraphicsPipeline(ps.get()); + cb->setViewport({ 0, 0, 1280, 720 }); + cb->setShaderResources(); + const QRhiCommandBuffer::VertexInput vbufBinding(vbuf.get(), 0); + cb->setVertexInput(0, 1, &vbufBinding); + cb->draw(3); + QRhiReadbackResult readbackResult; + u = rhi->nextResourceUpdateBatch(); + u->readBackTexture({ tex.get() }, &readbackResult); + cb->endPass(u); + + rhi->endOffscreenFrame(); + + QImage image(reinterpret_cast<const uchar *>(readbackResult.data.constData()), + readbackResult.pixelSize.width(), + readbackResult.pixelSize.height(), + QImage::Format_RGBA8888_Premultiplied); + if (rhi->isYUpInFramebuffer()) + image = image.mirrored(); + image.save(QString::asprintf("frame%d.png", frame)); + } + + return 0; +} +//! [0] diff --git a/src/gui/doc/snippets/separations/finalwidget.cpp b/src/gui/doc/snippets/separations/finalwidget.cpp index a3d60cfc83..3c308d9df8 100644 --- a/src/gui/doc/snippets/separations/finalwidget.cpp +++ b/src/gui/doc/snippets/separations/finalwidget.cpp @@ -28,10 +28,9 @@ FinalWidget::FinalWidget(QWidget *parent, const QString &name, imageLabel->setMinimumSize(labelSize); nameLabel = new QLabel(name); - QVBoxLayout *layout = new QVBoxLayout; + QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(imageLabel, 1); layout->addWidget(nameLabel, 0); - setLayout(layout); } /*! diff --git a/src/gui/doc/snippets/separations/screenwidget.cpp b/src/gui/doc/snippets/separations/screenwidget.cpp index 87a6c9e605..223de95962 100644 --- a/src/gui/doc/snippets/separations/screenwidget.cpp +++ b/src/gui/doc/snippets/separations/screenwidget.cpp @@ -61,12 +61,11 @@ ScreenWidget::ScreenWidget(QWidget *parent, QColor initialColor, connect(colorButton, &QPushButton::clicked, this, &ScreenWidget::setColor); connect(invertButton, &QPushButton::clicked, this, &ScreenWidget::invertImage); - QGridLayout *gridLayout = new QGridLayout; + QGridLayout *gridLayout = new QGridLayout(this); gridLayout->addWidget(imageLabel, 0, 0, 1, 2); gridLayout->addWidget(nameLabel, 1, 0); gridLayout->addWidget(colorButton, 1, 1); gridLayout->addWidget(invertButton, 2, 1, 1, 1); - setLayout(gridLayout); } /*! diff --git a/src/gui/doc/snippets/separations/separations.qdoc b/src/gui/doc/snippets/separations/separations.qdoc index ad670f305a..ee567030bb 100644 --- a/src/gui/doc/snippets/separations/separations.qdoc +++ b/src/gui/doc/snippets/separations/separations.qdoc @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /* \example painting/separations diff --git a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp index 2bf6e4a018..324f1937d9 100644 --- a/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp +++ b/src/gui/doc/snippets/textdocument-listitems/mainwindow.cpp @@ -13,17 +13,17 @@ MainWindow::MainWindow() QMenu *fileMenu = new QMenu(tr("&File")); fileMenu->addAction(tr("E&xit"), QKeySequence(tr("Ctrl+Q", "File|Exit")), - this, SLOT(close())); + this, &QWidget::close); QMenu *actionsMenu = new QMenu(tr("&Actions")); actionsMenu->addAction(tr("&Highlight List Items"), - this, SLOT(highlightListItems())); - actionsMenu->addAction(tr("&Show Current List"), this, SLOT(showList())); + this, &MainWindow::highlightListItems); + actionsMenu->addAction(tr("&Show Current List"), this, &MainWindow::showList); QMenu *insertMenu = new QMenu(tr("&Insert")); insertMenu->addAction(tr("&List"), QKeySequence(tr("Ctrl+L", "Insert|List")), - this, SLOT(insertList())); + this, &MainWindow::insertList); menuBar()->addMenu(fileMenu); menuBar()->addMenu(insertMenu); diff --git a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp index eefa0aa841..6e1d051d4b 100644 --- a/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp +++ b/src/gui/doc/snippets/textdocument-selections/mainwindow.cpp @@ -9,30 +9,30 @@ MainWindow::MainWindow() QMenu *fileMenu = new QMenu(tr("&File")); fileMenu->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")), - this, SLOT(openFile())); + this, &MainWindow::openFile); - QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close())); + QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, &MainWindow::close); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *editMenu = new QMenu(tr("&Edit")); - cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection())); + cutAction = editMenu->addAction(tr("Cu&t"), this, &MainWindow::cutSelection); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setEnabled(false); - copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection())); + copyAction = editMenu->addAction(tr("&Copy"), this, &MainWindow::copySelection); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setEnabled(false); - pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection())); + pasteAction = editMenu->addAction(tr("&Paste"), this, &MainWindow::pasteSelection); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setEnabled(false); QMenu *selectMenu = new QMenu(tr("&Select")); - selectMenu->addAction(tr("&Word"), this, SLOT(selectWord())); - selectMenu->addAction(tr("&Line"), this, SLOT(selectLine())); - selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock())); - selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame())); + selectMenu->addAction(tr("&Word"), this, &MainWindow::selectWord); + selectMenu->addAction(tr("&Line"), this, &MainWindow::selectLine); + selectMenu->addAction(tr("&Block"), this, &MainWindow::selectBlock); + selectMenu->addAction(tr("&Frame"), this, &MainWindow::selectFrame); menuBar()->addMenu(fileMenu); menuBar()->addMenu(editMenu); diff --git a/src/gui/doc/snippets/transform/main.cpp b/src/gui/doc/snippets/transform/main.cpp index 56d6780269..cedffe218c 100644 --- a/src/gui/doc/snippets/transform/main.cpp +++ b/src/gui/doc/snippets/transform/main.cpp @@ -91,11 +91,10 @@ int main(int argc, char **argv) CombinedTransformation *combinedWidget = new CombinedTransformation; BasicOperations *basicWidget = new BasicOperations; - QVBoxLayout *layout = new QVBoxLayout; + QVBoxLayout *layout = new QVBoxLayout(&widget); layout->addWidget(simpleWidget); layout->addWidget(combinedWidget); layout->addWidget(basicWidget); - widget.setLayout(layout); widget.show(); widget.resize(130, 350); diff --git a/src/gui/doc/src/coordsys.qdoc b/src/gui/doc/src/coordsys.qdoc index eb39239e37..087916635b 100644 --- a/src/gui/doc/src/coordsys.qdoc +++ b/src/gui/doc/src/coordsys.qdoc @@ -213,11 +213,11 @@ \row \li {2,1} - \snippet analogclock/main.cpp 1 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 9 We translate the coordinate system so that point (0, 0) is in the widget's center, instead of being at the top-left corner. We also - scale the system by \c side / 100, where \c side is either the + scale the system by \c side / 200, where \c side is either the widget's width or the height, whichever is shortest. We want the clock to be square, even if the device isn't. @@ -227,7 +227,7 @@ See also the \l {Window-Viewport Conversion} section. - \snippet analogclock/main.cpp 2 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 18 We draw the clock's hour hand by rotating the coordinate system and calling QPainter::drawConvexPolygon(). Thank's to the @@ -235,26 +235,35 @@ The polygon is specified as an array of alternating \e x, \e y values, stored in the \c hourHand static variable (defined at the - beginning of the function), which corresponds to the four points - (2, 0), (0, 2), (-2, 0), and (0, -25). + beginning of the function), which corresponds to the three points + (7, 8), (-7, 8), (0, -40). The calls to QPainter::save() and QPainter::restore() surrounding the code guarantees that the code that follows won't be disturbed by the transformations we've used. - \snippet analogclock/main.cpp 3 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 21 + + After that, we draw the hour markers for the clock face, which + consists of twelve short lines at 30-degree intervals. When that + loop is done, the painter has been rotated a full circle back to + its original state, so we don't need to save and restore the state. + + \snippet ../widgets/widgets/analogclock/analogclock.cpp 24 We do the same for the clock's minute hand, which is defined by - the four points (1, 0), (0, 1), (-1, 0), and (0, -40). These + the three points (7, 8), (-7, 8), (0, -70). These coordinates specify a hand that is thinner and longer than the minute hand. - \snippet analogclock/main.cpp 4 + \snippet ../widgets/widgets/analogclock/analogclock.cpp 27 - Finally, we draw the clock face, which consists of twelve short - lines at 30-degree intervals. At the end of that, the painter is - rotated in a way which isn't very useful, but we're done with - painting so that doesn't matter. + Finally, we draw the minute markers for the clock face, which + consists of sixty short lines at 6-degree intervals. We skip every + fifth minute marker because we don't want to draw over the hour + markers. At the end of that, the painter is rotated in a way which + isn't very useful, but we're done with painting so that doesn't + matter. \endtable For more information about the transformation matrix, see the @@ -422,5 +431,5 @@ \endtable \endomit - \sa {Analog Clock Window Example} + \sa {Analog Clock} */ diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc index a8c5b8437c..7a756b304e 100644 --- a/src/gui/doc/src/dnd.qdoc +++ b/src/gui/doc/src/dnd.qdoc @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! + \keyword Drag and Drop in Qt \page dnd.html \title Drag and Drop \brief An overview of the drag and drop system provided by Qt. @@ -334,7 +335,9 @@ For example, we can copy the contents of a QLineEdit to the clipboard with the following code: - \snippet ../widgets/widgets/charactermap/mainwindow.cpp 11 + \code + QGuiApplication::clipboard()->setText(lineEdit->text(), QClipboard::Clipboard); + \endcode Data with different MIME types can also be put on the clipboard. Construct a QMimeData object and set data with setData() function in @@ -363,8 +366,6 @@ \li \l{draganddrop/draggableicons}{Draggable Icons} \li \l{draganddrop/draggabletext}{Draggable Text} \li \l{draganddrop/dropsite}{Drop Site} - \li \l{draganddrop/fridgemagnets}{Fridge Magnets} - \li \l{draganddrop/puzzle}{Drag and Drop Puzzle} \endlist \section1 Interoperating with Other Applications @@ -375,11 +376,10 @@ Cocoa Drag Manager. On X11, XDND uses MIME, so no translation is necessary. The Qt API is the same regardless of the platform. On Windows, MIME-aware applications can communicate by using clipboard format names that are MIME - types. Already some Windows applications use MIME naming conventions for + types. Some Windows applications already use MIME naming conventions for their clipboard formats. Custom classes for translating proprietary clipboard formats can be - registered by reimplementing QWinMime on Windows or - QMacPasteboardMime on \macos. - + registered by reimplementing QWindowsMimeConverter on Windows or + QUtiMimeConverter on \macos. */ diff --git a/src/gui/doc/src/external-resources.qdoc b/src/gui/doc/src/external-resources.qdoc index a02a9ddbf9..16bca2475d 100644 --- a/src/gui/doc/src/external-resources.qdoc +++ b/src/gui/doc/src/external-resources.qdoc @@ -8,7 +8,7 @@ */ /*! - \externalpage http://www.linux-foundation.org/en/Accessibility/IAccessible2 + \externalpage https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/index.html \title IAccessible2 Specification */ @@ -29,15 +29,24 @@ /*! \externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html - \title Icon Theme Specification + \title Freedesktop Icon Theme Specification */ /*! + \externalpage https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html + \title Freedesktop Icon Naming Specification +*/ +/*! \externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout \title Icon Theme Specification - Directory Layout */ /*! + \externalpage https://freedesktop.org/ + \title Freedesktop +*/ + +/*! \externalpage https://www.khronos.org/vulkan/ \title Vulkan */ @@ -46,3 +55,13 @@ \externalpage https://www.lunarg.com/vulkan-sdk/ \title LunarG Vulkan SDK */ + +/*! + \externalpage https://developer.android.com/reference/androidx/core/content/FileProvider + \title Android: FileProvider +*/ + +/*! + \externalpage https://developer.android.com/training/secure-file-sharing/setup-sharing.html + \title Android: Setting up file sharing +*/ diff --git a/src/gui/doc/src/includes/qt-colors.qdocinc b/src/gui/doc/src/includes/qt-colors.qdocinc index 4c082323b6..d98c0a908a 100644 --- a/src/gui/doc/src/includes/qt-colors.qdocinc +++ b/src/gui/doc/src/includes/qt-colors.qdocinc @@ -3,84 +3,105 @@ \li Name \li Hex \li Color + \row \li Color0 \li #000000 \li \svgcolor {#000000} + \row \li Color1 \li #ffffff \li \svgcolor {#ffffff} + \row \li Black \li #000000 \li \svgcolor {#000000} + \row \li White \li #ffffff \li \svgcolor {#ffffff} + \row \li DarkGray \li #808080 \li \svgcolor {#808080} + \row \li Gray \li #a0a0a4 \li \svgcolor {#a0a0a4} + \row \li LightGray \li #c0c0c0 \li \svgcolor {#c0c0c0} + \row \li Red \li #ff0000 \li \svgcolor {#ff0000} + \row \li Green \li #00ff00 \li \svgcolor {#00ff00} + \row \li Blue \li #0000ff \li \svgcolor {#0000ff} + \row \li Cyan \li #00ffff \li \svgcolor {#00ffff} + \row \li Magenta \li #ff00ff \li \svgcolor {#ff00ff} + \row \li Yellow \li #ffff00 \li \svgcolor {#ffff00} + \row \li DarkRed \li #800000 \li \svgcolor {#800000} + \row \li DarkGreen \li #008000 \li \svgcolor {#008000} + \row \li DarkBlue \li #000080 \li \svgcolor {#000080} + \row \li DarkCyan \li #008080 \li \svgcolor {#008080} + \row \li DarkMagenta \li #800080 \li \svgcolor {#800080} + \row \li DarkYellow \li #808000 \li \svgcolor {#808000} + \row \li Transparent \li #00000000 \li (transparent) + \endtable diff --git a/src/gui/doc/src/includes/svg-colors.qdocinc b/src/gui/doc/src/includes/svg-colors.qdocinc index 4e5fb56d5e..c28cbabbf7 100644 --- a/src/gui/doc/src/includes/svg-colors.qdocinc +++ b/src/gui/doc/src/includes/svg-colors.qdocinc @@ -3,592 +3,740 @@ \li Name \li Hex \li Color + \row \li aliceblue \li #f0f8ff \li \svgcolor {#f0f8ff} + \row \li antiquewhite \li #faebd7 \li \svgcolor {#faebd7} + \row \li aqua \li #00ffff \li \svgcolor {#00ffff} + \row \li aquamarine \li #7fffd4 \li \svgcolor {#7fffd4} + \row \li azure \li #f0ffff \li \svgcolor {#f0ffff} + \row \li beige \li #f5f5dc \li \svgcolor {#f5f5dc} + \row \li bisque \li #ffe4c4 \li \svgcolor {#ffe4c4} + \row \li black \li #000000 \li \svgcolor {#000000} + \row \li blanchedalmond \li #ffebcd \li \svgcolor {#ffebcd} + \row \li blue \li #0000ff \li \svgcolor {#0000ff} + \row \li blueviolet \li #8a2be2 \li \svgcolor {#8a2be2} + \row \li brown \li #a52a2a \li \svgcolor {#a52a2a} + \row \li burlywood \li #deb887 \li \svgcolor {#deb887} + \row \li cadetblue \li #5f9ea0 \li \svgcolor {#5f9ea0} + \row \li chartreuse \li #7fff00 \li \svgcolor {#7fff00} + \row \li chocolate \li #d2691e \li \svgcolor {#d2691e} + \row \li coral \li #ff7f50 \li \svgcolor {#ff7f50} + \row \li cornflowerblue \li #6495ed \li \svgcolor {#6495ed} + \row \li cornsilk \li #fff8dc \li \svgcolor {#fff8dc} + \row \li crimson \li #dc143c \li \svgcolor {#dc143c} + \row \li cyan \li #00ffff \li \svgcolor {#00ffff} + \row \li darkblue \li #00008b \li \svgcolor {#00008b} + \row \li darkcyan \li #008b8b \li \svgcolor {#008b8b} + \row \li darkgoldenrod \li #b8860b \li \svgcolor {#b8860b} + \row \li darkgray \li #a9a9a9 \li \svgcolor {#a9a9a9} + \row \li darkgreen \li #006400 \li \svgcolor {#006400} + \row \li darkgrey \li #a9a9a9 \li \svgcolor {#a9a9a9} + \row \li darkkhaki \li #bdb76b \li \svgcolor {#bdb76b} + \row \li darkmagenta \li #8b008b \li \svgcolor {#8b008b} + \row \li darkolivegreen \li #556b2f \li \svgcolor {#556b2f} + \row \li darkorange \li #ff8c00 \li \svgcolor {#ff8c00} + \row \li darkorchid \li #9932cc \li \svgcolor {#9932cc} + \row \li darkred \li #8b0000 \li \svgcolor {#8b0000} + \row \li darksalmon \li #e9967a \li \svgcolor {#e9967a} + \row \li darkseagreen \li #8fbc8f \li \svgcolor {#8fbc8f} + \row \li darkslateblue \li #483d8b \li \svgcolor {#483d8b} + \row \li darkslategray \li #2f4f4f \li \svgcolor {#2f4f4f} + \row \li darkslategrey \li #2f4f4f \li \svgcolor {#2f4f4f} + \row \li darkturquoise \li #00ced1 \li \svgcolor {#00ced1} + \row \li darkviolet \li #9400d3 \li \svgcolor {#9400d3} + \row \li deeppink \li #ff1493 \li \svgcolor {#ff1493} + \row \li deepskyblue \li #00bfff \li \svgcolor {#00bfff} + \row \li dimgray \li #696969 \li \svgcolor {#696969} + \row \li dimgrey \li #696969 \li \svgcolor {#696969} + \row \li dodgerblue \li #1e90ff \li \svgcolor {#1e90ff} + \row \li firebrick \li #b22222 \li \svgcolor {#b22222} + \row \li floralwhite \li #fffaf0 \li \svgcolor {#fffaf0} + \row \li forestgreen \li #228b22 \li \svgcolor {#228b22} + \row \li fuchsia \li #ff00ff \li \svgcolor {#ff00ff} + \row \li gainsboro \li #dcdcdc \li \svgcolor {#dcdcdc} + \row \li ghostwhite \li #f8f8ff \li \svgcolor {#f8f8ff} + \row \li gold \li #ffd700 \li \svgcolor {#ffd700} + \row \li goldenrod \li #daa520 \li \svgcolor {#daa520} + \row \li gray \li #808080 \li \svgcolor {#808080} + \row \li grey \li #808080 \li \svgcolor {#808080} + \row \li green \li #008000 \li \svgcolor {#008000} + \row \li greenyellow \li #adff2f \li \svgcolor {#adff2f} + \row \li honeydew \li #f0fff0 \li \svgcolor {#f0fff0} + \row \li hotpink \li #ff69b4 \li \svgcolor {#ff69b4} + \row \li indianred \li #cd5c5c \li \svgcolor {#cd5c5c} + \row \li indigo \li #4b0082 \li \svgcolor {#4b0082} + \row \li ivory \li #fffff0 \li \svgcolor {#fffff0} + \row \li khaki \li #f0e68c \li \svgcolor {#f0e68c} + \row \li lavender \li #e6e6fa \li \svgcolor {#e6e6fa} + \row \li lavenderblush \li #fff0f5 \li \svgcolor {#fff0f5} + \row \li lawngreen \li #7cfc00 \li \svgcolor {#7cfc00} + \row \li lemonchiffon \li #fffacd \li \svgcolor {#fffacd} + \row \li lightblue \li #add8e6 \li \svgcolor {#add8e6} + \row \li lightcoral \li #f08080 \li \svgcolor {#f08080} + \row \li lightcyan \li #e0ffff \li \svgcolor {#e0ffff} + \row \li lightgoldenrodyellow \li #fafad2 \li \svgcolor {#fafad2} + \row \li lightgray \li #d3d3d3 \li \svgcolor {#d3d3d3} + \row \li lightgreen \li #90ee90 \li \svgcolor {#90ee90} + \row \li lightgrey \li #d3d3d3 \li \svgcolor {#d3d3d3} + \row \li lightpink \li #ffb6c1 \li \svgcolor {#ffb6c1} + \row \li lightsalmon \li #ffa07a \li \svgcolor {#ffa07a} + \row \li lightseagreen \li #20b2aa \li \svgcolor {#20b2aa} + \row \li lightskyblue \li #87cefa \li \svgcolor {#87cefa} + \row \li lightslategray \li #778899 \li \svgcolor {#778899} + \row \li lightslategrey \li #778899 \li \svgcolor {#778899} + \row \li lightsteelblue \li #b0c4de \li \svgcolor {#b0c4de} + \row \li lightyellow \li #ffffe0 \li \svgcolor {#ffffe0} + \row \li lime \li #00ff00 \li \svgcolor {#00ff00} + \row \li limegreen \li #32cd32 \li \svgcolor {#32cd32} + \row \li linen \li #faf0e6 \li \svgcolor {#faf0e6} + \row \li magenta \li #ff00ff \li \svgcolor {#ff00ff} + \row \li maroon \li #800000 \li \svgcolor {#800000} + \row \li mediumaquamarine \li #66cdaa \li \svgcolor {#66cdaa} + \row \li mediumblue \li #0000cd \li \svgcolor {#0000cd} + \row \li mediumorchid \li #ba55d3 \li \svgcolor {#ba55d3} + \row \li mediumpurple \li #9370db \li \svgcolor {#9370db} + \row \li mediumseagreen \li #3cb371 \li \svgcolor {#3cb371} + \row \li mediumslateblue \li #7b68ee \li \svgcolor {#7b68ee} + \row \li mediumspringgreen \li #00fa9a \li \svgcolor {#00fa9a} + \row \li mediumturquoise \li #48d1cc \li \svgcolor {#48d1cc} + \row \li mediumvioletred \li #c71585 \li \svgcolor {#c71585} + \row \li midnightblue \li #191970 \li \svgcolor {#191970} + \row \li mintcream \li #f5fffa \li \svgcolor {#f5fffa} + \row \li mistyrose \li #ffe4e1 \li \svgcolor {#ffe4e1} + \row \li moccasin \li #ffe4b5 \li \svgcolor {#ffe4b5} + \row \li navajowhite \li #ffdead \li \svgcolor {#ffdead} + \row \li navy \li #000080 \li \svgcolor {#000080} + \row \li oldlace \li #fdf5e6 \li \svgcolor {#fdf5e6} + \row \li olive \li #808000 \li \svgcolor {#808000} + \row \li olivedrab \li #6b8e23 \li \svgcolor {#6b8e23} + \row \li orange \li #ffa500 \li \svgcolor {#ffa500} + \row \li orangered \li #ff4500 \li \svgcolor {#ff4500} + \row \li orchid \li #da70d6 \li \svgcolor {#da70d6} + \row \li palegoldenrod \li #eee8aa \li \svgcolor {#eee8aa} + \row \li palegreen \li #98fb98 \li \svgcolor {#98fb98} + \row \li paleturquoise \li #afeeee \li \svgcolor {#afeeee} + \row \li palevioletred \li #db7093 \li \svgcolor {#db7093} + \row \li papayawhip \li #ffefd5 \li \svgcolor {#ffefd5} + \row \li peachpuff \li #ffdab9 \li \svgcolor {#ffdab9} + \row \li peru \li #cd853f \li \svgcolor {#cd853f} + \row \li pink \li #ffc0cb \li \svgcolor {#ffc0cb} + \row \li plum \li #dda0dd \li \svgcolor {#dda0dd} + \row \li powderblue \li #b0e0e6 \li \svgcolor {#b0e0e6} + \row \li purple \li #800080 \li \svgcolor {#800080} + \row \li red \li #ff0000 \li \svgcolor {#ff0000} + \row \li rosybrown \li #bc8f8f \li \svgcolor {#bc8f8f} + \row \li royalblue \li #4169e1 \li \svgcolor {#4169e1} + \row \li saddlebrown \li #8b4513 \li \svgcolor {#8b4513} + \row \li salmon \li #fa8072 \li \svgcolor {#fa8072} + \row \li sandybrown \li #f4a460 \li \svgcolor {#f4a460} + \row \li seagreen \li #2e8b57 \li \svgcolor {#2e8b57} + \row \li seashell \li #fff5ee \li \svgcolor {#fff5ee} + \row \li sienna \li #a0522d \li \svgcolor {#a0522d} + \row \li silver \li #c0c0c0 \li \svgcolor {#c0c0c0} + \row \li skyblue \li #87ceeb \li \svgcolor {#87ceeb} + \row \li slateblue \li #6a5acd \li \svgcolor {#6a5acd} + \row \li slategray \li #708090 \li \svgcolor {#708090} + \row \li slategrey \li #708090 \li \svgcolor {#708090} + \row \li snow \li #fffafa \li \svgcolor {#fffafa} + \row \li springgreen \li #00ff7f \li \svgcolor {#00ff7f} + \row \li steelblue \li #4682b4 \li \svgcolor {#4682b4} + \row \li tan \li #d2b48c \li \svgcolor {#d2b48c} + \row \li teal \li #008080 \li \svgcolor {#008080} + \row \li thistle \li #d8bfd8 \li \svgcolor {#d8bfd8} + \row \li tomato \li #ff6347 \li \svgcolor {#ff6347} + \row \li turquoise \li #40e0d0 \li \svgcolor {#40e0d0} + \row \li violet \li #ee82ee \li \svgcolor {#ee82ee} + \row \li wheat \li #f5deb3 \li \svgcolor {#f5deb3} + \row \li white \li #ffffff \li \svgcolor {#ffffff} + \row \li whitesmoke \li #f5f5f5 \li \svgcolor {#f5f5f5} + \row \li yellow \li #ffff00 \li \svgcolor {#ffff00} + \row \li yellowgreen \li #9acd32 \li \svgcolor {#9acd32} + \endtable diff --git a/src/gui/doc/src/qt6-changes.qdoc b/src/gui/doc/src/qt6-changes.qdoc index 109a7f1750..60e1bffba8 100644 --- a/src/gui/doc/src/qt6-changes.qdoc +++ b/src/gui/doc/src/qt6-changes.qdoc @@ -5,7 +5,7 @@ \page gui-changes-qt6.html \title Changes to Qt GUI \ingroup changes-qt-5-to-6 - \brief Migrate Qt GUI to Qt 6. + \brief Kernel, Text, Painting, and Utility classes are modified. Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use. @@ -114,4 +114,38 @@ Metal, in addition to OpenGL. On Windows the default choice is Direct 3D, therefore the removal of ANGLE is alleviated by having support for graphics APIs other than OpenGL as well. + + \section2 Native clipboard integration + + Qt 5 provided interfaces for integrating platform specific or custom + clipboard formats into Qt through \c QMacPasteboardMime in \c QtMacExtras, + and \c QWindowsMime from the Windows QPA API. Since Qt 6.6, the + equivalent functionality is provided by the classes QUtiMimeConverter for + \macos, and the QWindowsMimeConverter for Windows. + + Porting from QWindowsMime to QWindowsMimeConverter requires practically no + changes, as the virtual interface is identical. However, in Qt 6 it is no + longer needed to register a QWindowsMimeConverter implementation; + instantiating the type implicitly registers the converter. + + Porting a QMacPasteboardMime to QUtiMimeConverter requires renaming some of + the virtual functions. Note that the \c{QMacPasteboardMime} API used the + outdated term \c{flavor} for the native clipboard format on \macos, whereas + the platform now uses \c{Uniform Type Identifiers}, i.e. \c{UTI}s, which Qt + has adapted for function and parameter names. + + The \c{mimeFor} and \c{flavorFor} functions are replaced by the + \l{QUtiMimeConverter::}{mimeForUti} and \l{QUtiMimeConverter::}{utiForMime} + implementations, respectively. Those should return the name of the mime + type or \c{UTI} that the converter can convert the input format to, so a + port usually just involves renaming existing overrides. The + \c{convertToMime}, \c{convertFromMime}, and \c{count} functions in + QUtiMimeConverter are identical to their QMacPasteboardMime versions. + + The \c{canConvert}, \c{converterName} functions are no longer needed, they + are implied by implementation of the above functions, so overrides of those + functions can be removed. + + As with the the QWindowsMimeConverter, registration is done by instantiating + the type. */ diff --git a/src/gui/doc/src/qtgui-overview.qdoc b/src/gui/doc/src/qtgui-overview.qdoc index ecd34f0e9e..446479c9be 100644 --- a/src/gui/doc/src/qtgui-overview.qdoc +++ b/src/gui/doc/src/qtgui-overview.qdoc @@ -51,6 +51,68 @@ that prefer more low-level APIs to text and font handling can use classes like QRawFont and QGlyphRun. + \section1 RHI Graphics + + The Qt Rendering Hardware Interface is an abstraction for hardware accelerated + graphics APIs, such as, \l{https://www.khronos.org/opengl/}{OpenGL}, + \l{https://www.khronos.org/opengles/}{OpenGL ES}, + \l{https://docs.microsoft.com/en-us/windows/desktop/direct3d}{Direct3D}, + \l{https://developer.apple.com/metal/}{Metal}, and + \l{https://www.khronos.org/vulkan/}{Vulkan}. + + As an alternative to using OpenGL or Vulkan directly to render to a + QWindow, \l QRhi and the related classes provide a portable, cross-platform + 3D graphics and compute API complemented by a shader conditioning and + transpiling pipeline. This way applications can avoid directly depending on + a single, and, in some cases, vendor or platform-specific 3D API. + + Below is a list of the main RHI-related classes. These are complemented by + a number of additional classes and structs. + + \list + \li QRhi + \li QShader + \li QShaderDescription + \li QRhiCommandBuffer + \li QRhiResourceUpdateBatch + \li QRhiBuffer + \li QRhiRenderBuffer + \li QRhiTexture + \li QRhiSampler + \li QRhiTextureRenderTarget + \li QRhiShaderResourceBindings + \li QRhiGraphicsPipeline + \li QRhiComputePipeline + \li QRhiSwapChain + \endlist + + See the \l{RHI Window Example} for an introductory example of creating a + portable, cross-platform application that performs accelerated 3D rendering + onto a QWindow using QRhi. + + Working directly with QWindow is the most advanced and often the most + flexible way of rendering with the QRhi API. It is the most low-level + approach, however, and limited in the sense that Qt's UI technologies, + widgets and Qt Quick, are not utilized at all. In many cases applications + will rather want to integrate QRhi-based rendering into a widget or Qt + Quick-based user interface. QWidget-based applications may choose to embed + the window as a native child into the widget hierarchy via + QWidget::createWindowContainer(), but in many cases \l QRhiWidget will + offer a more convenient enabler to integrate QRhi-based rendering into a + widget UI. Qt Quick provides its own set of enablers for extending the + 2D/3D scene with QRhi-based custom rendering. + + \note The RHI family of APIs are currently offered with a limited + compatibility guarantee, as opposed to regular Qt public APIs. See \l QRhi + for details. + + \section1 3D Matrix and Vector Math + + The Qt GUI module also contains a few math classes to aid with the most + common mathematical operations related to 3D graphics. These classes + include \l {QMatrix4x4}, \l {QVector2D}, \l {QVector3D}, \l {QVector4D}, + and \l {QQuaternion}. + \section1 OpenGL and OpenGL ES Integration QWindow supports rendering using OpenGL and OpenGL ES, depending on what the @@ -86,10 +148,6 @@ For more information, see the \l {OpenGL Window Example}. - The Qt GUI module also contains a few math classes to aid with the most - common mathematical operations related to 3D graphics. These classes include - \l {QMatrix4x4}, \l {QVector4D}, and \l {QQuaternion}. - A \l {QWindow} created with the \l {QSurface::OpenGLSurface} can be used in combination with \l QPainter and \l QOpenGLPaintDevice to have OpenGL hardware-accelerated 2D graphics by sacrificing some of the visual quality. @@ -104,20 +162,23 @@ On Android, Vulkan headers were added in API level 24 of the NDK. - Relevant classes: + The main relevant classes for low-level Vulkan support are: \list - \li QVulkanDeviceFunctions - \li QVulkanExtension - \li QVulkanFunctions - \li QVulkanInfoVector \li QVulkanInstance - \li QVulkanWindow - \li QVulkanWindowRenderer + \li QVulkanFunctions + \li QVulkanDeviceFunctions \endlist + In addition, \l QVulkanWindow provides a convenience subclass of QWindow + that makes it easier to get started with implementing Vulkan-based + rendering targeting a QWindow. Using this helper class is completely + optional; applications with more advanced Vulkan-based renderers may + instead want to use a QWindow with the \l {QSurface::VulkanSurface} type + directly. + For more information, see the \l{Hello Vulkan Widget Example} - and the \l {Hello Vulkan Window Example}. + and the \l {Hello Vulkan Triangle Example}. \section1 Drag and Drop diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index d39fa72221..2a1d69d4d3 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -15,6 +15,23 @@ */ /*! + \module QtGuiPrivate + \title Qt GUI Private C++ Classes + \qtcmakepackage Gui + \qtvariable gui-private + + \brief Provides access to private GUI functionality. + + Use the following CMake commands in your \c {CMakeLists.txt} to access + private Qt GUI APIs: + + \badcode + find_package(Qt6 REQUIRED COMPONENTS Gui) + target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) + \endcode +*/ + +/*! \page qtgui-index.html \title Qt GUI @@ -54,6 +71,8 @@ \list \li \l {Application Windows} {Qt GUI Application Windows} \li \l {2D Graphics} {Qt GUI 2D Graphics} + \li \l {RHI Graphics} {Qt GUI Accelerated 2D and 3D Graphics using the Qt RHI} + \li \l {3D Matrix and Vector Math} {Qt GUI Matrix and Vector Math} \li \l {OpenGL and OpenGL ES Integration} {Qt GUI OpenGL and OpenGL ES Integration} \li \l {Vulkan Integration} {Qt GUI Vulkan Integration} diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index 5ae7739481..10d9962850 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -11,10 +11,9 @@ \page richtext.html \title Rich Text Processing \brief An overview of Qt's rich text processing, editing and display features. - + \ingroup explanations-ui \ingroup frameworks-technologies \ingroup qt-basic-concepts - \ingroup best-practices \nextpage Rich Text Document Structure @@ -839,7 +838,11 @@ \section1 Supported Tags The following table lists the HTML tags supported by Qt's - \l{Rich Text Processing}{rich text} engine: + \l{Rich Text Processing}{rich text} engine. + + \note The functionality implemented for tags listed below is a subset of + the full HTML 4 specification. Not all attributes are supported, + see comments for each tag. \table 70% \header \li Tag |