qtextbrowser.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qtextbrowser.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QTextBrowserPrivate : public QTextEditPrivate-
8{-
9 inline QTextBrowser* q_func() { return static_cast<QTextBrowser *>(q_ptr); } inline const QTextBrowser* q_func() const { return static_cast<const QTextBrowser *>(q_ptr); } friend class QTextBrowser;-
10public:-
11 inline QTextBrowserPrivate()-
12 : textOrSourceChanged(false), forceLoadOnSourceChange(false), openExternalLinks(false),-
13 openLinks(true)-
14-
15-
16-
17 {}
never executed: end of block
0
18-
19 void init();-
20-
21 struct HistoryEntry {-
22 inline HistoryEntry()-
23 : hpos(0), vpos(0), focusIndicatorPosition(-1),-
24 focusIndicatorAnchor(-1) {}
never executed: end of block
0
25 QUrl url;-
26 QString title;-
27 int hpos;-
28 int vpos;-
29 int focusIndicatorPosition, focusIndicatorAnchor;-
30 };-
31-
32 HistoryEntry history(int i) const-
33 {-
34 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
35 if (-
-i < stack.count()Description
TRUEnever evaluated
FALSEnever evaluated
i < stack.count()
-i < stack.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
36 return
never executed: return stack[stack.count()+i-1];
stack[stack.count()+i-1];
never executed: return stack[stack.count()+i-1];
0
37 else-
38 return
never executed: return HistoryEntry();
HistoryEntry();
never executed: return HistoryEntry();
0
39 else-
40 if (i <= forwardStack.count()
i <= forwardStack.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
41 return
never executed: return forwardStack[forwardStack.count()-i];
forwardStack[forwardStack.count()-i];
never executed: return forwardStack[forwardStack.count()-i];
0
42 else-
43 return
never executed: return HistoryEntry();
HistoryEntry();
never executed: return HistoryEntry();
0
44 }-
45-
46-
47 HistoryEntry createHistoryEntry() const;-
48 void restoreHistoryEntry(const HistoryEntry &entry);-
49-
50 QStack<HistoryEntry> stack;-
51 QStack<HistoryEntry> forwardStack;-
52 QUrl home;-
53 QUrl currentURL;-
54-
55 QStringList searchPaths;-
56-
57-
58-
59-
60 bool textOrSourceChanged;-
61 bool forceLoadOnSourceChange;-
62-
63 bool openExternalLinks;-
64 bool openLinks;-
65-
66-
67 QCursor oldCursor;-
68-
69-
70 QString findFile(const QUrl &name) const;-
71-
72 inline void _q_documentModified()-
73 {-
74 textOrSourceChanged = true;-
75 forceLoadOnSourceChange = !currentURL.path().isEmpty();-
76 }
never executed: end of block
0
77-
78 void _q_activateAnchor(const QString &href);-
79 void _q_highlightLink(const QString &href);-
80-
81 void setSource(const QUrl &url);-
82-
83-
84 virtual QUrl resolveUrl(const QUrl &url) const override;-
85 inline QUrl resolveUrl(const QString &url) const-
86 { return
never executed: return resolveUrl(QUrl(url));
resolveUrl(QUrl(url));
never executed: return resolveUrl(QUrl(url));
}
0
87-
88-
89-
90-
91-
92-
93};-
94template<> class QTypeInfo<QTextBrowserPrivate::HistoryEntry > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QTextBrowserPrivate::HistoryEntry)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QTextBrowserPrivate::HistoryEntry >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QTextBrowserPrivate::HistoryEntry) }; static inline const char *name() { return "QTextBrowserPrivate::HistoryEntry"; } };-
95-
96QString QTextBrowserPrivate::findFile(const QUrl &name) const-
97{-
98 QString fileName;-
99 if (name.scheme() == QLatin1String("qrc")
name.scheme() ...1String("qrc")Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 fileName = QLatin1String(":/") + name.path();-
101 }
never executed: end of block
else if (name.scheme().isEmpty()
name.scheme().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
102 fileName = name.path();-
103 }
never executed: end of block
else {
0
104-
105-
106-
107-
108-
109 fileName = name.toLocalFile();-
110 }
never executed: end of block
0
111-
112 if (QFileInfo(fileName).isAbsolute()
QFileInfo(file...).isAbsolute()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
113 return
never executed: return fileName;
fileName;
never executed: return fileName;
0
114-
115 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(searchPaths)>::type> _container_((searchPaths)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QString path = *_container_.i; _container_.control; _container_.control = 0) {-
116 if (!path.endsWith(QLatin1Char('/'))
!path.endsWith...tin1Char('/'))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
117 path.append(QLatin1Char('/'));
never executed: path.append(QLatin1Char('/'));
0
118 path.append(fileName);-
119 if (QFileInfo(path).isReadable()
QFileInfo(path).isReadable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
120 return
never executed: return path;
path;
never executed: return path;
0
121 }
never executed: end of block
0
122-
123 return
never executed: return fileName;
fileName;
never executed: return fileName;
0
124}-
125-
126QUrl QTextBrowserPrivate::resolveUrl(const QUrl &url) const-
127{-
128 if (!url.isRelative()
!url.isRelative()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
129 return
never executed: return url;
url;
never executed: return url;
0
130-
131-
132-
133 if (!(currentURL.isRelative()
currentURL.isRelative()Description
TRUEnever evaluated
FALSEnever evaluated
0
134 || (currentURL.scheme() == QLatin1String("file")
currentURL.sch...String("file")Description
TRUEnever evaluated
FALSEnever evaluated
0
135 && !QFileInfo(currentURL.toLocalFile()).isAbsolute()
!QFileInfo(cur...).isAbsolute()Description
TRUEnever evaluated
FALSEnever evaluated
))
0
136 || (url.hasFragment()
url.hasFragment()Description
TRUEnever evaluated
FALSEnever evaluated
&& url.path().isEmpty()
url.path().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
137 return
never executed: return currentURL.resolved(url);
currentURL.resolved(url);
never executed: return currentURL.resolved(url);
0
138 }-
139-
140-
141-
142-
143 QFileInfo fi(currentURL.toLocalFile());-
144 if (fi.exists()
fi.exists()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
145 return
never executed: return QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(url);
QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(url);
never executed: return QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(url);
0
146 }-
147-
148 return
never executed: return url;
url;
never executed: return url;
0
149}-
150-
151void QTextBrowserPrivate::_q_activateAnchor(const QString &href)-
152{-
153 if (href.isEmpty()
href.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
154 return;
never executed: return;
0
155 QTextBrowser * const q = q_func();-
156-
157-
158 viewport->setCursor(oldCursor);-
159-
160-
161 const QUrl url = resolveUrl(href);-
162-
163 if (!openLinks
!openLinksDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
164 q->anchorClicked(url);-
165 return;
never executed: return;
0
166 }-
167-
168 textOrSourceChanged = false;-
169-
170-
171 bool isFileScheme =-
172 url.scheme() == QLatin1String("file")
url.scheme() =...String("file")Description
TRUEnever evaluated
FALSEnever evaluated
0
173-
174-
175-
176 || url.scheme() == QLatin1String("qrc")
url.scheme() =...1String("qrc")Description
TRUEnever evaluated
FALSEnever evaluated
;
0
177 if ((openExternalLinks
openExternalLinksDescription
TRUEnever evaluated
FALSEnever evaluated
&& !isFileScheme
!isFileSchemeDescription
TRUEnever evaluated
FALSEnever evaluated
&& !url.isRelative()
!url.isRelative()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
178 || (url.isRelative()
url.isRelative()Description
TRUEnever evaluated
FALSEnever evaluated
&& !currentURL.isRelative()
!currentURL.isRelative()Description
TRUEnever evaluated
FALSEnever evaluated
&& !isFileScheme
!isFileSchemeDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
179 QDesktopServices::openUrl(url);-
180 return;
never executed: return;
0
181 }-
182-
183-
184 q->anchorClicked(url);-
185-
186 if (textOrSourceChanged
textOrSourceChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
187 return;
never executed: return;
0
188-
189 q->setSource(url);-
190}
never executed: end of block
0
191-
192void QTextBrowserPrivate::_q_highlightLink(const QString &anchor)-
193{-
194 QTextBrowser * const q = q_func();-
195 if (anchor.isEmpty()
anchor.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
196-
197 if (viewport->cursor().shape() != Qt::PointingHandCursor
viewport->curs...tingHandCursorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
198 oldCursor = viewport->cursor();
never executed: oldCursor = viewport->cursor();
0
199 viewport->setCursor(oldCursor);-
200-
201 q->highlighted(QUrl());-
202 q->highlighted(QString());-
203 }
never executed: end of block
else {
0
204-
205 viewport->setCursor(Qt::PointingHandCursor);-
206-
207-
208 const QUrl url = resolveUrl(anchor);-
209 q->highlighted(url);-
210-
211 q->highlighted(url.toString());-
212 }
never executed: end of block
0
213}-
214-
215void QTextBrowserPrivate::setSource(const QUrl &url)-
216{-
217 QTextBrowser * const q = q_func();-
218-
219 if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
220 QApplication::setOverrideCursor(Qt::WaitCursor);
never executed: QApplication::setOverrideCursor(Qt::WaitCursor);
0
221-
222 textOrSourceChanged = true;-
223-
224 QString txt;-
225-
226 bool doSetText = false;-
227-
228 QUrl currentUrlWithoutFragment = currentURL;-
229 currentUrlWithoutFragment.setFragment(QString());-
230 QUrl newUrlWithoutFragment = currentURL.resolved(url);-
231 newUrlWithoutFragment.setFragment(QString());-
232-
233 if (url.isValid()
url.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
234 && (newUrlWithoutFragment != currentUrlWithoutFragment
newUrlWithoutF...ithoutFragmentDescription
TRUEnever evaluated
FALSEnever evaluated
|| forceLoadOnSourceChange
forceLoadOnSourceChangeDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
235 QVariant data = q->loadResource(QTextDocument::HtmlResource, resolveUrl(url));-
236 if (data.type() == QVariant::String
data.type() ==...ariant::StringDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
237 txt = data.toString();-
238 }
never executed: end of block
else if (data.type() == QVariant::ByteArray
data.type() ==...ant::ByteArrayDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
239-
240 QByteArray ba = data.toByteArray();-
241 QTextCodec *codec = Qt::codecForHtml(ba);-
242 txt = codec->toUnicode(ba);-
243-
244-
245-
246 }
never executed: end of block
0
247 if (__builtin_expect(!!(txt.isEmpty()), false)
__builtin_expe...pty()), false)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
248 QMessageLogger(__FILE__, 302, __PRETTY_FUNCTION__).warning("QTextBrowser: No document for %s", url.toString().toLatin1().constData());
never executed: QMessageLogger(__FILE__, 302, __PRETTY_FUNCTION__).warning("QTextBrowser: No document for %s", url.toString().toLatin1().constData());
0
249-
250 if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
251 const QStringRef firstTag = txt.leftRef(txt.indexOf(QLatin1Char('>')) + 1);-
252 if (firstTag.startsWith(QLatin1String("<qt"))
firstTag.start...String("<qt"))Description
TRUEnever evaluated
FALSEnever evaluated
&& firstTag.contains(QLatin1String("type"))
firstTag.conta...tring("type"))Description
TRUEnever evaluated
FALSEnever evaluated
&& firstTag.contains(QLatin1String("detail"))
firstTag.conta...ing("detail"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
253-
254 QApplication::restoreOverrideCursor();-
255-
256-
257 QWhatsThis::showText(QCursor::pos(), txt, q);-
258-
259 return;
never executed: return;
0
260 }-
261 }
never executed: end of block
0
262-
263 currentURL = resolveUrl(url);-
264 doSetText = true;-
265 }
never executed: end of block
0
266-
267 if (!home.isValid()
!home.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
268 home = url;
never executed: home = url;
0
269-
270 if (doSetText
doSetTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
271-
272 q->QTextEdit::setHtml(txt);-
273 q->document()->setMetaInformation(QTextDocument::DocumentUrl, currentURL.toString());-
274-
275-
276-
277-
278-
279-
280-
281 }
never executed: end of block
0
282-
283 forceLoadOnSourceChange = false;-
284-
285 if (!url.fragment().isEmpty()
!url.fragment().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
286 q->scrollToAnchor(url.fragment());-
287 }
never executed: end of block
else {
0
288 hbar->setValue(0);-
289 vbar->setValue(0);-
290 }
never executed: end of block
0
291-
292-
293-
294-
295-
296-
297-
298 if (q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
299 QApplication::restoreOverrideCursor();
never executed: QApplication::restoreOverrideCursor();
0
300-
301 q->sourceChanged(url);-
302}
never executed: end of block
0
303QTextBrowserPrivate::HistoryEntry QTextBrowserPrivate::createHistoryEntry() const-
304{-
305 HistoryEntry entry;-
306 entry.url = q_func()->source();-
307 entry.title = q_func()->documentTitle();-
308 entry.hpos = hbar->value();-
309 entry.vpos = vbar->value();-
310-
311 const QTextCursor cursor = control->textCursor();-
312 if (control->cursorIsFocusIndicator()
control->curso...cusIndicator()Description
TRUEnever evaluated
FALSEnever evaluated
0
313 && cursor.hasSelection()
cursor.hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
314-
315 entry.focusIndicatorPosition = cursor.position();-
316 entry.focusIndicatorAnchor = cursor.anchor();-
317 }
never executed: end of block
0
318 return
never executed: return entry;
entry;
never executed: return entry;
0
319}-
320-
321void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry &entry)-
322{-
323 setSource(entry.url);-
324 hbar->setValue(entry.hpos);-
325 vbar->setValue(entry.vpos);-
326 if (entry.focusIndicatorAnchor != -1
entry.focusInd...orAnchor != -1Description
TRUEnever evaluated
FALSEnever evaluated
&& entry.focusIndicatorPosition != -1
entry.focusInd...Position != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
327 QTextCursor cursor(control->document());-
328 cursor.setPosition(entry.focusIndicatorAnchor);-
329 cursor.setPosition(entry.focusIndicatorPosition, QTextCursor::KeepAnchor);-
330 control->setTextCursor(cursor);-
331 control->setCursorIsFocusIndicator(true);-
332 }
never executed: end of block
0
333}
never executed: end of block
0
334void QTextBrowserPrivate::init()-
335{-
336 QTextBrowser * const q = q_func();-
337 control->setTextInteractionFlags(Qt::TextBrowserInteraction);-
338-
339 viewport->setCursor(oldCursor);-
340-
341 q->setAttribute(Qt::WA_InputMethodEnabled, !q->isReadOnly());-
342 q->setUndoRedoEnabled(false);-
343 viewport->setMouseTracking(true);-
344 QObject::connect(q->document(), qFlagLocation("2""contentsChanged()" "\0" __FILE__ ":" "665"), q, qFlagLocation("1""_q_documentModified()" "\0" __FILE__ ":" "665"));-
345 QObject::connect(control, qFlagLocation("2""linkActivated(QString)" "\0" __FILE__ ":" "666"),-
346 q, qFlagLocation("1""_q_activateAnchor(QString)" "\0" __FILE__ ":" "667"));-
347 QObject::connect(control, qFlagLocation("2""linkHovered(QString)" "\0" __FILE__ ":" "668"),-
348 q, qFlagLocation("1""_q_highlightLink(QString)" "\0" __FILE__ ":" "669"));-
349}
never executed: end of block
0
350-
351-
352-
353-
354QTextBrowser::QTextBrowser(QWidget *parent)-
355 : QTextEdit(*new QTextBrowserPrivate, parent)-
356{-
357 QTextBrowserPrivate * const d = d_func();-
358 d->init();-
359}
never executed: end of block
0
360-
361-
362-
363-
364-
365QTextBrowser::~QTextBrowser()-
366{-
367}-
368QUrl QTextBrowser::source() const-
369{-
370 const QTextBrowserPrivate * const d = d_func();-
371 if (d->stack.isEmpty()
d->stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
372 return
never executed: return QUrl();
QUrl();
never executed: return QUrl();
0
373 else-
374 return
never executed: return d->stack.top().url;
d->stack.top().url;
never executed: return d->stack.top().url;
0
375}-
376QStringList QTextBrowser::searchPaths() const-
377{-
378 const QTextBrowserPrivate * const d = d_func();-
379 return
never executed: return d->searchPaths;
d->searchPaths;
never executed: return d->searchPaths;
0
380}-
381-
382void QTextBrowser::setSearchPaths(const QStringList &paths)-
383{-
384 QTextBrowserPrivate * const d = d_func();-
385 d->searchPaths = paths;-
386}
never executed: end of block
0
387-
388-
389-
390-
391void QTextBrowser::reload()-
392{-
393 QTextBrowserPrivate * const d = d_func();-
394 QUrl s = d->currentURL;-
395 d->currentURL = QUrl();-
396 setSource(s);-
397}
never executed: end of block
0
398-
399void QTextBrowser::setSource(const QUrl &url)-
400{-
401 QTextBrowserPrivate * const d = d_func();-
402-
403 const QTextBrowserPrivate::HistoryEntry historyEntry = d->createHistoryEntry();-
404-
405 d->setSource(url);-
406-
407 if (!url.isValid()
!url.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
408 return;
never executed: return;
0
409-
410-
411 if (!d->stack.isEmpty()
!d->stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->stack.top().url == url
d->stack.top().url == urlDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
412 return;
never executed: return;
0
413-
414 if (!d->stack.isEmpty()
!d->stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
415 d->stack.top() = historyEntry;
never executed: d->stack.top() = historyEntry;
0
416-
417 QTextBrowserPrivate::HistoryEntry entry;-
418 entry.url = url;-
419 entry.title = documentTitle();-
420 entry.hpos = 0;-
421 entry.vpos = 0;-
422 d->stack.push(entry);-
423-
424 backwardAvailable(d->stack.count() > 1);-
425-
426 if (!d->forwardStack.isEmpty()
!d->forwardStack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->forwardStack.top().url == url
d->forwardStac...p().url == urlDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
427 d->forwardStack.pop();-
428 forwardAvailable(d->forwardStack.count() > 0);-
429 }
never executed: end of block
else {
0
430 d->forwardStack.clear();-
431 forwardAvailable(false);-
432 }
never executed: end of block
0
433-
434 historyChanged();-
435}
never executed: end of block
0
436void QTextBrowser::backward()-
437{-
438 QTextBrowserPrivate * const d = d_func();-
439 if (d->stack.count() <= 1
d->stack.count() <= 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
440 return;
never executed: return;
0
441-
442-
443 d->forwardStack.push(d->createHistoryEntry());-
444 d->stack.pop();-
445 d->restoreHistoryEntry(d->stack.top());-
446 backwardAvailable(d->stack.count() > 1);-
447 forwardAvailable(true);-
448 historyChanged();-
449}
never executed: end of block
0
450void QTextBrowser::forward()-
451{-
452 QTextBrowserPrivate * const d = d_func();-
453 if (d->forwardStack.isEmpty()
d->forwardStack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
454 return;
never executed: return;
0
455 if (!d->stack.isEmpty()
!d->stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
456-
457 d->stack.top() = d->createHistoryEntry();-
458 }
never executed: end of block
0
459 d->stack.push(d->forwardStack.pop());-
460 d->restoreHistoryEntry(d->stack.top());-
461 backwardAvailable(true);-
462 forwardAvailable(!d->forwardStack.isEmpty());-
463 historyChanged();-
464}
never executed: end of block
0
465-
466-
467-
468-
469-
470void QTextBrowser::home()-
471{-
472 QTextBrowserPrivate * const d = d_func();-
473 if (d->home.isValid()
d->home.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
474 setSource(d->home);
never executed: setSource(d->home);
0
475}
never executed: end of block
0
476void QTextBrowser::keyPressEvent(QKeyEvent *ev)-
477{-
478 if (ev->modifiers() & Qt::AltModifier
ev->modifiers(...t::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
479 switch (ev->key()) {-
480 case
never executed: case Qt::Key_Right:
Qt::Key_Right:
never executed: case Qt::Key_Right:
0
481 forward();-
482 ev->accept();-
483 return;
never executed: return;
0
484 case
never executed: case Qt::Key_Left:
Qt::Key_Left:
never executed: case Qt::Key_Left:
0
485 backward();-
486 ev->accept();-
487 return;
never executed: return;
0
488 case
never executed: case Qt::Key_Up:
Qt::Key_Up:
never executed: case Qt::Key_Up:
0
489 home();-
490 ev->accept();-
491 return;
never executed: return;
0
492 }-
493 }
never executed: end of block
0
494 QTextEdit::keyPressEvent(ev);-
495}
never executed: end of block
0
496-
497-
498-
499-
500void QTextBrowser::mouseMoveEvent(QMouseEvent *e)-
501{-
502 QTextEdit::mouseMoveEvent(e);-
503}
never executed: end of block
0
504-
505-
506-
507-
508void QTextBrowser::mousePressEvent(QMouseEvent *e)-
509{-
510 QTextEdit::mousePressEvent(e);-
511}
never executed: end of block
0
512-
513-
514-
515-
516void QTextBrowser::mouseReleaseEvent(QMouseEvent *e)-
517{-
518 QTextEdit::mouseReleaseEvent(e);-
519}
never executed: end of block
0
520-
521-
522-
523-
524void QTextBrowser::focusOutEvent(QFocusEvent *ev)-
525{-
526-
527 QTextBrowserPrivate * const d = d_func();-
528 d->viewport->setCursor((!(d->control->textInteractionFlags() & Qt::TextEditable)) ? d->oldCursor : Qt::IBeamCursor);-
529-
530 QTextEdit::focusOutEvent(ev);-
531}
never executed: end of block
0
532-
533-
534-
535-
536bool QTextBrowser::focusNextPrevChild(bool next)-
537{-
538 QTextBrowserPrivate * const d = d_func();-
539 if (d->control->setFocusToNextOrPreviousAnchor(next)
d->control->se...usAnchor(next)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
540 return
never executed: return true;
true;
never executed: return true;
0
541 } else {-
542-
543-
544-
545-
546-
547 }
never executed: end of block
0
548 return
never executed: return QTextEdit::focusNextPrevChild(next);
QTextEdit::focusNextPrevChild(next);
never executed: return QTextEdit::focusNextPrevChild(next);
0
549}-
550-
551-
552-
553-
554void QTextBrowser::paintEvent(QPaintEvent *e)-
555{-
556 QTextBrowserPrivate * const d = d_func();-
557 QPainter p(d->viewport);-
558 d->paint(&p, e);-
559}
never executed: end of block
0
560QVariant QTextBrowser::loadResource(int , const QUrl &name)-
561{-
562 QTextBrowserPrivate * const d = d_func();-
563-
564 QByteArray data;-
565 QString fileName = d->findFile(d->resolveUrl(name));-
566 QFile f(fileName);-
567 if (f.open(QFile::ReadOnly)
f.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
568 data = f.readAll();-
569 f.close();-
570 }
never executed: end of block
else {
0
571 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
572 }-
573-
574 return
never executed: return data;
data;
never executed: return data;
0
575}-
576bool QTextBrowser::isBackwardAvailable() const-
577{-
578 const QTextBrowserPrivate * const d = d_func();-
579 return
never executed: return d->stack.count() > 1;
d->stack.count() > 1;
never executed: return d->stack.count() > 1;
0
580}-
581bool QTextBrowser::isForwardAvailable() const-
582{-
583 const QTextBrowserPrivate * const d = d_func();-
584 return
never executed: return !d->forwardStack.isEmpty();
!d->forwardStack.isEmpty();
never executed: return !d->forwardStack.isEmpty();
0
585}-
586void QTextBrowser::clearHistory()-
587{-
588 QTextBrowserPrivate * const d = d_func();-
589 d->forwardStack.clear();-
590 if (!d->stack.isEmpty()
!d->stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
591 QTextBrowserPrivate::HistoryEntry historyEntry = d->stack.top();-
592 d->stack.clear();-
593 d->stack.push(historyEntry);-
594 d->home = historyEntry.url;-
595 }
never executed: end of block
0
596 forwardAvailable(false);-
597 backwardAvailable(false);-
598 historyChanged();-
599}
never executed: end of block
0
600QUrl QTextBrowser::historyUrl(int i) const-
601{-
602 const QTextBrowserPrivate * const d = d_func();-
603 return
never executed: return d->history(i).url;
d->history(i).url;
never executed: return d->history(i).url;
0
604}-
605QString QTextBrowser::historyTitle(int i) const-
606{-
607 const QTextBrowserPrivate * const d = d_func();-
608 return
never executed: return d->history(i).title;
d->history(i).title;
never executed: return d->history(i).title;
0
609}-
610-
611-
612-
613-
614-
615-
616-
617int QTextBrowser::forwardHistoryCount() const-
618{-
619 const QTextBrowserPrivate * const d = d_func();-
620 return
never executed: return d->forwardStack.count();
d->forwardStack.count();
never executed: return d->forwardStack.count();
0
621}-
622-
623-
624-
625-
626-
627-
628int QTextBrowser::backwardHistoryCount() const-
629{-
630 const QTextBrowserPrivate * const d = d_func();-
631 return
never executed: return d->stack.count()-1;
d->stack.count()-1;
never executed: return d->stack.count()-1;
0
632}-
633bool QTextBrowser::openExternalLinks() const-
634{-
635 const QTextBrowserPrivate * const d = d_func();-
636 return
never executed: return d->openExternalLinks;
d->openExternalLinks;
never executed: return d->openExternalLinks;
0
637}-
638-
639void QTextBrowser::setOpenExternalLinks(bool open)-
640{-
641 QTextBrowserPrivate * const d = d_func();-
642 d->openExternalLinks = open;-
643}
never executed: end of block
0
644bool QTextBrowser::openLinks() const-
645{-
646 const QTextBrowserPrivate * const d = d_func();-
647 return
never executed: return d->openLinks;
d->openLinks;
never executed: return d->openLinks;
0
648}-
649-
650void QTextBrowser::setOpenLinks(bool open)-
651{-
652 QTextBrowserPrivate * const d = d_func();-
653 d->openLinks = open;-
654}
never executed: end of block
0
655-
656-
657bool QTextBrowser::event(QEvent *e)-
658{-
659 return
never executed: return QTextEdit::event(e);
QTextEdit::event(e);
never executed: return QTextEdit::event(e);
0
660}-
661-
662-
663-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9