Doc: Use qt_add_ui instead of qt6_add_ui
Task-number: QTBUG-126463 Change-Id: Ib5d207e72c0de436b4daec29efd8baec8a998103 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 4f39704602de001db4c9e82fb0708ee1b2713e38) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a0b6488969
commit
5fe247df39
@ -7,29 +7,29 @@ qt_wrap_ui(SOURCES mainwindow.ui)
|
||||
qt_add_executable(myapp ${SOURCES})
|
||||
#! [qt_wrap_ui]
|
||||
|
||||
#! [qt6_add_ui_1]
|
||||
#! [qt_add_ui_1]
|
||||
qt_add_executable(myapp mainwindow.cpp main.cpp)
|
||||
qt6_add_ui(myapp SOURCES mainwindow.ui)
|
||||
#! [qt6_add_ui_1]
|
||||
qt_add_ui(myapp SOURCES mainwindow.ui)
|
||||
#! [qt_add_ui_1]
|
||||
|
||||
#! [qt6_add_ui_2]
|
||||
#! [qt_add_ui_2]
|
||||
qt_add_executable(myapp mainwindow.cpp main.cpp)
|
||||
qt6_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES mainwindow.ui)
|
||||
#! [qt6_add_ui_2]
|
||||
qt_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES mainwindow.ui)
|
||||
#! [qt_add_ui_2]
|
||||
|
||||
#! [qt6_add_ui_3]
|
||||
#! [qt_add_ui_3]
|
||||
qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
|
||||
qt6_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES widget1.ui widget2.ui)
|
||||
#! [qt6_add_ui_3]
|
||||
qt_add_ui(myapp INCLUDE_PREFIX "src/files" SOURCES widget1.ui widget2.ui)
|
||||
#! [qt_add_ui_3]
|
||||
|
||||
#! [qt6_add_ui_4]
|
||||
#! [qt_add_ui_4]
|
||||
qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
|
||||
qt6_add_ui(myapp INCLUDE_PREFIX "src/files"
|
||||
qt_add_ui(myapp INCLUDE_PREFIX "src/files"
|
||||
SOURCES "my_ui_files_1/widget1.ui" "my_ui_files_2/widget2.ui")
|
||||
#! [qt6_add_ui_4]
|
||||
#! [qt_add_ui_4]
|
||||
|
||||
#! [qt6_add_ui_5]
|
||||
#! [qt_add_ui_5]
|
||||
qt_add_executable(myapp widget1.cpp widget2.cpp main.cpp)
|
||||
qt6_add_ui(myapp INCLUDE_PREFIX "src/files_1" SOURCES "my_ui_files/widget1.ui")
|
||||
qt6_add_ui(myapp INCLUDE_PREFIX "src/files_2" SOURCES "my_ui_files/widget2.ui")
|
||||
#! [qt6_add_ui_5]
|
||||
qt_add_ui(myapp INCLUDE_PREFIX "src/files_1" SOURCES "my_ui_files/widget1.ui")
|
||||
qt_add_ui(myapp INCLUDE_PREFIX "src/files_2" SOURCES "my_ui_files/widget2.ui")
|
||||
#! [qt_add_ui_5]
|
||||
|
@ -2,25 +2,25 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
|
||||
//! [qt6_add_ui_1]
|
||||
//! [qt_add_ui_1]
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
//! [qt6_add_ui_1]
|
||||
//! [qt_add_ui_1]
|
||||
|
||||
//! [qt6_add_ui_2]
|
||||
//! [qt_add_ui_2]
|
||||
#include "mainwindow.h"
|
||||
#include "src/files/ui_mainwindow.h"
|
||||
//! [qt6_add_ui_2]
|
||||
//! [qt_add_ui_2]
|
||||
|
||||
//! [qt6_add_ui_3_1]
|
||||
//! [qt_add_ui_3_1]
|
||||
#include "src/files/ui_widget1.h"
|
||||
//! [qt6_add_ui_3_1]
|
||||
//! [qt_add_ui_3_1]
|
||||
|
||||
//! [qt6_add_ui_3_2]
|
||||
//! [qt_add_ui_3_2]
|
||||
#include "src/files/ui_widget2.h"
|
||||
//! [qt6_add_ui_3_2]
|
||||
//! [qt_add_ui_3_2]
|
||||
|
||||
//! [qt6_add_ui_5]
|
||||
//! [qt_add_ui_5]
|
||||
#include "src/files_1/ui_widget1.h"
|
||||
#include "src/files_2/ui_widget2.h"
|
||||
//! [qt6_add_ui_5]
|
||||
//! [qt_add_ui_5]
|
||||
|
@ -104,24 +104,24 @@ You can find possible options in the \l{uic}{uic documentation}.
|
||||
In the following snippet, the \c{mainwindow.cpp} file includes
|
||||
\c{ui_mainwindow.h} and \c{mainwindow.h}.
|
||||
|
||||
\snippet cmake-macros/examples.cpp qt6_add_ui_1
|
||||
\snippet cmake-macros/examples.cpp qt_add_ui_1
|
||||
|
||||
\c{CMakeLists.txt} is implemented as follows and it calls
|
||||
\c{qt_add_ui} to add \c{ui_mainwindow.h} to the \c{myapp} target.
|
||||
|
||||
\snippet cmake-macros/examples.cmake qt6_add_ui_1
|
||||
\snippet cmake-macros/examples.cmake qt_add_ui_1
|
||||
|
||||
In the above example, \c{ui_mainwindow.h} is included without a prefix. So the
|
||||
\c{INCLUDE_PREFIX} argument is not specified.
|
||||
|
||||
\section2 With INCLUDE_PREFIX
|
||||
|
||||
\snippet cmake-macros/examples.cpp qt6_add_ui_2
|
||||
\snippet cmake-macros/examples.cpp qt_add_ui_2
|
||||
|
||||
In the above snippet, \c{mainwindow.cpp} includes \c{ui_mainwindow.h} with a
|
||||
prefix.
|
||||
|
||||
\snippet cmake-macros/examples.cmake qt6_add_ui_2
|
||||
\snippet cmake-macros/examples.cmake qt_add_ui_2
|
||||
|
||||
Since \c{ui_mainwindow.h} is included with a prefix, the \c{INCLUDE_PREFIX}
|
||||
argument is specified as \c{src/files} in the above example.
|
||||
@ -133,15 +133,15 @@ In the following snippets, both \c{widget1.cpp} and \c{widget2.cpp} include
|
||||
|
||||
\c{widget1.cpp}:
|
||||
|
||||
\snippet cmake-macros/examples.cpp qt6_add_ui_3_1
|
||||
\snippet cmake-macros/examples.cpp qt_add_ui_3_1
|
||||
|
||||
\c{widget2.cpp}:
|
||||
|
||||
\snippet cmake-macros/examples.cpp qt6_add_ui_3_2
|
||||
\snippet cmake-macros/examples.cpp qt_add_ui_3_2
|
||||
|
||||
Both \c{ui_widget1.h} and \c{ui_widget2.h} are included with the same prefix
|
||||
|
||||
\snippet cmake-macros/examples.cmake qt6_add_ui_3
|
||||
\snippet cmake-macros/examples.cmake qt_add_ui_3
|
||||
|
||||
In this case, the \c{INCLUDE_PREFIX} argument can be specified as \c{src/files}
|
||||
for both files in the above snippet.
|
||||
|
Loading…
x
Reference in New Issue
Block a user