Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | void 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 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 | } | 0 |
19 | } | 0 |
20 | else if (currentLength < targetLength) { partially evaluated: currentLength < targetLength yes Evaluation Count:131 | no Evaluation Count:0 |
| 0-131 |
21 | QDesktopScreenWidget *screen; | - |
22 | while (currentLength < targetLength) { evaluated: currentLength < targetLength 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() 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 | | - |
40 | QDesktopWidget::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 | | - |
48 | QDesktopWidget::~QDesktopWidget() | - |
49 | { | - |
50 | } | - |
51 | | - |
52 | bool QDesktopWidget::isVirtualDesktop() const | - |
53 | { | - |
54 | return QGuiApplication::primaryScreen()->virtualSiblings().size() > 1; executed: return QGuiApplication::primaryScreen()->virtualSiblings().size() > 1; Execution Count:388 | 388 |
55 | } | - |
56 | | - |
57 | int QDesktopWidget::primaryScreen() const | - |
58 | { | - |
59 | return 0; executed: return 0; Execution Count:16 | 16 |
60 | } | - |
61 | | - |
62 | int QDesktopWidget::numScreens() const | - |
63 | { | - |
64 | return qMax(QGuiApplication::screens().size(), 1); executed: return qMax(QGuiApplication::screens().size(), 1); Execution Count:21 | 21 |
65 | } | - |
66 | | - |
67 | QWidget *QDesktopWidget::screen(int screen) | - |
68 | { | - |
69 | QDesktopWidgetPrivate * const d = d_func(); | - |
70 | if (screen < 0 || screen >= d->screens.length()) partially evaluated: screen < 0 no Evaluation Count:0 | yes Evaluation Count:16 |
partially evaluated: screen >= d->screens.length() 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 | | - |
75 | const QRect QDesktopWidget::availableGeometry(int screenNo) const | - |
76 | { | - |
77 | QList<QScreen *> screens = QGuiApplication::screens(); | - |
78 | if (screenNo == -1) evaluated: screenNo == -1 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 no Evaluation Count:0 | yes Evaluation Count:1509 |
partially evaluated: screenNo >= screens.size() 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 | | - |
86 | const QRect QDesktopWidget::screenGeometry(int screenNo) const | - |
87 | { | - |
88 | QList<QScreen *> screens = QGuiApplication::screens(); | - |
89 | if (screenNo == -1) evaluated: screenNo == -1 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 no Evaluation Count:0 | yes Evaluation Count:1849 |
partially evaluated: screenNo >= screens.size() 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 | | - |
97 | int QDesktopWidget::screenNumber(const QWidget *w) const | - |
98 | { | - |
99 | if (!w) evaluated: !w 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() 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 | | - |
109 | int 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() 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) 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 | | - |
120 | void QDesktopWidget::resizeEvent(QResizeEvent *) | - |
121 | { | - |
122 | } | - |
123 | | - |
124 | | - |
125 | | - |
| | |