| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qtextbrowser.h" | - |
| 41 | #include "qtextedit_p.h" | - |
| 42 | | - |
| 43 | #ifndef QT_NO_TEXTBROWSER | - |
| 44 | | - |
| 45 | #include <qstack.h> | - |
| 46 | #include <qapplication.h> | - |
| 47 | #include <qevent.h> | - |
| 48 | #include <qdesktopwidget.h> | - |
| 49 | #include <qdebug.h> | - |
| 50 | #include <qabstracttextdocumentlayout.h> | - |
| 51 | #include "private/qtextdocumentlayout_p.h" | - |
| 52 | #include <qtextcodec.h> | - |
| 53 | #include <qpainter.h> | - |
| 54 | #include <qdir.h> | - |
| 55 | #include <qwhatsthis.h> | - |
| 56 | #include <qtextobject.h> | - |
| 57 | #include <qdesktopservices.h> | - |
| 58 | | - |
| 59 | QT_BEGIN_NAMESPACE | - |
| 60 | | - |
| 61 | class QTextBrowserPrivate : public QTextEditPrivate | - |
| 62 | { | - |
| 63 | Q_DECLARE_PUBLIC(QTextBrowser) | - |
| 64 | public: | - |
| 65 | inline QTextBrowserPrivate() | - |
| 66 | : textOrSourceChanged(false), forceLoadOnSourceChange(false), openExternalLinks(false), | - |
| 67 | openLinks(true) | - |
| 68 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 69 | , lastKeypadScrollValue(-1) | - |
| 70 | #endif | - |
| 71 | {} | - |
| 72 | | - |
| 73 | void init(); | - |
| 74 | | - |
| 75 | struct HistoryEntry { | - |
| 76 | inline HistoryEntry() | - |
| 77 | : hpos(0), vpos(0), focusIndicatorPosition(-1), | - |
| 78 | focusIndicatorAnchor(-1) {} | - |
| 79 | QUrl url; | - |
| 80 | QString title; | - |
| 81 | int hpos; | - |
| 82 | int vpos; | - |
| 83 | int focusIndicatorPosition, focusIndicatorAnchor; | - |
| 84 | }; | - |
| 85 | | - |
| 86 | HistoryEntry history(int i) const | - |
| 87 | { | - |
| 88 | if (i <= 0) | - |
| 89 | if (-i < stack.count()) | - |
| 90 | return stack[stack.count()+i-1]; | - |
| 91 | else | - |
| 92 | return HistoryEntry(); | - |
| 93 | else | - |
| 94 | if (i <= forwardStack.count()) | - |
| 95 | return forwardStack[forwardStack.count()-i]; | - |
| 96 | else | - |
| 97 | return HistoryEntry(); | - |
| 98 | } | - |
| 99 | | - |
| 100 | | - |
| 101 | HistoryEntry createHistoryEntry() const; | - |
| 102 | void restoreHistoryEntry(const HistoryEntry entry&entry); | - |
| 103 | | - |
| 104 | QStack<HistoryEntry> stack; | - |
| 105 | QStack<HistoryEntry> forwardStack; | - |
| 106 | QUrl home; | - |
| 107 | QUrl currentURL; | - |
| 108 | | - |
| 109 | QStringList searchPaths; | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | bool textOrSourceChanged; | - |
| 115 | bool forceLoadOnSourceChange; | - |
| 116 | | - |
| 117 | bool openExternalLinks; | - |
| 118 | bool openLinks; | - |
| 119 | | - |
| 120 | #ifndef QT_NO_CURSOR | - |
| 121 | QCursor oldCursor; | - |
| 122 | #endif | - |
| 123 | | - |
| 124 | QString findFile(const QUrl &name) const; | - |
| 125 | | - |
| 126 | inline void _q_documentModified() | - |
| 127 | { | - |
| 128 | textOrSourceChanged = true; | - |
| 129 | forceLoadOnSourceChange = !currentURL.path().isEmpty(); | - |
| 130 | } | - |
| 131 | | - |
| 132 | void _q_activateAnchor(const QString &href); | - |
| 133 | void _q_highlightLink(const QString &href); | - |
| 134 | | - |
| 135 | void setSource(const QUrl &url); | - |
| 136 | | - |
| 137 | | - |
| 138 | virtual QUrl resolveUrl(const QUrl &url) const Q_DECL_OVERRIDE; | - |
| 139 | inline QUrl resolveUrl(const QString &url) const | - |
| 140 | { return resolveUrl(QUrl(url)); } | - |
| 141 | | - |
| 142 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 143 | void keypadMove(bool next); | - |
| 144 | QTextCursor prevFocus; | - |
| 145 | int lastKeypadScrollValue; | - |
| 146 | #endif | - |
| 147 | }; | - |
| 148 | Q_DECLARE_TYPEINFO(QTextBrowserPrivate::HistoryEntry, Q_MOVABLE_TYPE); | - |
| 149 | | - |
| 150 | QString QTextBrowserPrivate::findFile(const QUrl &name) const | - |
| 151 | { | - |
| 152 | QString fileName; | - |
| 153 | if (name.scheme() == QLatin1String("qrc")) { | - |
| 154 | fileName = QLatin1String(":/") + name.path(); | - |
| 155 | } else if (name.scheme().isEmpty()) { | - |
| 156 | fileName = name.path(); | - |
| 157 | } else { | - |
| 158 | #if defined(Q_OS_ANDROID) | - |
| 159 | if (name.scheme() == QLatin1String("assets")) | - |
| 160 | fileName = QLatin1String("assets:") + name.path(); | - |
| 161 | else | - |
| 162 | #endif | - |
| 163 | fileName = name.toLocalFile(); | - |
| 164 | } | - |
| 165 | | - |
| 166 | if (QFileInfo(fileName).isAbsolute()) | - |
| 167 | return fileName; | - |
| 168 | | - |
| 169 | foreach (QString path, searchPaths) { | - |
| 170 | if (!path.endsWith(QLatin1Char('/'))) | - |
| 171 | path.append(QLatin1Char('/')); | - |
| 172 | path.append(fileName); | - |
| 173 | if (QFileInfo(path).isReadable()) | - |
| 174 | return path; | - |
| 175 | } | - |
| 176 | | - |
| 177 | return fileName; | - |
| 178 | } | - |
| 179 | | - |
| 180 | QUrl QTextBrowserPrivate::resolveUrl(const QUrl &url) const | - |
| 181 | { | - |
| 182 | if (!url.isRelative()) | - |
| 183 | return url; | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | if (!(currentURL.isRelative() | - |
| 188 | || (currentURL.scheme() == QLatin1String("file") | - |
| 189 | && !QFileInfo(currentURL.toLocalFile()).isAbsolute())) | - |
| 190 | || (url.hasFragment() && url.path().isEmpty())) { | - |
| 191 | return currentURL.resolved(url); | - |
| 192 | } | - |
| 193 | | - |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | QFileInfo fi(currentURL.toLocalFile()); | - |
| 198 | if (fi.exists()) { | - |
| 199 | return QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(url); | - |
| 200 | } | - |
| 201 | | - |
| 202 | return url; | - |
| 203 | } | - |
| 204 | | - |
| 205 | void QTextBrowserPrivate::_q_activateAnchor(const QString &href) | - |
| 206 | { | - |
| 207 | if (href.isEmpty()) | - |
| 208 | return; | - |
| 209 | Q_Q(QTextBrowser); | - |
| 210 | | - |
| 211 | #ifndef QT_NO_CURSOR | - |
| 212 | viewport->setCursor(oldCursor); | - |
| 213 | #endif | - |
| 214 | | - |
| 215 | const QUrl url = resolveUrl(href); | - |
| 216 | | - |
| 217 | if (!openLinks) { | - |
| 218 | emit q->anchorClicked(url); | - |
| 219 | return; | - |
| 220 | } | - |
| 221 | | - |
| 222 | textOrSourceChanged = false; | - |
| 223 | | - |
| 224 | #ifndef QT_NO_DESKTOPSERVICES | - |
| 225 | bool isFileScheme = | - |
| 226 | url.scheme() == QLatin1String("file") | - |
| 227 | #if defined(Q_OS_ANDROID) | - |
| 228 | || url.scheme() == QLatin1String("assets") | - |
| 229 | #endif | - |
| 230 | || url.scheme() == QLatin1String("qrc"); | - |
| 231 | if ((openExternalLinks && !isFileScheme && !url.isRelative()) | - |
| 232 | || (url.isRelative() && !currentURL.isRelative() && !isFileScheme)) { | - |
| 233 | QDesktopServices::openUrl(url); | - |
| 234 | return; | - |
| 235 | } | - |
| 236 | #endif | - |
| 237 | | - |
| 238 | emit q->anchorClicked(url); | - |
| 239 | | - |
| 240 | if (textOrSourceChanged) | - |
| 241 | return; | - |
| 242 | | - |
| 243 | q->setSource(url); | - |
| 244 | } | - |
| 245 | | - |
| 246 | void QTextBrowserPrivate::_q_highlightLink(const QString &anchor) | - |
| 247 | { | - |
| 248 | Q_Q(QTextBrowser); | - |
| 249 | if (anchor.isEmpty()) { | - |
| 250 | #ifndef QT_NO_CURSOR | - |
| 251 | if (viewport->cursor().shape() != Qt::PointingHandCursor) | - |
| 252 | oldCursor = viewport->cursor(); | - |
| 253 | viewport->setCursor(oldCursor); | - |
| 254 | #endif | - |
| 255 | emit q->highlighted(QUrl()); | - |
| 256 | emit q->highlighted(QString()); | - |
| 257 | } else { | - |
| 258 | #ifndef QT_NO_CURSOR | - |
| 259 | viewport->setCursor(Qt::PointingHandCursor); | - |
| 260 | #endif | - |
| 261 | | - |
| 262 | const QUrl url = resolveUrl(anchor); | - |
| 263 | emit q->highlighted(url); | - |
| 264 | | - |
| 265 | emit q->highlighted(url.toString()); | - |
| 266 | } | - |
| 267 | } | - |
| 268 | | - |
| 269 | void QTextBrowserPrivate::setSource(const QUrl &url) | - |
| 270 | { | - |
| 271 | Q_Q(QTextBrowser); | - |
| 272 | #ifndef QT_NO_CURSOR | - |
| 273 | if (q->isVisible())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 274 | QApplication::setOverrideCursor(Qt::WaitCursor); never executed: QApplication::setOverrideCursor(Qt::WaitCursor); | 0 |
| 275 | #endif | - |
| 276 | textOrSourceChanged = true; | - |
| 277 | | - |
| 278 | QString txt; | - |
| 279 | | - |
| 280 | bool doSetText = false; | - |
| 281 | | - |
| 282 | QUrl currentUrlWithoutFragment = currentURL; | - |
| 283 | currentUrlWithoutFragment.setFragment(QString()); | - |
| 284 | QUrl newUrlWithoutFragment = currentURL.resolved(url); | - |
| 285 | newUrlWithoutFragment.setFragment(QString()); | - |
| 286 | | - |
| 287 | if (url.isValid()| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 288 | && (newUrlWithoutFragment != currentUrlWithoutFragment || forceLoadOnSourceChange)) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 289 | QVariant data = q->loadResource(QTextDocument::HtmlResource, resolveUrl(url)); | - |
| 290 | if (data.type() == QVariant::String) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 291 | txt = data.toString(); | - |
| 292 | } else if (data.type() == QVariant::ByteArray) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 293 | #ifndef QT_NO_TEXTCODEC | - |
| 294 | QByteArray ba = data.toByteArray(); | - |
| 295 | QTextCodec *codec = Qt::codecForHtml(ba); | - |
| 296 | txt = codec->toUnicode(ba); | - |
| 297 | #else | - |
| 298 | txt = data.toString(); | - |
| 299 | #endif | - |
| 300 | } never executed: end of block | 0 |
| 301 | if (Q_UNLIKELY(txt.isEmpty())()))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 302 | qWarning("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 |
| 303 | | - |
| 304 | if (q->isVisible()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 305 | QStringconst QStringRef firstTag = txt.leftleftRef(txt.indexOf(QLatin1Char('>')) + 1); | - |
| 306 | if (firstTag.startsWith(QLatin1String("<qt")) && firstTag.contains(QLatin1String("type")) && firstTag.contains(QLatin1String("detail"))) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 307 | #ifndef QT_NO_CURSOR | - |
| 308 | QApplication::restoreOverrideCursor(); | - |
| 309 | #endif | - |
| 310 | #ifndef QT_NO_WHATSTHIS | - |
| 311 | QWhatsThis::showText(QCursor::pos(), txt, q); | - |
| 312 | #endif | - |
| 313 | return; never executed: return; | 0 |
| 314 | } | - |
| 315 | } never executed: end of block | 0 |
| 316 | | - |
| 317 | currentURL = resolveUrl(url); | - |
| 318 | doSetText = true; | - |
| 319 | } never executed: end of block | 0 |
| 320 | | - |
| 321 | if (!home.isValid())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 322 | home = url; never executed: home = url; | 0 |
| 323 | | - |
| 324 | if (doSetText) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 325 | #ifndef QT_NO_TEXTHTMLPARSER | - |
| 326 | q->QTextEdit::setHtml(txt); | - |
| 327 | q->document()->setMetaInformation(QTextDocument::DocumentUrl, currentURL.toString()); | - |
| 328 | #else | - |
| 329 | q->QTextEdit::setPlainText(txt); | - |
| 330 | #endif | - |
| 331 | | - |
| 332 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 333 | prevFocus.movePosition(QTextCursor::Start); | - |
| 334 | #endif | - |
| 335 | } never executed: end of block | 0 |
| 336 | | - |
| 337 | forceLoadOnSourceChange = false; | - |
| 338 | | - |
| 339 | if (!url.fragment().isEmpty()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 340 | q->scrollToAnchor(url.fragment()); | - |
| 341 | } else { never executed: end of block | 0 |
| 342 | hbar->setValue(0); | - |
| 343 | vbar->setValue(0); | - |
| 344 | } never executed: end of block | 0 |
| 345 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 346 | lastKeypadScrollValue = vbar->value(); | - |
| 347 | emit q->highlighted(QUrl()); | - |
| 348 | emit q->highlighted(QString()); | - |
| 349 | #endif | - |
| 350 | | - |
| 351 | #ifndef QT_NO_CURSOR | - |
| 352 | if (q->isVisible())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 353 | QApplication::restoreOverrideCursor(); never executed: QApplication::restoreOverrideCursor(); | 0 |
| 354 | #endif | - |
| 355 | emit q->sourceChanged(url); | - |
| 356 | } never executed: end of block | 0 |
| 357 | | - |
| 358 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 359 | void QTextBrowserPrivate::keypadMove(bool next) | - |
| 360 | { | - |
| 361 | Q_Q(QTextBrowser); | - |
| 362 | | - |
| 363 | const int height = viewport->height(); | - |
| 364 | const int overlap = qBound(20, height / 5, 40); | - |
| 365 | const int visibleLinkAmount = overlap; | - |
| 366 | int yOffset = vbar->value(); | - |
| 367 | int scrollYOffset = qBound(0, next ? yOffset + height - overlap : yOffset - height + overlap, vbar->maximum()); | - |
| 368 | | - |
| 369 | bool foundNextAnchor = false; | - |
| 370 | bool focusIt = false; | - |
| 371 | int focusedPos = -1; | - |
| 372 | | - |
| 373 | QTextCursor anchorToFocus; | - |
| 374 | | - |
| 375 | QRectF viewRect = QRectF(0, yOffset, control->size().width(), height); | - |
| 376 | QRectF newViewRect = QRectF(0, scrollYOffset, control->size().width(), height); | - |
| 377 | QRectF bothViewRects = viewRect.united(newViewRect); | - |
| 378 | | - |
| 379 | | - |
| 380 | | - |
| 381 | if (prevFocus.isNull()) { | - |
| 382 | if (next) | - |
| 383 | prevFocus = control->cursorForPosition(QPointF(0, yOffset)); | - |
| 384 | else | - |
| 385 | prevFocus = control->cursorForPosition(QPointF(control->size().width(), yOffset + height)); | - |
| 386 | } | - |
| 387 | | - |
| 388 | | - |
| 389 | if (lastKeypadScrollValue != yOffset) { | - |
| 390 | | - |
| 391 | | - |
| 392 | | - |
| 393 | bool findOnScreen = true; | - |
| 394 | | - |
| 395 | | - |
| 396 | if (prevFocus.hasSelection()) { | - |
| 397 | QRectF prevRect = control->selectionRect(prevFocus); | - |
| 398 | if (viewRect.intersects(prevRect)) | - |
| 399 | findOnScreen = false; | - |
| 400 | } | - |
| 401 | | - |
| 402 | | - |
| 403 | | - |
| 404 | | - |
| 405 | if (findOnScreen) { | - |
| 406 | if (next) | - |
| 407 | prevFocus = control->cursorForPosition(QPointF(0, yOffset)); | - |
| 408 | else | - |
| 409 | prevFocus = control->cursorForPosition(QPointF(control->size().width(), yOffset + height)); | - |
| 410 | } | - |
| 411 | foundNextAnchor = control->findNextPrevAnchor(prevFocus, next, anchorToFocus); | - |
| 412 | } else if (prevFocus.hasSelection()) { | - |
| 413 | | - |
| 414 | | - |
| 415 | QRectF prevRect = control->selectionRect(prevFocus); | - |
| 416 | if ((next && prevRect.bottom() > (yOffset + height)) || | - |
| 417 | (!next && prevRect.top() < yOffset)) { | - |
| 418 | anchorToFocus = prevFocus; | - |
| 419 | focusedPos = scrollYOffset; | - |
| 420 | focusIt = true; | - |
| 421 | } else { | - |
| 422 | | - |
| 423 | | - |
| 424 | foundNextAnchor = control->findNextPrevAnchor(prevFocus, next, anchorToFocus); | - |
| 425 | } | - |
| 426 | } | - |
| 427 | | - |
| 428 | | - |
| 429 | if (!focusIt && !foundNextAnchor) { | - |
| 430 | if (next) { | - |
| 431 | if (yOffset == vbar->maximum()) { | - |
| 432 | prevFocus.movePosition(QTextCursor::Start); | - |
| 433 | yOffset = scrollYOffset = 0; | - |
| 434 | | - |
| 435 | | - |
| 436 | viewRect = QRectF(0, yOffset, control->size().width(), height); | - |
| 437 | newViewRect = QRectF(0, scrollYOffset, control->size().width(), height); | - |
| 438 | bothViewRects = viewRect.united(newViewRect); | - |
| 439 | } | - |
| 440 | } else { | - |
| 441 | if (yOffset == 0) { | - |
| 442 | prevFocus.movePosition(QTextCursor::End); | - |
| 443 | yOffset = scrollYOffset = vbar->maximum(); | - |
| 444 | | - |
| 445 | | - |
| 446 | viewRect = QRectF(0, yOffset, control->size().width(), height); | - |
| 447 | newViewRect = QRectF(0, scrollYOffset, control->size().width(), height); | - |
| 448 | bothViewRects = viewRect.united(newViewRect); | - |
| 449 | } | - |
| 450 | } | - |
| 451 | | - |
| 452 | | - |
| 453 | foundNextAnchor = control->findNextPrevAnchor(prevFocus, next, anchorToFocus); | - |
| 454 | } | - |
| 455 | | - |
| 456 | | - |
| 457 | if (foundNextAnchor) { | - |
| 458 | QRectF desiredRect = control->selectionRect(anchorToFocus); | - |
| 459 | | - |
| 460 | | - |
| 461 | | - |
| 462 | | - |
| 463 | | - |
| 464 | | - |
| 465 | | - |
| 466 | | - |
| 467 | | - |
| 468 | | - |
| 469 | | - |
| 470 | if(bothViewRects.contains(desiredRect) | - |
| 471 | || bothViewRects.adjusted(0, visibleLinkAmount, 0, -visibleLinkAmount).intersects(desiredRect)) { | - |
| 472 | focusIt = true; | - |
| 473 | | - |
| 474 | | - |
| 475 | | - |
| 476 | | - |
| 477 | if (desiredRect.height() > height) { | - |
| 478 | if (next) | - |
| 479 | focusedPos = (int) desiredRect.top(); | - |
| 480 | else | - |
| 481 | focusedPos = (int) desiredRect.bottom() - height; | - |
| 482 | } else | - |
| 483 | focusedPos = (int) ((desiredRect.top() + desiredRect.bottom()) / 2 - (height / 2)); | - |
| 484 | | - |
| 485 | | - |
| 486 | if (next) | - |
| 487 | focusedPos = qBound(yOffset, focusedPos, scrollYOffset); | - |
| 488 | else | - |
| 489 | focusedPos = qBound(scrollYOffset, focusedPos, yOffset); | - |
| 490 | } | - |
| 491 | } | - |
| 492 | | - |
| 493 | | - |
| 494 | | - |
| 495 | | - |
| 496 | if (!focusIt && prevFocus.hasSelection()) { | - |
| 497 | QRectF desiredRect = control->selectionRect(prevFocus); | - |
| 498 | | - |
| 499 | if(newViewRect.intersects(desiredRect)) { | - |
| 500 | focusedPos = scrollYOffset; | - |
| 501 | focusIt = true; | - |
| 502 | anchorToFocus = prevFocus; | - |
| 503 | } | - |
| 504 | } | - |
| 505 | | - |
| 506 | | - |
| 507 | | - |
| 508 | const int savedXOffset = hbar->value(); | - |
| 509 | | - |
| 510 | | - |
| 511 | if (focusIt && control->setFocusToAnchor(anchorToFocus)) { | - |
| 512 | | - |
| 513 | prevFocus = control->textCursor(); | - |
| 514 | | - |
| 515 | | - |
| 516 | vbar->setValue(focusedPos); | - |
| 517 | lastKeypadScrollValue = focusedPos; | - |
| 518 | hbar->setValue(savedXOffset); | - |
| 519 | | - |
| 520 | | - |
| 521 | const QString href = control->anchorAtCursor(); | - |
| 522 | QUrl url = resolveUrl(href); | - |
| 523 | emit q->highlighted(url); | - |
| 524 | emit q->highlighted(url.toString()); | - |
| 525 | } else { | - |
| 526 | | - |
| 527 | vbar->setValue(scrollYOffset); | - |
| 528 | lastKeypadScrollValue = scrollYOffset; | - |
| 529 | | - |
| 530 | | - |
| 531 | QTextCursor cursor = control->textCursor(); | - |
| 532 | cursor.clearSelection(); | - |
| 533 | | - |
| 534 | control->setTextCursor(cursor); | - |
| 535 | | - |
| 536 | hbar->setValue(savedXOffset); | - |
| 537 | vbar->setValue(scrollYOffset); | - |
| 538 | | - |
| 539 | emit q->highlighted(QUrl()); | - |
| 540 | emit q->highlighted(QString()); | - |
| 541 | } | - |
| 542 | } | - |
| 543 | #endif | - |
| 544 | | - |
| 545 | QTextBrowserPrivate::HistoryEntry QTextBrowserPrivate::createHistoryEntry() const | - |
| 546 | { | - |
| 547 | HistoryEntry entry; | - |
| 548 | entry.url = q_func()->source(); | - |
| 549 | entry.title = q_func()->documentTitle(); | - |
| 550 | entry.hpos = hbar->value(); | - |
| 551 | entry.vpos = vbar->value(); | - |
| 552 | | - |
| 553 | const QTextCursor cursor = control->textCursor(); | - |
| 554 | if (control->cursorIsFocusIndicator() | - |
| 555 | && cursor.hasSelection()) { | - |
| 556 | | - |
| 557 | entry.focusIndicatorPosition = cursor.position(); | - |
| 558 | entry.focusIndicatorAnchor = cursor.anchor(); | - |
| 559 | } | - |
| 560 | return entry; | - |
| 561 | } | - |
| 562 | | - |
| 563 | void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry entry&entry) | - |
| 564 | { | - |
| 565 | setSource(entry.url); | - |
| 566 | hbar->setValue(entry.hpos); | - |
| 567 | vbar->setValue(entry.vpos); | - |
| 568 | if (entry.focusIndicatorAnchor != -1 && entry.focusIndicatorPosition != -1) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 569 | QTextCursor cursor(control->document()); | - |
| 570 | cursor.setPosition(entry.focusIndicatorAnchor); | - |
| 571 | cursor.setPosition(entry.focusIndicatorPosition, QTextCursor::KeepAnchor); | - |
| 572 | control->setTextCursor(cursor); | - |
| 573 | control->setCursorIsFocusIndicator(true); | - |
| 574 | } never executed: end of block | 0 |
| 575 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 576 | lastKeypadScrollValue = vbar->value(); | - |
| 577 | prevFocus = control->textCursor(); | - |
| 578 | | - |
| 579 | Q_Q(QTextBrowser); | - |
| 580 | const QString href = prevFocus.charFormat().anchorHref(); | - |
| 581 | QUrl url = resolveUrl(href); | - |
| 582 | emit q->highlighted(url); | - |
| 583 | emit q->highlighted(url.toString()); | - |
| 584 | #endif | - |
| 585 | } never executed: end of block | 0 |
| 586 | | - |
| 587 | | - |
| 588 | | - |
| 589 | | - |
| 590 | | - |
| 591 | | - |
| 592 | | - |
| 593 | | - |
| 594 | | - |
| 595 | | - |
| 596 | | - |
| 597 | | - |
| 598 | | - |
| 599 | | - |
| 600 | | - |
| 601 | | - |
| 602 | | - |
| 603 | | - |
| 604 | | - |
| 605 | | - |
| 606 | | - |
| 607 | | - |
| 608 | | - |
| 609 | | - |
| 610 | | - |
| 611 | | - |
| 612 | | - |
| 613 | | - |
| 614 | | - |
| 615 | | - |
| 616 | | - |
| 617 | | - |
| 618 | | - |
| 619 | | - |
| 620 | | - |
| 621 | | - |
| 622 | | - |
| 623 | | - |
| 624 | | - |
| 625 | | - |
| 626 | | - |
| 627 | | - |
| 628 | | - |
| 629 | | - |
| 630 | | - |
| 631 | | - |
| 632 | | - |
| 633 | | - |
| 634 | | - |
| 635 | | - |
| 636 | | - |
| 637 | | - |
| 638 | | - |
| 639 | | - |
| 640 | | - |
| 641 | | - |
| 642 | | - |
| 643 | | - |
| 644 | | - |
| 645 | | - |
| 646 | | - |
| 647 | | - |
| 648 | | - |
| 649 | | - |
| 650 | | - |
| 651 | | - |
| 652 | | - |
| 653 | | - |
| 654 | | - |
| 655 | void QTextBrowserPrivate::init() | - |
| 656 | { | - |
| 657 | Q_Q(QTextBrowser); | - |
| 658 | control->setTextInteractionFlags(Qt::TextBrowserInteraction); | - |
| 659 | #ifndef QT_NO_CURSOR | - |
| 660 | viewport->setCursor(oldCursor); | - |
| 661 | #endif | - |
| 662 | q->setAttribute(Qt::WA_InputMethodEnabled, !q->isReadOnly()); | - |
| 663 | q->setUndoRedoEnabled(false); | - |
| 664 | viewport->setMouseTracking(true); | - |
| 665 | QObject::connect(q->document(), SIGNAL(contentsChanged()), q, SLOT(_q_documentModified())); | - |
| 666 | QObject::connect(control, SIGNAL(linkActivated(QString)), | - |
| 667 | q, SLOT(_q_activateAnchor(QString))); | - |
| 668 | QObject::connect(control, SIGNAL(linkHovered(QString)), | - |
| 669 | q, SLOT(_q_highlightLink(QString))); | - |
| 670 | } | - |
| 671 | | - |
| 672 | | - |
| 673 | | - |
| 674 | | - |
| 675 | QTextBrowser::QTextBrowser(QWidget *parent) | - |
| 676 | : QTextEdit(*new QTextBrowserPrivate, parent) | - |
| 677 | { | - |
| 678 | Q_D(QTextBrowser); | - |
| 679 | d->init(); | - |
| 680 | } | - |
| 681 | | - |
| 682 | | - |
| 683 | | - |
| 684 | | - |
| 685 | | - |
| 686 | QTextBrowser::~QTextBrowser() | - |
| 687 | { | - |
| 688 | } | - |
| 689 | | - |
| 690 | | - |
| 691 | | - |
| 692 | | - |
| 693 | | - |
| 694 | | - |
| 695 | | - |
| 696 | | - |
| 697 | | - |
| 698 | | - |
| 699 | | - |
| 700 | | - |
| 701 | | - |
| 702 | | - |
| 703 | | - |
| 704 | | - |
| 705 | | - |
| 706 | | - |
| 707 | | - |
| 708 | | - |
| 709 | | - |
| 710 | | - |
| 711 | QUrl QTextBrowser::source() const | - |
| 712 | { | - |
| 713 | Q_D(const QTextBrowser); | - |
| 714 | if (d->stack.isEmpty()) | - |
| 715 | return QUrl(); | - |
| 716 | else | - |
| 717 | return d->stack.top().url; | - |
| 718 | } | - |
| 719 | | - |
| 720 | | - |
| 721 | | - |
| 722 | | - |
| 723 | | - |
| 724 | | - |
| 725 | | - |
| 726 | | - |
| 727 | | - |
| 728 | | - |
| 729 | | - |
| 730 | QStringList QTextBrowser::searchPaths() const | - |
| 731 | { | - |
| 732 | Q_D(const QTextBrowser); | - |
| 733 | return d->searchPaths; | - |
| 734 | } | - |
| 735 | | - |
| 736 | void QTextBrowser::setSearchPaths(const QStringList &paths) | - |
| 737 | { | - |
| 738 | Q_D(QTextBrowser); | - |
| 739 | d->searchPaths = paths; | - |
| 740 | } | - |
| 741 | | - |
| 742 | | - |
| 743 | | - |
| 744 | | - |
| 745 | void QTextBrowser::reload() | - |
| 746 | { | - |
| 747 | Q_D(QTextBrowser); | - |
| 748 | QUrl s = d->currentURL; | - |
| 749 | d->currentURL = QUrl(); | - |
| 750 | setSource(s); | - |
| 751 | } | - |
| 752 | | - |
| 753 | void QTextBrowser::setSource(const QUrl &url) | - |
| 754 | { | - |
| 755 | Q_D(QTextBrowser); | - |
| 756 | | - |
| 757 | const QTextBrowserPrivate::HistoryEntry historyEntry = d->createHistoryEntry(); | - |
| 758 | | - |
| 759 | d->setSource(url); | - |
| 760 | | - |
| 761 | if (!url.isValid()) | - |
| 762 | return; | - |
| 763 | | - |
| 764 | | - |
| 765 | if (!d->stack.isEmpty() && d->stack.top().url == url) | - |
| 766 | return; | - |
| 767 | | - |
| 768 | if (!d->stack.isEmpty()) | - |
| 769 | d->stack.top() = historyEntry; | - |
| 770 | | - |
| 771 | QTextBrowserPrivate::HistoryEntry entry; | - |
| 772 | entry.url = url; | - |
| 773 | entry.title = documentTitle(); | - |
| 774 | entry.hpos = 0; | - |
| 775 | entry.vpos = 0; | - |
| 776 | d->stack.push(entry); | - |
| 777 | | - |
| 778 | emit backwardAvailable(d->stack.count() > 1); | - |
| 779 | | - |
| 780 | if (!d->forwardStack.isEmpty() && d->forwardStack.top().url == url) { | - |
| 781 | d->forwardStack.pop(); | - |
| 782 | emit forwardAvailable(d->forwardStack.count() > 0); | - |
| 783 | } else { | - |
| 784 | d->forwardStack.clear(); | - |
| 785 | emit forwardAvailable(false); | - |
| 786 | } | - |
| 787 | | - |
| 788 | emit historyChanged(); | - |
| 789 | } | - |
| 790 | | - |
| 791 | | - |
| 792 | | - |
| 793 | | - |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | | - |
| 798 | | - |
| 799 | | - |
| 800 | | - |
| 801 | | - |
| 802 | | - |
| 803 | | - |
| 804 | | - |
| 805 | | - |
| 806 | | - |
| 807 | | - |
| 808 | | - |
| 809 | | - |
| 810 | | - |
| 811 | | - |
| 812 | | - |
| 813 | | - |
| 814 | | - |
| 815 | | - |
| 816 | | - |
| 817 | | - |
| 818 | | - |
| 819 | | - |
| 820 | | - |
| 821 | | - |
| 822 | | - |
| 823 | | - |
| 824 | | - |
| 825 | | - |
| 826 | | - |
| 827 | | - |
| 828 | | - |
| 829 | | - |
| 830 | | - |
| 831 | | - |
| 832 | | - |
| 833 | | - |
| 834 | | - |
| 835 | | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | | - |
| 840 | | - |
| 841 | | - |
| 842 | | - |
| 843 | | - |
| 844 | | - |
| 845 | | - |
| 846 | | - |
| 847 | | - |
| 848 | | - |
| 849 | | - |
| 850 | | - |
| 851 | | - |
| 852 | | - |
| 853 | | - |
| 854 | | - |
| 855 | | - |
| 856 | | - |
| 857 | | - |
| 858 | | - |
| 859 | | - |
| 860 | | - |
| 861 | | - |
| 862 | void QTextBrowser::backward() | - |
| 863 | { | - |
| 864 | Q_D(QTextBrowser); | - |
| 865 | if (d->stack.count() <= 1) | - |
| 866 | return; | - |
| 867 | | - |
| 868 | | - |
| 869 | d->forwardStack.push(d->createHistoryEntry()); | - |
| 870 | d->stack.pop(); | - |
| 871 | d->restoreHistoryEntry(d->stack.top()); | - |
| 872 | emit backwardAvailable(d->stack.count() > 1); | - |
| 873 | emit forwardAvailable(true); | - |
| 874 | emit historyChanged(); | - |
| 875 | } | - |
| 876 | | - |
| 877 | | - |
| 878 | | - |
| 879 | | - |
| 880 | | - |
| 881 | | - |
| 882 | | - |
| 883 | | - |
| 884 | void QTextBrowser::forward() | - |
| 885 | { | - |
| 886 | Q_D(QTextBrowser); | - |
| 887 | if (d->forwardStack.isEmpty()) | - |
| 888 | return; | - |
| 889 | if (!d->stack.isEmpty()) { | - |
| 890 | | - |
| 891 | d->stack.top() = d->createHistoryEntry(); | - |
| 892 | } | - |
| 893 | d->stack.push(d->forwardStack.pop()); | - |
| 894 | d->restoreHistoryEntry(d->stack.top()); | - |
| 895 | emit backwardAvailable(true); | - |
| 896 | emit forwardAvailable(!d->forwardStack.isEmpty()); | - |
| 897 | emit historyChanged(); | - |
| 898 | } | - |
| 899 | | - |
| 900 | | - |
| 901 | | - |
| 902 | | - |
| 903 | | - |
| 904 | void QTextBrowser::home() | - |
| 905 | { | - |
| 906 | Q_D(QTextBrowser); | - |
| 907 | if (d->home.isValid()) | - |
| 908 | setSource(d->home); | - |
| 909 | } | - |
| 910 | | - |
| 911 | | - |
| 912 | | - |
| 913 | | - |
| 914 | | - |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | | - |
| 920 | void QTextBrowser::keyPressEvent(QKeyEvent *ev) | - |
| 921 | { | - |
| 922 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 923 | Q_D(QTextBrowser); | - |
| 924 | switch (ev->key()) { | - |
| 925 | case Qt::Key_Select: | - |
| 926 | if (QApplication::keypadNavigationEnabled()) { | - |
| 927 | if (!hasEditFocus()) { | - |
| 928 | setEditFocus(true); | - |
| 929 | return; | - |
| 930 | } else { | - |
| 931 | QTextCursor cursor = d->control->textCursor(); | - |
| 932 | QTextCharFormat charFmt = cursor.charFormat(); | - |
| 933 | if (!cursor.hasSelection() || charFmt.anchorHref().isEmpty()) { | - |
| 934 | ev->accept(); | - |
| 935 | return; | - |
| 936 | } | - |
| 937 | } | - |
| 938 | } | - |
| 939 | break; | - |
| 940 | case Qt::Key_Back: | - |
| 941 | if (QApplication::keypadNavigationEnabled()) { | - |
| 942 | if (hasEditFocus()) { | - |
| 943 | setEditFocus(false); | - |
| 944 | ev->accept(); | - |
| 945 | return; | - |
| 946 | } | - |
| 947 | } | - |
| 948 | QTextEdit::keyPressEvent(ev); | - |
| 949 | return; | - |
| 950 | default: | - |
| 951 | if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { | - |
| 952 | ev->ignore(); | - |
| 953 | return; | - |
| 954 | } | - |
| 955 | } | - |
| 956 | #endif | - |
| 957 | | - |
| 958 | if (ev->modifiers() & Qt::AltModifier) { | - |
| 959 | switch (ev->key()) { | - |
| 960 | case Qt::Key_Right: | - |
| 961 | forward(); | - |
| 962 | ev->accept(); | - |
| 963 | return; | - |
| 964 | case Qt::Key_Left: | - |
| 965 | backward(); | - |
| 966 | ev->accept(); | - |
| 967 | return; | - |
| 968 | case Qt::Key_Up: | - |
| 969 | home(); | - |
| 970 | ev->accept(); | - |
| 971 | return; | - |
| 972 | } | - |
| 973 | } | - |
| 974 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 975 | else { | - |
| 976 | if (ev->key() == Qt::Key_Up) { | - |
| 977 | d->keypadMove(false); | - |
| 978 | return; | - |
| 979 | } else if (ev->key() == Qt::Key_Down) { | - |
| 980 | d->keypadMove(true); | - |
| 981 | return; | - |
| 982 | } | - |
| 983 | } | - |
| 984 | #endif | - |
| 985 | QTextEdit::keyPressEvent(ev); | - |
| 986 | } | - |
| 987 | | - |
| 988 | | - |
| 989 | | - |
| 990 | | - |
| 991 | void QTextBrowser::mouseMoveEvent(QMouseEvent *e) | - |
| 992 | { | - |
| 993 | QTextEdit::mouseMoveEvent(e); | - |
| 994 | } | - |
| 995 | | - |
| 996 | | - |
| 997 | | - |
| 998 | | - |
| 999 | void QTextBrowser::mousePressEvent(QMouseEvent *e) | - |
| 1000 | { | - |
| 1001 | QTextEdit::mousePressEvent(e); | - |
| 1002 | } | - |
| 1003 | | - |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | void QTextBrowser::mouseReleaseEvent(QMouseEvent *e) | - |
| 1008 | { | - |
| 1009 | QTextEdit::mouseReleaseEvent(e); | - |
| 1010 | } | - |
| 1011 | | - |
| 1012 | | - |
| 1013 | | - |
| 1014 | | - |
| 1015 | void QTextBrowser::focusOutEvent(QFocusEvent *ev) | - |
| 1016 | { | - |
| 1017 | #ifndef QT_NO_CURSOR | - |
| 1018 | Q_D(QTextBrowser); | - |
| 1019 | d->viewport->setCursor((!(d->control->textInteractionFlags() & Qt::TextEditable)) ? d->oldCursor : Qt::IBeamCursor); | - |
| 1020 | #endif | - |
| 1021 | QTextEdit::focusOutEvent(ev); | - |
| 1022 | } | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | | - |
| 1027 | bool QTextBrowser::focusNextPrevChild(bool next) | - |
| 1028 | { | - |
| 1029 | Q_D(QTextBrowser); | - |
| 1030 | if (d->control->setFocusToNextOrPreviousAnchor(next)) { | - |
| 1031 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1032 | | - |
| 1033 | if (d->prevFocus != d->control->textCursor() && d->control->textCursor().hasSelection()) { | - |
| 1034 | const QString href = d->control->anchorAtCursor(); | - |
| 1035 | QUrl url = d->resolveUrl(href); | - |
| 1036 | emit highlighted(url); | - |
| 1037 | emit highlighted(url.toString()); | - |
| 1038 | } | - |
| 1039 | d->prevFocus = d->control->textCursor(); | - |
| 1040 | #endif | - |
| 1041 | return true; | - |
| 1042 | } else { | - |
| 1043 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1044 | | - |
| 1045 | emit highlighted(QUrl()); | - |
| 1046 | emit highlighted(QString()); | - |
| 1047 | #endif | - |
| 1048 | } | - |
| 1049 | return QTextEdit::focusNextPrevChild(next); | - |
| 1050 | } | - |
| 1051 | | - |
| 1052 | | - |
| 1053 | | - |
| 1054 | | - |
| 1055 | void QTextBrowser::paintEvent(QPaintEvent *e) | - |
| 1056 | { | - |
| 1057 | Q_D(QTextBrowser); | - |
| 1058 | QPainter p(d->viewport); | - |
| 1059 | d->paint(&p, e); | - |
| 1060 | } | - |
| 1061 | | - |
| 1062 | | - |
| 1063 | | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | | - |
| 1069 | | - |
| 1070 | | - |
| 1071 | | - |
| 1072 | | - |
| 1073 | | - |
| 1074 | | - |
| 1075 | | - |
| 1076 | | - |
| 1077 | | - |
| 1078 | | - |
| 1079 | | - |
| 1080 | | - |
| 1081 | | - |
| 1082 | | - |
| 1083 | | - |
| 1084 | | - |
| 1085 | | - |
| 1086 | QVariant QTextBrowser::loadResource(int , const QUrl &name) | - |
| 1087 | { | - |
| 1088 | Q_D(QTextBrowser); | - |
| 1089 | | - |
| 1090 | QByteArray data; | - |
| 1091 | QString fileName = d->findFile(d->resolveUrl(name)); | - |
| 1092 | QFile f(fileName); | - |
| 1093 | if (f.open(QFile::ReadOnly)) { | - |
| 1094 | data = f.readAll(); | - |
| 1095 | f.close(); | - |
| 1096 | } else { | - |
| 1097 | return QVariant(); | - |
| 1098 | } | - |
| 1099 | | - |
| 1100 | return data; | - |
| 1101 | } | - |
| 1102 | | - |
| 1103 | | - |
| 1104 | | - |
| 1105 | | - |
| 1106 | | - |
| 1107 | | - |
| 1108 | | - |
| 1109 | | - |
| 1110 | | - |
| 1111 | bool QTextBrowser::isBackwardAvailable() const | - |
| 1112 | { | - |
| 1113 | Q_D(const QTextBrowser); | - |
| 1114 | return d->stack.count() > 1; | - |
| 1115 | } | - |
| 1116 | | - |
| 1117 | | - |
| 1118 | | - |
| 1119 | | - |
| 1120 | | - |
| 1121 | | - |
| 1122 | | - |
| 1123 | | - |
| 1124 | | - |
| 1125 | bool QTextBrowser::isForwardAvailable() const | - |
| 1126 | { | - |
| 1127 | Q_D(const QTextBrowser); | - |
| 1128 | return !d->forwardStack.isEmpty(); | - |
| 1129 | } | - |
| 1130 | | - |
| 1131 | | - |
| 1132 | | - |
| 1133 | | - |
| 1134 | | - |
| 1135 | | - |
| 1136 | | - |
| 1137 | | - |
| 1138 | | - |
| 1139 | void QTextBrowser::clearHistory() | - |
| 1140 | { | - |
| 1141 | Q_D(QTextBrowser); | - |
| 1142 | d->forwardStack.clear(); | - |
| 1143 | if (!d->stack.isEmpty()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1144 | QTextBrowserPrivate::HistoryEntry historyEntry = d->stack.top(); | - |
| 1145 | d->stack.resize(0);clear(); | - |
| 1146 | d->stack.push(historyEntry); | - |
| 1147 | d->home = historyEntry.url; | - |
| 1148 | } never executed: end of block | 0 |
| 1149 | emit forwardAvailable(false); | - |
| 1150 | emit backwardAvailable(false); | - |
| 1151 | emit historyChanged(); | - |
| 1152 | } never executed: end of block | 0 |
| 1153 | | - |
| 1154 | | - |
| 1155 | | - |
| 1156 | | - |
| 1157 | | - |
| 1158 | | - |
| 1159 | | - |
| 1160 | | - |
| 1161 | | - |
| 1162 | | - |
| 1163 | | - |
| 1164 | | - |
| 1165 | | - |
| 1166 | QUrl QTextBrowser::historyUrl(int i) const | - |
| 1167 | { | - |
| 1168 | Q_D(const QTextBrowser); | - |
| 1169 | return d->history(i).url; | - |
| 1170 | } | - |
| 1171 | | - |
| 1172 | | - |
| 1173 | | - |
| 1174 | | - |
| 1175 | | - |
| 1176 | | - |
| 1177 | | - |
| 1178 | | - |
| 1179 | | - |
| 1180 | | - |
| 1181 | | - |
| 1182 | | - |
| 1183 | | - |
| 1184 | | - |
| 1185 | | - |
| 1186 | QString QTextBrowser::historyTitle(int i) const | - |
| 1187 | { | - |
| 1188 | Q_D(const QTextBrowser); | - |
| 1189 | return d->history(i).title; | - |
| 1190 | } | - |
| 1191 | | - |
| 1192 | | - |
| 1193 | | - |
| 1194 | | - |
| 1195 | | - |
| 1196 | | - |
| 1197 | | - |
| 1198 | int QTextBrowser::forwardHistoryCount() const | - |
| 1199 | { | - |
| 1200 | Q_D(const QTextBrowser); | - |
| 1201 | return d->forwardStack.count(); | - |
| 1202 | } | - |
| 1203 | | - |
| 1204 | | - |
| 1205 | | - |
| 1206 | | - |
| 1207 | | - |
| 1208 | | - |
| 1209 | int QTextBrowser::backwardHistoryCount() const | - |
| 1210 | { | - |
| 1211 | Q_D(const QTextBrowser); | - |
| 1212 | return d->stack.count()-1; | - |
| 1213 | } | - |
| 1214 | | - |
| 1215 | | - |
| 1216 | | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | | - |
| 1220 | | - |
| 1221 | | - |
| 1222 | | - |
| 1223 | | - |
| 1224 | | - |
| 1225 | | - |
| 1226 | bool QTextBrowser::openExternalLinks() const | - |
| 1227 | { | - |
| 1228 | Q_D(const QTextBrowser); | - |
| 1229 | return d->openExternalLinks; | - |
| 1230 | } | - |
| 1231 | | - |
| 1232 | void QTextBrowser::setOpenExternalLinks(bool open) | - |
| 1233 | { | - |
| 1234 | Q_D(QTextBrowser); | - |
| 1235 | d->openExternalLinks = open; | - |
| 1236 | } | - |
| 1237 | | - |
| 1238 | | - |
| 1239 | | - |
| 1240 | | - |
| 1241 | | - |
| 1242 | | - |
| 1243 | | - |
| 1244 | | - |
| 1245 | | - |
| 1246 | | - |
| 1247 | | - |
| 1248 | | - |
| 1249 | | - |
| 1250 | bool QTextBrowser::openLinks() const | - |
| 1251 | { | - |
| 1252 | Q_D(const QTextBrowser); | - |
| 1253 | return d->openLinks; | - |
| 1254 | } | - |
| 1255 | | - |
| 1256 | void QTextBrowser::setOpenLinks(bool open) | - |
| 1257 | { | - |
| 1258 | Q_D(QTextBrowser); | - |
| 1259 | d->openLinks = open; | - |
| 1260 | } | - |
| 1261 | | - |
| 1262 | | - |
| 1263 | bool QTextBrowser::event(QEvent *e) | - |
| 1264 | { | - |
| 1265 | return QTextEdit::event(e); | - |
| 1266 | } | - |
| 1267 | | - |
| 1268 | QT_END_NAMESPACE | - |
| 1269 | | - |
| 1270 | #include "moc_qtextbrowser.cpp" | - |
| 1271 | | - |
| 1272 | #endif // QT_NO_TEXTBROWSER | - |
| | |