OpenCoverage

qquickapplication.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickapplication.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qquickapplication_p.h"-
41#include <private/qquickscreen_p.h>-
42#include <private/qobject_p.h>-
43#include <private/qguiapplication_p.h>-
44#include <qpa/qplatformintegration.h>-
45#include <QtGui/QGuiApplication>-
46#include <QtCore/QDebug>-
47#include <QtQml/private/qqmlglobal_p.h>-
48-
49QT_BEGIN_NAMESPACE-
50-
51/*-
52 This object and its properties are documented as part of the Qt object,-
53 in qqmlengine.cpp-
54*/-
55-
56QQuickApplication::QQuickApplication(QObject *parent)-
57 : QQmlApplication(parent)-
58{-
59 if (qApp) {
(static_cast<Q...::instance()))Description
TRUEevaluated 12 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
FALSEnever evaluated
0-12
60 connect(qApp, SIGNAL(layoutDirectionChanged(Qt::LayoutDirection)),-
61 this, SIGNAL(layoutDirectionChanged()));-
62 connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),-
63 this, SIGNAL(stateChanged(Qt::ApplicationState)));-
64 connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),-
65 this, SIGNAL(activeChanged()));-
66 connect(qApp, SIGNAL(applicationDisplayNameChanged()),-
67 this, SIGNAL(displayNameChanged()));-
68-
69 connect(qApp, &QGuiApplication::screenAdded, this, &QQuickApplication::updateScreens);-
70 connect(qApp, &QGuiApplication::screenRemoved, this, &QQuickApplication::updateScreens);-
71 updateScreens();-
72 }
executed 12 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
73}
executed 12 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
74-
75QQuickApplication::~QQuickApplication()-
76{-
77}-
78-
79bool QQuickApplication::active() const-
80{-
81 return QGuiApplication::applicationState() == Qt::ApplicationActive;
executed 24 times by 2 tests: return QGuiApplication::applicationState() == Qt::ApplicationActive;
Executed by:
  • tst_examples
  • tst_qquickapplication
24
82}-
83-
84Qt::LayoutDirection QQuickApplication::layoutDirection() const-
85{-
86 return QGuiApplication::layoutDirection();
executed 10 times by 2 tests: return QGuiApplication::layoutDirection();
Executed by:
  • tst_examples
  • tst_qquickapplication
10
87}-
88-
89bool QQuickApplication::supportsMultipleWindows() const-
90{-
91 return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows);
never executed: return QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows);
0
92}-
93-
94Qt::ApplicationState QQuickApplication::state() const-
95{-
96 return QGuiApplication::applicationState();
executed 12 times by 1 test: return QGuiApplication::applicationState();
Executed by:
  • tst_qquickapplication
12
97}-
98-
99QFont QQuickApplication::font() const-
100{-
101 return QGuiApplication::font();
executed 2 times by 1 test: return QGuiApplication::font();
Executed by:
  • tst_qquickapplication
2
102}-
103-
104QString QQuickApplication::displayName() const-
105{-
106 return QGuiApplication::applicationDisplayName();
executed 8 times by 1 test: return QGuiApplication::applicationDisplayName();
Executed by:
  • tst_qquickapplication
8
107}-
108-
109void QQuickApplication::setDisplayName(const QString &displayName)-
110{-
111 return QGuiApplication::setApplicationDisplayName(displayName);
executed 2 times by 1 test: return QGuiApplication::setApplicationDisplayName(displayName);
Executed by:
  • tst_qquickapplication
2
112}-
113-
114int screens_count(QQmlListProperty<QQuickScreenInfo> *prop)-
115{-
116 return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->count();
executed 24 times by 1 test: return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->count();
Executed by:
  • tst_qquickscreen
24
117}-
118-
119QQuickScreenInfo *screens_at(QQmlListProperty<QQuickScreenInfo> *prop, int idx)-
120{-
121 return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->at(idx);
executed 6 times by 1 test: return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->at(idx);
Executed by:
  • tst_qquickscreen
6
122}-
123-
124QQmlListProperty<QQuickScreenInfo> QQuickApplication::screens()-
125{-
126 return QQmlListProperty<QQuickScreenInfo>(this,
executed 12 times by 1 test: return QQmlListProperty<QQuickScreenInfo>(this, const_cast<QVector<QQuickScreenInfo *> *>(&m_screens), &screens_count, &screens_at);
Executed by:
  • tst_qquickscreen
12
127 const_cast<QVector<QQuickScreenInfo *> *>(&m_screens), &screens_count, &screens_at);
executed 12 times by 1 test: return QQmlListProperty<QQuickScreenInfo>(this, const_cast<QVector<QQuickScreenInfo *> *>(&m_screens), &screens_count, &screens_at);
Executed by:
  • tst_qquickscreen
12
128}-
129-
130void QQuickApplication::updateScreens()-
131{-
132 const QList<QScreen *> screenList = QGuiApplication::screens();-
133 m_screens.resize(screenList.count());-
134 for (int i = 0; i < screenList.count(); ++i) {
i < screenList.count()Description
TRUEevaluated 12 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
FALSEevaluated 12 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
135 if (!m_screens[i])
!m_screens[i]Description
TRUEevaluated 12 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
FALSEnever evaluated
0-12
136 m_screens[i] = new QQuickScreenInfo(this);
executed 12 times by 4 tests: m_screens[i] = new QQuickScreenInfo(this);
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
137 m_screens[i]->setWrappedScreen(screenList[i]);-
138 }
executed 12 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
139 emit screensChanged();-
140}
executed 12 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickapplication
  • tst_qquickscreen
12
141-
142QT_END_NAMESPACE-
143-
144#include "moc_qquickapplication_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0