Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QGuiApplication>
4#include <QtQuick>
5
6int main(int argc, char *argv[]) {
7 QGuiApplication app(argc, argv);
8
10// C++
12
14list << 10 << QColor(Qt::green) << "bottles";
15
17map.insert("language", "QML");
18map.insert("released", QDate(2010, 9, 21));
19
24
25 view.setSource(QUrl::fromLocalFile("MyItem.qml"));
26 view.show();
27
28 return app.exec();
29}
30
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore \reentrant
Definition qdatetime.h:29
\macro qGuiApp
iterator insert(const Key &key, const T &value)
Definition qmap.h:688
The QQuickView class provides a window for displaying a Qt Quick user interface.
Definition qquickview.h:20
void setSource(const QUrl &)
Sets the source to the url, loads the QML component and instantiates it.
QQuickItem * rootObject() const
Returns the view's root \l {QQuickItem} {item}.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
Definition qurl.cpp:3368
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
void show()
Shows the window.
Definition qwindow.cpp:2254
QMap< QString, QString > map
[6]
int main()
[0]
@ green
Definition qnamespace.h:36
#define Q_ARG(Type, data)
Definition qobjectdefs.h:63
QList< int > list
[14]
QApplication app(argc, argv)
[0]
QQuickView * view
[0]
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...