Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | __attribute__((visibility("default"))) void qDeleteInEventHandler(QObject *o); | - |
7 | | - |
8 | class QWhatsThat : public QWidget | - |
9 | { | - |
10 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
11 | | - |
12 | public: | - |
13 | QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor); | - |
14 | ~QWhatsThat() ; | - |
15 | | - |
16 | static QWhatsThat *instance; | - |
17 | | - |
18 | protected: | - |
19 | void showEvent(QShowEvent *e); | - |
20 | void mousePressEvent(QMouseEvent*); | - |
21 | void mouseReleaseEvent(QMouseEvent*); | - |
22 | void mouseMoveEvent(QMouseEvent*); | - |
23 | void keyPressEvent(QKeyEvent*); | - |
24 | void paintEvent(QPaintEvent*); | - |
25 | | - |
26 | private: | - |
27 | QPointer<QWidget>widget; | - |
28 | bool pressed; | - |
29 | QString text; | - |
30 | QTextDocument* doc; | - |
31 | QString anchor; | - |
32 | QPixmap background; | - |
33 | }; | - |
34 | | - |
35 | QWhatsThat *QWhatsThat::instance = 0; | - |
36 | | - |
37 | | - |
38 | static int shadowWidth = 6; | - |
39 | static const int vMargin = 8; | - |
40 | static const int hMargin = 12; | - |
41 | | - |
42 | static inline bool dropShadow() | - |
43 | { | - |
44 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
45 | return theme->themeHint(QPlatformTheme::DropShadow).toBool(); executed: return theme->themeHint(QPlatformTheme::DropShadow).toBool(); Execution Count:2 | 2 |
46 | return false; never executed: return false; | 0 |
47 | } | - |
48 | | - |
49 | QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor) | - |
50 | : QWidget(parent, Qt::Popup), | - |
51 | widget(showTextFor), pressed(false), text(txt) | - |
52 | { | - |
53 | delete instance; | - |
54 | instance = this; | - |
55 | setAttribute(Qt::WA_DeleteOnClose, true); | - |
56 | setAttribute(Qt::WA_NoSystemBackground, true); | - |
57 | if (parent) partially evaluated: parent no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
58 | setPalette(parent->palette()); never executed: setPalette(parent->palette()); | 0 |
59 | setMouseTracking(true); | - |
60 | setFocusPolicy(Qt::StrongFocus); | - |
61 | | - |
62 | setCursor(Qt::ArrowCursor); | - |
63 | | - |
64 | QRect r; | - |
65 | doc = 0; | - |
66 | ensurePolished(); | - |
67 | if (Qt::mightBeRichText(text)) { partially evaluated: Qt::mightBeRichText(text) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
68 | doc = new QTextDocument(); | - |
69 | doc->setUndoRedoEnabled(false); | - |
70 | doc->setDefaultFont(QApplication::font(this)); | - |
71 | | - |
72 | | - |
73 | | - |
74 | doc->setHtml(text); | - |
75 | | - |
76 | doc->setUndoRedoEnabled(false); | - |
77 | doc->adjustSize(); | - |
78 | r.setTop(0); | - |
79 | r.setLeft(0); | - |
80 | r.setSize(doc->size().toSize()); | - |
81 | } | 0 |
82 | else | - |
83 | { | - |
84 | int sw = QApplication::desktop()->width() / 3; | - |
85 | if (sw < 200) partially evaluated: sw < 200 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
86 | sw = 200; never executed: sw = 200; | 0 |
87 | else if (sw > 300) partially evaluated: sw > 300 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
88 | sw = 300; executed: sw = 300; Execution Count:1 | 1 |
89 | | - |
90 | r = fontMetrics().boundingRect(0, 0, sw, 1000, | - |
91 | Qt::AlignLeft + Qt::AlignTop | - |
92 | + Qt::TextWordWrap + Qt::TextExpandTabs, | - |
93 | text); | - |
94 | } executed: } Execution Count:1 | 1 |
95 | shadowWidth = dropShadow() ? 0 : 6; partially evaluated: dropShadow() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
96 | resize(r.width() + 2*hMargin + shadowWidth, r.height() + 2*vMargin + shadowWidth); | - |
97 | } executed: } Execution Count:1 | 1 |
98 | | - |
99 | QWhatsThat::~QWhatsThat() | - |
100 | { | - |
101 | instance = 0; | - |
102 | if (doc) | 0 |
103 | delete doc; never executed: delete doc; | 0 |
104 | } | 0 |
105 | | - |
106 | void QWhatsThat::showEvent(QShowEvent *) | - |
107 | { | - |
108 | background = QGuiApplication::primaryScreen()->grabWindow(QApplication::desktop()->internalWinId(), | - |
109 | x(), y(), width(), height()); | - |
110 | } executed: } Execution Count:1 | 1 |
111 | | - |
112 | void QWhatsThat::mousePressEvent(QMouseEvent* e) | - |
113 | { | - |
114 | pressed = true; | - |
115 | if (e->button() == Qt::LeftButton && rect().contains(e->pos())) { never evaluated: e->button() == Qt::LeftButton never evaluated: rect().contains(e->pos()) | 0 |
116 | if (doc) | 0 |
117 | anchor = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin)); never executed: anchor = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin)); | 0 |
118 | return; | 0 |
119 | } | - |
120 | close(); | - |
121 | } | 0 |
122 | | - |
123 | void QWhatsThat::mouseReleaseEvent(QMouseEvent* e) | - |
124 | { | - |
125 | if (!pressed) never evaluated: !pressed | 0 |
126 | return; | 0 |
127 | if (widget && e->button() == Qt::LeftButton && doc && rect().contains(e->pos())) { never evaluated: e->button() == Qt::LeftButton never evaluated: rect().contains(e->pos()) | 0 |
128 | QString a = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin)); | - |
129 | QString href; | - |
130 | if (anchor == a) never evaluated: anchor == a | 0 |
131 | href = a; never executed: href = a; | 0 |
132 | anchor.clear(); | - |
133 | if (!href.isEmpty()) { never evaluated: !href.isEmpty() | 0 |
134 | QWhatsThisClickedEvent e(href); | - |
135 | if (QApplication::sendEvent(widget, &e)) never evaluated: QApplication::sendEvent(widget, &e) | 0 |
136 | return; | 0 |
137 | } | 0 |
138 | } | 0 |
139 | close(); | - |
140 | } | 0 |
141 | | - |
142 | void QWhatsThat::mouseMoveEvent(QMouseEvent* e) | - |
143 | { | - |
144 | | - |
145 | | - |
146 | | - |
147 | if (!doc) | 0 |
148 | return; | 0 |
149 | QString a = doc->documentLayout()->anchorAt(e->pos() - QPoint(hMargin, vMargin)); | - |
150 | if (!a.isEmpty()) never evaluated: !a.isEmpty() | 0 |
151 | setCursor(Qt::PointingHandCursor); never executed: setCursor(Qt::PointingHandCursor); | 0 |
152 | else | - |
153 | setCursor(Qt::ArrowCursor); never executed: setCursor(Qt::ArrowCursor); | 0 |
154 | | - |
155 | } | - |
156 | | - |
157 | void QWhatsThat::keyPressEvent(QKeyEvent*) | - |
158 | { | - |
159 | close(); | - |
160 | } | 0 |
161 | | - |
162 | void QWhatsThat::paintEvent(QPaintEvent*) | - |
163 | { | - |
164 | const bool drawShadow = dropShadow(); | - |
165 | | - |
166 | QRect r = rect(); | - |
167 | r.adjust(0, 0, -1, -1); | - |
168 | if (drawShadow) partially evaluated: drawShadow no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
169 | r.adjust(0, 0, -shadowWidth, -shadowWidth); never executed: r.adjust(0, 0, -shadowWidth, -shadowWidth); | 0 |
170 | QPainter p(this); | - |
171 | p.drawPixmap(0, 0, background); | - |
172 | p.setPen(QPen(palette().toolTipText(), 0)); | - |
173 | p.setBrush(palette().toolTipBase()); | - |
174 | p.drawRect(r); | - |
175 | int w = r.width(); | - |
176 | int h = r.height(); | - |
177 | p.setPen(palette().brush(QPalette::Dark).color()); | - |
178 | p.drawRect(1, 1, w-2, h-2); | - |
179 | if (drawShadow) { partially evaluated: drawShadow no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
180 | p.setPen(palette().shadow().color()); | - |
181 | p.drawPoint(w + 5, 6); | - |
182 | p.drawLine(w + 3, 6, w + 5, 8); | - |
183 | p.drawLine(w + 1, 6, w + 5, 10); | - |
184 | int i; | - |
185 | for(i=7; i < h; i += 2) | 0 |
186 | p.drawLine(w, i, w + 5, i + 5); never executed: p.drawLine(w, i, w + 5, i + 5); | 0 |
187 | for(i = w - i + h; i > 6; i -= 2) | 0 |
188 | p.drawLine(i, h, i + 5, h + 5); never executed: p.drawLine(i, h, i + 5, h + 5); | 0 |
189 | for(; i > 0 ; i -= 2) | 0 |
190 | p.drawLine(6, h + 6 - i, i + 5, h + 5); never executed: p.drawLine(6, h + 6 - i, i + 5, h + 5); | 0 |
191 | } | 0 |
192 | r.adjust(0, 0, 1, 1); | - |
193 | p.setPen(palette().toolTipText().color()); | - |
194 | r.adjust(hMargin, vMargin, -hMargin, -vMargin); | - |
195 | | - |
196 | if (doc) { partially evaluated: doc no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
197 | p.translate(r.x(), r.y()); | - |
198 | QRect rect = r; | - |
199 | rect.translate(-r.x(), -r.y()); | - |
200 | p.setClipRect(rect); | - |
201 | QAbstractTextDocumentLayout::PaintContext context; | - |
202 | context.palette.setBrush(QPalette::Text, context.palette.toolTipText()); | - |
203 | doc->documentLayout()->draw(&p, context); | - |
204 | } | 0 |
205 | else | - |
206 | { | - |
207 | p.drawText(r, Qt::AlignLeft + Qt::AlignTop + Qt::TextWordWrap + Qt::TextExpandTabs, text); | - |
208 | } executed: } Execution Count:1 | 1 |
209 | } | - |
210 | | - |
211 | static const char * const button_image[] = { | - |
212 | "16 16 3 1", | - |
213 | " c None", | - |
214 | "o c #000000", | - |
215 | "a c #000080", | - |
216 | "o aaaaa ", | - |
217 | "oo aaa aaa ", | - |
218 | "ooo aaa aaa", | - |
219 | "oooo aa aa", | - |
220 | "ooooo aa aa", | - |
221 | "oooooo a aaa", | - |
222 | "ooooooo aaa ", | - |
223 | "oooooooo aaa ", | - |
224 | "ooooooooo aaa ", | - |
225 | "ooooo aaa ", | - |
226 | "oo ooo ", | - |
227 | "o ooo aaa ", | - |
228 | " ooo aaa ", | - |
229 | " ooo ", | - |
230 | " ooo ", | - |
231 | " ooo "}; | - |
232 | | - |
233 | class QWhatsThisPrivate : public QObject | - |
234 | { | - |
235 | public: | - |
236 | QWhatsThisPrivate(); | - |
237 | ~QWhatsThisPrivate(); | - |
238 | static QWhatsThisPrivate *instance; | - |
239 | bool eventFilter(QObject *, QEvent *); | - |
240 | QPointer<QAction> action; | - |
241 | static void say(QWidget *, const QString &, int x = 0, int y = 0); | - |
242 | static void notifyToplevels(QEvent *e); | - |
243 | bool leaveOnMouseRelease; | - |
244 | }; | - |
245 | | - |
246 | void QWhatsThisPrivate::notifyToplevels(QEvent *e) | - |
247 | { | - |
248 | QWidgetList toplevels = QApplication::topLevelWidgets(); | - |
249 | for (int i = 0; i < toplevels.count(); ++i) { partially evaluated: i < toplevels.count() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
250 | register QWidget *w = toplevels.at(i); | - |
251 | QApplication::sendEvent(w, e); | - |
252 | } | 0 |
253 | } executed: } Execution Count:1 | 1 |
254 | | - |
255 | QWhatsThisPrivate *QWhatsThisPrivate::instance = 0; | - |
256 | | - |
257 | QWhatsThisPrivate::QWhatsThisPrivate() | - |
258 | : leaveOnMouseRelease(false) | - |
259 | { | - |
260 | instance = this; | - |
261 | (static_cast<QApplication *>(QCoreApplication::instance()))->installEventFilter(this); | - |
262 | | - |
263 | QPoint pos = QCursor::pos(); | - |
264 | if (QWidget *w = QApplication::widgetAt(pos)) { never evaluated: QWidget *w = QApplication::widgetAt(pos) | 0 |
265 | QHelpEvent e(QEvent::QueryWhatsThis, w->mapFromGlobal(pos), pos); | - |
266 | bool sentEvent = QApplication::sendEvent(w, &e); | - |
267 | | - |
268 | | - |
269 | | - |
270 | QApplication::setOverrideCursor((!sentEvent || !e.isAccepted())? | - |
271 | Qt::ForbiddenCursor:Qt::WhatsThisCursor); | - |
272 | } else { | 0 |
273 | QApplication::setOverrideCursor(Qt::WhatsThisCursor); | - |
274 | | - |
275 | } | 0 |
276 | | - |
277 | QAccessibleEvent event(this, QAccessible::ContextHelpStart); | - |
278 | QAccessible::updateAccessibility(&event); | - |
279 | | - |
280 | } | 0 |
281 | | - |
282 | QWhatsThisPrivate::~QWhatsThisPrivate() | - |
283 | { | - |
284 | if (action) | 0 |
285 | action->setChecked(false); never executed: action->setChecked(false); | 0 |
286 | | - |
287 | QApplication::restoreOverrideCursor(); | - |
288 | | - |
289 | | - |
290 | QAccessibleEvent event(this, QAccessible::ContextHelpEnd); | - |
291 | QAccessible::updateAccessibility(&event); | - |
292 | | - |
293 | instance = 0; | - |
294 | } | 0 |
295 | | - |
296 | bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e) | - |
297 | { | - |
298 | if (!o->isWidgetType()) never evaluated: !o->isWidgetType() | 0 |
299 | return false; never executed: return false; | 0 |
300 | QWidget * w = static_cast<QWidget *>(o); | - |
301 | bool customWhatsThis = w->testAttribute(Qt::WA_CustomWhatsThis); | - |
302 | switch (e->type()) { | - |
303 | case QEvent::MouseButtonPress: | - |
304 | { | - |
305 | QMouseEvent *me = static_cast<QMouseEvent*>(e); | - |
306 | if (me->button() == Qt::RightButton || customWhatsThis) never evaluated: me->button() == Qt::RightButton never evaluated: customWhatsThis | 0 |
307 | return false; never executed: return false; | 0 |
308 | QHelpEvent e(QEvent::WhatsThis, me->pos(), me->globalPos()); | - |
309 | if (!QApplication::sendEvent(w, &e) || !e.isAccepted()) never evaluated: !QApplication::sendEvent(w, &e) never evaluated: !e.isAccepted() | 0 |
310 | leaveOnMouseRelease = true; never executed: leaveOnMouseRelease = true; | 0 |
311 | | - |
312 | } break; | 0 |
313 | | - |
314 | case QEvent::MouseMove: | - |
315 | { | - |
316 | QMouseEvent *me = static_cast<QMouseEvent*>(e); | - |
317 | QHelpEvent e(QEvent::QueryWhatsThis, me->pos(), me->globalPos()); | - |
318 | bool sentEvent = QApplication::sendEvent(w, &e); | - |
319 | | - |
320 | | - |
321 | | - |
322 | QApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())? | - |
323 | Qt::ForbiddenCursor:Qt::WhatsThisCursor); | - |
324 | | - |
325 | } | - |
326 | | - |
327 | case QEvent::MouseButtonRelease: code before this statement never executed: case QEvent::MouseButtonRelease: | 0 |
328 | case QEvent::MouseButtonDblClick: | - |
329 | if (leaveOnMouseRelease && e->type() == QEvent::MouseButtonRelease) never evaluated: leaveOnMouseRelease never evaluated: e->type() == QEvent::MouseButtonRelease | 0 |
330 | QWhatsThis::leaveWhatsThisMode(); never executed: QWhatsThis::leaveWhatsThisMode(); | 0 |
331 | if (static_cast<QMouseEvent*>(e)->button() == Qt::RightButton || customWhatsThis) never evaluated: static_cast<QMouseEvent*>(e)->button() == Qt::RightButton never evaluated: customWhatsThis | 0 |
332 | return false; never executed: return false; | 0 |
333 | break; | 0 |
334 | case QEvent::KeyPress: | - |
335 | { | - |
336 | QKeyEvent* kev = (QKeyEvent*)e; | - |
337 | | - |
338 | if (kev->key() == Qt::Key_Escape) { never evaluated: kev->key() == Qt::Key_Escape | 0 |
339 | QWhatsThis::leaveWhatsThisMode(); | - |
340 | return true; never executed: return true; | 0 |
341 | } else if (customWhatsThis) { never evaluated: customWhatsThis | 0 |
342 | return false; never executed: return false; | 0 |
343 | } else if (kev->key() == Qt::Key_Menu || never evaluated: kev->key() == Qt::Key_Menu | 0 |
344 | (kev->key() == Qt::Key_F10 && never evaluated: kev->key() == Qt::Key_F10 | 0 |
345 | kev->modifiers() == Qt::ShiftModifier)) { never evaluated: kev->modifiers() == Qt::ShiftModifier | 0 |
346 | | - |
347 | return false; never executed: return false; | 0 |
348 | } else if (kev->key() != Qt::Key_Shift && kev->key() != Qt::Key_Alt never evaluated: kev->key() != Qt::Key_Shift never evaluated: kev->key() != Qt::Key_Alt | 0 |
349 | && kev->key() != Qt::Key_Control && kev->key() != Qt::Key_Meta) { never evaluated: kev->key() != Qt::Key_Control never evaluated: kev->key() != Qt::Key_Meta | 0 |
350 | QWhatsThis::leaveWhatsThisMode(); | - |
351 | } | 0 |
352 | } break; | 0 |
353 | default: | - |
354 | return false; never executed: return false; | 0 |
355 | } | - |
356 | return true; never executed: return true; | 0 |
357 | } | - |
358 | | - |
359 | class QWhatsThisAction: public QAction | - |
360 | { | - |
361 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
362 | | - |
363 | public: | - |
364 | explicit QWhatsThisAction(QObject* parent = 0); | - |
365 | | - |
366 | private : | - |
367 | void actionTriggered(); | - |
368 | }; | - |
369 | | - |
370 | QWhatsThisAction::QWhatsThisAction(QObject *parent) : QAction(tr("What's This?"), parent) | - |
371 | { | - |
372 | | - |
373 | QPixmap p((const char**)button_image); | - |
374 | setIcon(p); | - |
375 | | - |
376 | setCheckable(true); | - |
377 | connect(this, "2""triggered()", this, "1""actionTriggered()"); | - |
378 | | - |
379 | setShortcut(Qt::ShiftModifier + Qt::Key_F1); | - |
380 | | - |
381 | } | 0 |
382 | | - |
383 | void QWhatsThisAction::actionTriggered() | - |
384 | { | - |
385 | if (isChecked()) { never evaluated: isChecked() | 0 |
386 | QWhatsThis::enterWhatsThisMode(); | - |
387 | QWhatsThisPrivate::instance->action = this; | - |
388 | } | 0 |
389 | } | 0 |
390 | void QWhatsThis::enterWhatsThisMode() | - |
391 | { | - |
392 | if (QWhatsThisPrivate::instance) never evaluated: QWhatsThisPrivate::instance | 0 |
393 | return; | 0 |
394 | (void) new QWhatsThisPrivate; | - |
395 | QEvent e(QEvent::EnterWhatsThisMode); | - |
396 | QWhatsThisPrivate::notifyToplevels(&e); | - |
397 | } | 0 |
398 | | - |
399 | | - |
400 | | - |
401 | | - |
402 | | - |
403 | | - |
404 | | - |
405 | bool QWhatsThis::inWhatsThisMode() | - |
406 | { | - |
407 | return (QWhatsThisPrivate::instance != 0); executed: return (QWhatsThisPrivate::instance != 0); Execution Count:161 | 161 |
408 | } | - |
409 | void QWhatsThis::leaveWhatsThisMode() | - |
410 | { | - |
411 | delete QWhatsThisPrivate::instance; | - |
412 | QEvent e(QEvent::LeaveWhatsThisMode); | - |
413 | QWhatsThisPrivate::notifyToplevels(&e); | - |
414 | } executed: } Execution Count:1 | 1 |
415 | | - |
416 | void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y) | - |
417 | { | - |
418 | if (text.size() == 0) partially evaluated: text.size() == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
419 | return; | 0 |
420 | | - |
421 | QWhatsThat *whatsThat = new QWhatsThat( | - |
422 | text, | - |
423 | | - |
424 | | - |
425 | | - |
426 | 0, | - |
427 | | - |
428 | widget | - |
429 | ); | - |
430 | | - |
431 | | - |
432 | | - |
433 | | - |
434 | int scr = (widget ? partially evaluated: widget no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
435 | QApplication::desktop()->screenNumber(widget) : | - |
436 | | - |
437 | | - |
438 | | - |
439 | QApplication::desktop()->screenNumber(QPoint(x,y)) | - |
440 | | - |
441 | ); | - |
442 | QRect screen = QApplication::desktop()->screenGeometry(scr); | - |
443 | | - |
444 | int w = whatsThat->width(); | - |
445 | int h = whatsThat->height(); | - |
446 | int sx = screen.x(); | - |
447 | int sy = screen.y(); | - |
448 | | - |
449 | | - |
450 | | - |
451 | QPoint pos; | - |
452 | if (widget) partially evaluated: widget no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
453 | pos = widget->mapToGlobal(QPoint(0,0)); never executed: pos = widget->mapToGlobal(QPoint(0,0)); | 0 |
454 | | - |
455 | if (widget && w > widget->width() + 16) partially evaluated: widget no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: w > widget->width() + 16 | 0-1 |
456 | x = pos.x() + widget->width()/2 - w/2; never executed: x = pos.x() + widget->width()/2 - w/2; | 0 |
457 | else | - |
458 | x = x - w/2; executed: x = x - w/2; Execution Count:1 | 1 |
459 | | - |
460 | | - |
461 | | - |
462 | if (x + w + shadowWidth > sx+screen.width()) partially evaluated: x + w + shadowWidth > sx+screen.width() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
463 | x = (widget? (qMin(screen.width(), | 0 |
464 | pos.x() + widget->width()) | 0 |
465 | ) : screen.width()) | 0 |
466 | - w; never executed: x = (widget? (qMin(screen.width(), pos.x() + widget->width()) ) : screen.width()) - w; | 0 |
467 | | - |
468 | if (x < sx) partially evaluated: x < sx yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
469 | x = sx; executed: x = sx; Execution Count:1 | 1 |
470 | | - |
471 | if (widget && h > widget->height() + 16) { partially evaluated: widget no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: h > widget->height() + 16 | 0-1 |
472 | y = pos.y() + widget->height() + 2; | - |
473 | | - |
474 | if (y + h + 10 > sy+screen.height()) never evaluated: y + h + 10 > sy+screen.height() | 0 |
475 | y = pos.y() + 2 - shadowWidth - h; never executed: y = pos.y() + 2 - shadowWidth - h; | 0 |
476 | } | 0 |
477 | y = y + 2; | - |
478 | | - |
479 | | - |
480 | | - |
481 | if (y + h + shadowWidth > sy+screen.height()) partially evaluated: y + h + shadowWidth > sy+screen.height() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
482 | y = (widget ? (qMin(screen.height(), | 0 |
483 | pos.y() + widget->height()) | 0 |
484 | ) : screen.height()) | 0 |
485 | - h; never executed: y = (widget ? (qMin(screen.height(), pos.y() + widget->height()) ) : screen.height()) - h; | 0 |
486 | if (y < sy) partially evaluated: y < sy no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
487 | y = sy; | 0 |
488 | | - |
489 | whatsThat->move(x, y); | - |
490 | whatsThat->show(); | - |
491 | whatsThat->grabKeyboard(); | - |
492 | } executed: } Execution Count:1 | 1 |
493 | void QWhatsThis::showText(const QPoint &pos, const QString &text, QWidget *w) | - |
494 | { | - |
495 | leaveWhatsThisMode(); | - |
496 | QWhatsThisPrivate::say(w, text, pos.x(), pos.y()); | - |
497 | } executed: } Execution Count:1 | 1 |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | | - |
504 | void QWhatsThis::hideText() | - |
505 | { | - |
506 | qDeleteInEventHandler(QWhatsThat::instance); | - |
507 | } | 0 |
508 | QAction *QWhatsThis::createAction(QObject *parent) | - |
509 | { | - |
510 | return new QWhatsThisAction(parent); never executed: return new QWhatsThisAction(parent); | 0 |
511 | } | - |
512 | | - |
513 | | - |
514 | | - |
515 | | - |
| | |