diff options
author | Kai Köhne <kai.koehne@qt.io> | 2021-08-17 13:14:18 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2021-09-16 15:30:04 +0000 |
commit | 643b58a4298f5a901674658f5937f55ca4a83205 (patch) | |
tree | 409736b590cb01f0e501b9a9672312189d0ed0c8 /src/corelib/doc/snippets/resource-system/main.cpp | |
parent | d55a6891d18ee576a6f3e2c510eefee4a1639d7f (diff) |
Rewrite Qt Resource System overview
Restructure the Qt Resource System page to make the content more
accessible, and coherent:
- Focus less on the .qrc file format, but the overall use cases
- Treat CMake as first-class citizen
- Make it more obvious when to use :/, and when qrc:/
Some details that were deemed unnecessary were removed:
- details about the internal naming of the .cpp file when
qmake is used.
- References to QDir::addSearchPath() and the search path list were
removed. They relate IMO only indirectly to the Qt resource system.
- A lot of the explanation around Q_INIT_RESOURCE/Q_CLEANUP_RESOURCE
were dubious at best.
Pick-to: 6.2 6.2.0
Fixes: QTBUG-95126
Fixes: QTBUG-94977
Fixes: QTBUG-59394
Task-number: QTBUG-88044
Change-Id: I04b64f2366631b2106f047de121daf5fdb01073d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/resource-system/main.cpp')
-rw-r--r-- | src/corelib/doc/snippets/resource-system/main.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/resource-system/main.cpp b/src/corelib/doc/snippets/resource-system/main.cpp new file mode 100644 index 0000000000..892f29d01d --- /dev/null +++ b/src/corelib/doc/snippets/resource-system/main.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QQmlApplicationEngine> +#include <QAction> +#include <QIcon> +#include <QApplication> +#include <QWidget> + +class DummyWidget : public QWidget { + Q_OBJECT + + QAction *cutAct; + + DummyWidget() { + //! [QAction] + cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); + //! [QAction] + } +}; + +int main() +{ +//! [url] + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/myapp/main.qml")); +//! [url] +} |