Example: remove runfunction example
This example shows how to use QtConcurrent::run by calling a global function and printing the thread ID. As the documentation already explains the functionality very well, I don't think this example is necessary. https://doc.qt.io/qt-6/qtconcurrentrun.html Task-number: QTBUG-111165 Pick-to: 6.5 6.5.0 Change-Id: I42a718cdaabdaeeab39b933d12c67d11978c95da Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>bb10
parent
fbb470b40b
commit
de5e0422ca
|
|
@ -7,6 +7,5 @@ endif()
|
|||
if(TARGET Qt6::Widgets)
|
||||
qt_internal_add_example(imagescaling)
|
||||
qt_internal_add_example(progressdialog)
|
||||
qt_internal_add_example(runfunction)
|
||||
qt_internal_add_example(wordcount)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@ requires(qtHaveModule(concurrent))
|
|||
TEMPLATE = subdirs
|
||||
SUBDIRS = imagescaling \
|
||||
progressdialog \
|
||||
runfunction \
|
||||
wordcount
|
||||
|
||||
!qtHaveModule(widgets) {
|
||||
SUBDIRS -= \
|
||||
imagescaling \
|
||||
progressdialog \
|
||||
runfunction \
|
||||
wordcount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(runfunction LANGUAGES CXX)
|
||||
|
||||
if(NOT DEFINED INSTALL_EXAMPLESDIR)
|
||||
set(INSTALL_EXAMPLESDIR "examples")
|
||||
endif()
|
||||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/runfunction")
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
|
||||
|
||||
qt_standard_project_setup()
|
||||
|
||||
qt_add_executable(runfunction
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(runfunction PRIVATE
|
||||
Qt6::Concurrent
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
)
|
||||
|
||||
install(TARGETS runfunction
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\example runfunction
|
||||
\title Run Function Example
|
||||
\brief Demonstrates how to run standard functions concurrently.
|
||||
\ingroup qtconcurrentexamples
|
||||
|
||||
The QtConcurrent Run Function example shows how to apply concurrency to
|
||||
a standard function, using QFuture instances to retrieve return values
|
||||
at a later time.
|
||||
|
||||
This is a command-line application.
|
||||
*/
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
#include <qtconcurrentrun.h>
|
||||
#include <QApplication>
|
||||
|
||||
using namespace QtConcurrent;
|
||||
|
||||
void hello(QString name)
|
||||
{
|
||||
qDebug() << "Hello" << name << "from" << QThread::currentThread();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QFuture<void> f1 = run(hello, QString("Alice"));
|
||||
QFuture<void> f2 = run(hello, QString("Bob"));
|
||||
f1.waitForFinished();
|
||||
f2.waitForFinished();
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
QT += concurrent widgets
|
||||
CONFIG += cmdline
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/qtconcurrent/runfunction
|
||||
INSTALLS += target
|
||||
Loading…
Reference in New Issue