kernel/qdesktopwidget_qpa.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5void QDesktopWidgetPrivate::updateScreenList() -
6{ -
7 QDesktopWidget * const q = q_func(); -
8 QList<QScreen *> screenList = QGuiApplication::screens(); -
9 int targetLength = screenList.length(); -
10 int currentLength = screens.length(); -
11 -
12 -
13 if(currentLength > targetLength) {
partially evaluated: currentLength > targetLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:131
0-131
14 QDesktopScreenWidget *screen; -
15 while (currentLength-- > targetLength) {
never evaluated: currentLength-- > targetLength
0
16 screen = screens.takeLast(); -
17 delete screen; -
18 }
never executed: }
0
19 }
never executed: }
0
20 else if (currentLength < targetLength) {
partially evaluated: currentLength < targetLength
TRUEFALSE
yes
Evaluation Count:131
no
Evaluation Count:0
0-131
21 QDesktopScreenWidget *screen; -
22 while (currentLength < targetLength) {
evaluated: currentLength < targetLength
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:131
131
23 screen = new QDesktopScreenWidget(currentLength++); -
24 screens.append(screen); -
25 }
executed: }
Execution Count:131
131
26 }
executed: }
Execution Count:131
131
27 -
28 QRegion virtualGeometry; -
29 -
30 -
31 for (int i = 0; i < screens.length(); i++) {
evaluated: i < screens.length()
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:131
131
32 QRect screenGeometry = screenList.at(i)->geometry(); -
33 screens.at(i)->setGeometry(screenGeometry); -
34 virtualGeometry += screenGeometry; -
35 }
executed: }
Execution Count:131
131
36 -
37 q->setGeometry(virtualGeometry.boundingRect()); -
38}
executed: }
Execution Count:131
131
39 -
40QDesktopWidget::QDesktopWidget() -
41 : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) -
42{ -
43 QDesktopWidgetPrivate * const d = d_func(); -
44 setObjectName(QLatin1String("desktop")); -
45 d->updateScreenList(); -
46}
executed: }
Execution Count:131
131
47 -
48QDesktopWidget::~QDesktopWidget() -
49{ -
50} -
51 -
52bool QDesktopWidget::isVirtualDesktop() const -
53{ -
54 return QGuiApplication::primaryScreen()->virtualSiblings().size() > 1;
executed: return QGuiApplication::primaryScreen()->virtualSiblings().size() > 1;
Execution Count:388
388
55} -
56 -
57int QDesktopWidget::primaryScreen() const -
58{ -
59 return 0;
executed: return 0;
Execution Count:16
16
60} -
61 -
62int QDesktopWidget::numScreens() const -
63{ -
64 return qMax(QGuiApplication::screens().size(), 1);
executed: return qMax(QGuiApplication::screens().size(), 1);
Execution Count:21
21
65} -
66 -
67QWidget *QDesktopWidget::screen(int screen) -
68{ -
69 QDesktopWidgetPrivate * const d = d_func(); -
70 if (screen < 0 || screen >= d->screens.length())
partially evaluated: screen < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
partially evaluated: screen >= d->screens.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
71 return d->screens.at(0);
never executed: return d->screens.at(0);
0
72 return d->screens.at(screen);
executed: return d->screens.at(screen);
Execution Count:16
16
73} -
74 -
75const QRect QDesktopWidget::availableGeometry(int screenNo) const -
76{ -
77 QList<QScreen *> screens = QGuiApplication::screens(); -
78 if (screenNo == -1)
evaluated: screenNo == -1
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:1487
22-1487
79 screenNo = 0;
executed: screenNo = 0;
Execution Count:22
22
80 if (screenNo < 0 || screenNo >= screens.size())
partially evaluated: screenNo < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1509
partially evaluated: screenNo >= screens.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1509
0-1509
81 return QRect();
never executed: return QRect();
0
82 else -
83 return screens.at(screenNo)->availableGeometry();
executed: return screens.at(screenNo)->availableGeometry();
Execution Count:1509
1509
84} -
85 -
86const QRect QDesktopWidget::screenGeometry(int screenNo) const -
87{ -
88 QList<QScreen *> screens = QGuiApplication::screens(); -
89 if (screenNo == -1)
evaluated: screenNo == -1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1847
2-1847
90 screenNo = 0;
executed: screenNo = 0;
Execution Count:2
2
91 if (screenNo < 0 || screenNo >= screens.size())
partially evaluated: screenNo < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1849
partially evaluated: screenNo >= screens.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1849
0-1849
92 return QRect();
never executed: return QRect();
0
93 else -
94 return screens.at(screenNo)->geometry();
executed: return screens.at(screenNo)->geometry();
Execution Count:1849
1849
95} -
96 -
97int QDesktopWidget::screenNumber(const QWidget *w) const -
98{ -
99 if (!w)
evaluated: !w
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1347
2-1347
100 return 0;
executed: return 0;
Execution Count:2
2
101 -
102 QRect frame = w->frameGeometry(); -
103 if (!w->isWindow())
evaluated: !w->isWindow()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:1308
39-1308
104 frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
executed: frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
Execution Count:39
39
105 const QPoint midpoint = (frame.topLeft() + frame.bottomRight()) / 2; -
106 return screenNumber(midpoint);
executed: return screenNumber(midpoint);
Execution Count:1347
1347
107} -
108 -
109int QDesktopWidget::screenNumber(const QPoint &p) const -
110{ -
111 QList<QScreen *> screens = QGuiApplication::screens(); -
112 -
113 for (int i = 0; i < screens.size(); ++i)
evaluated: i < screens.size()
TRUEFALSE
yes
Evaluation Count:3337
yes
Evaluation Count:4
4-3337
114 if (screens.at(i)->geometry().contains(p))
evaluated: screens.at(i)->geometry().contains(p)
TRUEFALSE
yes
Evaluation Count:3333
yes
Evaluation Count:4
4-3333
115 return i;
executed: return i;
Execution Count:3333
3333
116 -
117 return primaryScreen();
executed: return primaryScreen();
Execution Count:4
4
118} -
119 -
120void QDesktopWidget::resizeEvent(QResizeEvent *) -
121{ -
122} -
123 -
124 -
125 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial