| 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 "qwindow.h" | - |
| 41 | | - |
| 42 | #include <qpa/qplatformwindow.h> | - |
| 43 | #include <qpa/qplatformintegration.h> | - |
| 44 | #include "qsurfaceformat.h" | - |
| 45 | #ifndef QT_NO_OPENGL | - |
| 46 | #include <qpa/qplatformopenglcontext.h> | - |
| 47 | #include "qopenglcontext.h" | - |
| 48 | #endif | - |
| 49 | #include "qscreen.h" | - |
| 50 | | - |
| 51 | #include "qwindow_p.h" | - |
| 52 | #include "qguiapplication_p.h" | - |
| 53 | #ifndef QT_NO_ACCESSIBILITY | - |
| 54 | # include "qaccessible.h" | - |
| 55 | #endif | - |
| 56 | #include "qhighdpiscaling_p.h" | - |
| 57 | | - |
| 58 | #include <private/qevent_p.h> | - |
| 59 | | - |
| 60 | #include <QtCore/QTimer> | - |
| 61 | #include <QtCore/QDebug> | - |
| 62 | | - |
| 63 | #include <QStyleHints> | - |
| 64 | #include <qpa/qplatformcursor.h> | - |
| 65 | | - |
| 66 | QT_BEGIN_NAMESPACE | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | | - |
| 152 | | - |
| 153 | QWindow::QWindow(QScreen *targetScreen) | - |
| 154 | : QObject(*new QWindowPrivate(), 0) | - |
| 155 | , QSurface(QSurface::Window) | - |
| 156 | { | - |
| 157 | Q_D(QWindow); | - |
| 158 | d->connectToScreen(targetScreen ? targetScreen : QGuiApplication::primaryScreen()); | - |
| 159 | d->init(); | - |
| 160 | } | - |
| 161 | | - |
| 162 | | - |
| 163 | | - |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | | - |
| 172 | QWindow::QWindow(QWindow *parent) | - |
| 173 | : QObject(*new QWindowPrivate(), parent) | - |
| 174 | , QSurface(QSurface::Window) | - |
| 175 | { | - |
| 176 | Q_D(QWindow); | - |
| 177 | d->parentWindow = parent; | - |
| 178 | if (!parent) | - |
| 179 | d->connectToScreen(QGuiApplication::primaryScreen()); | - |
| 180 | d->init(); | - |
| 181 | } | - |
| 182 | | - |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | | - |
| 194 | | - |
| 195 | QWindow::QWindow(QWindowPrivate &dd, QWindow *parent) | - |
| 196 | : QObject(dd, parent) | - |
| 197 | , QSurface(QSurface::Window) | - |
| 198 | { | - |
| 199 | Q_D(QWindow); | - |
| 200 | d->parentWindow = parent; | - |
| 201 | if (!parent) | - |
| 202 | d->connectToScreen(QGuiApplication::primaryScreen()); | - |
| 203 | d->init(); | - |
| 204 | } | - |
| 205 | | - |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | QWindow::~QWindow() | - |
| 210 | { | - |
| 211 | destroy(); | - |
| 212 | QGuiApplicationPrivate::window_list.removeAll(this); | - |
| 213 | if (!QGuiApplicationPrivate::is_app_closing) | - |
| 214 | QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this); | - |
| 215 | } | - |
| 216 | | - |
| 217 | void QWindowPrivate::init() | - |
| 218 | { | - |
| 219 | Q_Q(QWindow); | - |
| 220 | | - |
| 221 | | - |
| 222 | | - |
| 223 | if (Q_UNLIKELY(!parentWindow && !topLevelScreen))) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 224 | qFatal("Cannot create window: no screens available"); | - |
| 225 | exit(1); never executed: exit(1); | 0 |
| 226 | } | - |
| 227 | QGuiApplicationPrivate::window_list.prepend(q); | - |
| 228 | | - |
| 229 | requestedFormat = QSurfaceFormat::defaultFormat(); | - |
| 230 | } never executed: end of block | 0 |
| 231 | | - |
| 232 | | - |
| 233 | | - |
| 234 | | - |
| 235 | | - |
| 236 | | - |
| 237 | | - |
| 238 | | - |
| 239 | | - |
| 240 | | - |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | | - |
| 247 | | - |
| 248 | | - |
| 249 | | - |
| 250 | | - |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | | - |
| 261 | | - |
| 262 | | - |
| 263 | | - |
| 264 | | - |
| 265 | | - |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | | - |
| 278 | | - |
| 279 | | - |
| 280 | | - |
| 281 | QWindow::Visibility QWindow::visibility() const | - |
| 282 | { | - |
| 283 | Q_D(const QWindow); | - |
| 284 | return d->visibility; | - |
| 285 | } | - |
| 286 | | - |
| 287 | void QWindow::setVisibility(Visibility v) | - |
| 288 | { | - |
| 289 | switch (v) { | - |
| 290 | case Hidden: | - |
| 291 | hide(); | - |
| 292 | break; | - |
| 293 | case AutomaticVisibility: | - |
| 294 | show(); | - |
| 295 | break; | - |
| 296 | case Windowed: | - |
| 297 | showNormal(); | - |
| 298 | break; | - |
| 299 | case Minimized: | - |
| 300 | showMinimized(); | - |
| 301 | break; | - |
| 302 | case Maximized: | - |
| 303 | showMaximized(); | - |
| 304 | break; | - |
| 305 | case FullScreen: | - |
| 306 | showFullScreen(); | - |
| 307 | break; | - |
| 308 | default: | - |
| 309 | Q_ASSERT(false); | - |
| 310 | break; | - |
| 311 | } | - |
| 312 | } | - |
| 313 | | - |
| 314 | void QWindowPrivate::updateVisibility() | - |
| 315 | { | - |
| 316 | Q_Q(QWindow); | - |
| 317 | | - |
| 318 | QWindow::Visibility old = visibility; | - |
| 319 | | - |
| 320 | if (visible) { | - |
| 321 | switch (windowState) { | - |
| 322 | case Qt::WindowMinimized: | - |
| 323 | visibility = QWindow::Minimized; | - |
| 324 | break; | - |
| 325 | case Qt::WindowMaximized: | - |
| 326 | visibility = QWindow::Maximized; | - |
| 327 | break; | - |
| 328 | case Qt::WindowFullScreen: | - |
| 329 | visibility = QWindow::FullScreen; | - |
| 330 | break; | - |
| 331 | case Qt::WindowNoState: | - |
| 332 | visibility = QWindow::Windowed; | - |
| 333 | break; | - |
| 334 | default: | - |
| 335 | Q_ASSERT(false); | - |
| 336 | break; | - |
| 337 | } | - |
| 338 | } else { | - |
| 339 | visibility = QWindow::Hidden; | - |
| 340 | } | - |
| 341 | | - |
| 342 | if (visibility != old) | - |
| 343 | emit q->visibilityChanged(visibility); | - |
| 344 | } | - |
| 345 | | - |
| 346 | inline bool QWindowPrivate::windowRecreationRequired(QScreen *newScreen) const | - |
| 347 | { | - |
| 348 | Q_Q(const QWindow); | - |
| 349 | const QScreen *oldScreen = q->screen(); | - |
| 350 | return oldScreen != newScreen && (platformWindow || !oldScreen) | - |
| 351 | && !(oldScreen && oldScreen->virtualSiblings().contains(newScreen)); | - |
| 352 | } | - |
| 353 | | - |
| 354 | inline void QWindowPrivate::disconnectFromScreen() | - |
| 355 | { | - |
| 356 | if (topLevelScreen) | - |
| 357 | topLevelScreen = 0; | - |
| 358 | } | - |
| 359 | | - |
| 360 | void QWindowPrivate::connectToScreen(QScreen *screen) | - |
| 361 | { | - |
| 362 | disconnectFromScreen(); | - |
| 363 | topLevelScreen = screen; | - |
| 364 | } | - |
| 365 | | - |
| 366 | void QWindowPrivate::emitScreenChangedRecursion(QScreen *newScreen) | - |
| 367 | { | - |
| 368 | Q_Q(QWindow); | - |
| 369 | emit q->screenChanged(newScreen); | - |
| 370 | foreachfor (QObject *child ,: q->children()) { | - |
| 371 | if (child->isWindowType())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 372 | static_cast<QWindow *>(child)->d_func()->emitScreenChangedRecursion(newScreen); never executed: static_cast<QWindow *>(child)->d_func()->emitScreenChangedRecursion(newScreen); | 0 |
| 373 | } never executed: end of block | 0 |
| 374 | } never executed: end of block | 0 |
| 375 | | - |
| 376 | void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) | - |
| 377 | { | - |
| 378 | Q_Q(QWindow); | - |
| 379 | if (parentWindow) { | - |
| 380 | qWarning() << q << '(' << newScreen << "): Attempt to set a screen on a child window."; | - |
| 381 | return; | - |
| 382 | } | - |
| 383 | if (newScreen != topLevelScreen) { | - |
| 384 | const bool shouldRecreate = recreate && windowRecreationRequired(newScreen); | - |
| 385 | const bool shouldShow = visibilityOnDestroy && !topLevelScreen; | - |
| 386 | if (shouldRecreate && platformWindow) | - |
| 387 | q->destroy(); | - |
| 388 | connectToScreen(newScreen); | - |
| 389 | if (shouldShow) | - |
| 390 | q->setVisible(true); | - |
| 391 | else if (newScreen && shouldRecreate) | - |
| 392 | create(true); | - |
| 393 | emitScreenChangedRecursion(newScreen); | - |
| 394 | } | - |
| 395 | } | - |
| 396 | | - |
| 397 | void QWindowPrivate::create(bool recursive) | - |
| 398 | { | - |
| 399 | Q_Q(QWindow); | - |
| 400 | if (platformWindow)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 401 | return; never executed: return; | 0 |
| 402 | | - |
| 403 | if (q->parent())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 404 | q->parent()->create(); never executed: q->parent()->create(); | 0 |
| 405 | | - |
| 406 | platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(q); | - |
| 407 | Q_ASSERT(platformWindow || q->type() == Qt::ForeignWindow); | - |
| 408 | | - |
| 409 | if (!platformWindow) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 410 | qWarning() << "Failed to create platform window for" << q << "with flags" << q->flags(); | - |
| 411 | return; never executed: return; | 0 |
| 412 | } | - |
| 413 | | - |
| 414 | QObjectList childObjects = q->children(); | - |
| 415 | for (int i = 0; i < childObjects.size(); i ++) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 416 | QObject *object = childObjects.at(i); | - |
| 417 | if ((!object->isWindowType())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 418 | {continue; never executed: continue; | 0 |
| 419 | | - |
| 420 | QWindow *windowchildWindow = static_cast<QWindow *>(object); | - |
| 421 | if (recursive)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 422 | windowchildWindow->d_func()->create(recursive); never executed: childWindow->d_func()->create(recursive); | 0 |
| 423 | | - |
| 424 | | - |
| 425 | | - |
| 426 | | - |
| 427 | if (childWindow->isVisible())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 428 | childWindow->setVisible never executed: childWindow->setVisible(true); (true);never executed: childWindow->setVisible(true); | 0 |
| 429 | | - |
| 430 | if (windowQPlatformWindow *childPlatformWindow = childWindow->d_func()->platformWindow)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 431 | window->d_func()->platformWindowchildPlatformWindow->setParent(this->platformWindow); never executed: childPlatformWindow->setParent(this->platformWindow); | 0 |
| 432 | }} never executed: end of block | 0 |
| 433 | | - |
| 434 | QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); | - |
| 435 | QGuiApplication::sendEvent(q, &e); | - |
| 436 | } never executed: end of block | 0 |
| 437 | | - |
| 438 | void QWindowPrivate::clearFocusObject() | - |
| 439 | { | - |
| 440 | } | - |
| 441 | | - |
| 442 | | - |
| 443 | | - |
| 444 | | - |
| 445 | QRectF QWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const | - |
| 446 | { | - |
| 447 | Q_UNUSED(rect) | - |
| 448 | return QRectF(); | - |
| 449 | } | - |
| 450 | | - |
| 451 | | - |
| 452 | | - |
| 453 | | - |
| 454 | | - |
| 455 | | - |
| 456 | | - |
| 457 | | - |
| 458 | | - |
| 459 | | - |
| 460 | | - |
| 461 | | - |
| 462 | | - |
| 463 | | - |
| 464 | void QWindow::setSurfaceType(SurfaceType surfaceType) | - |
| 465 | { | - |
| 466 | Q_D(QWindow); | - |
| 467 | d->surfaceType = surfaceType; | - |
| 468 | } | - |
| 469 | | - |
| 470 | | - |
| 471 | | - |
| 472 | | - |
| 473 | | - |
| 474 | | - |
| 475 | QWindow::SurfaceType QWindow::surfaceType() const | - |
| 476 | { | - |
| 477 | Q_D(const QWindow); | - |
| 478 | return d->surfaceType; | - |
| 479 | } | - |
| 480 | | - |
| 481 | | - |
| 482 | | - |
| 483 | | - |
| 484 | | - |
| 485 | | - |
| 486 | | - |
| 487 | | - |
| 488 | | - |
| 489 | | - |
| 490 | | - |
| 491 | | - |
| 492 | void QWindow::setVisible(bool visible) | - |
| 493 | { | - |
| 494 | Q_D(QWindow); | - |
| 495 | | - |
| 496 | if (d->visible ==!= visible) return;{| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 497 | d->visible = visible; | - |
| 498 | emit visibleChanged(visible); | - |
| 499 | d->updateVisibility(); | - |
| 500 | } else if (d->platformWindow) { never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 501 | | - |
| 502 | return; never executed: return; | 0 |
| 503 | } | - |
| 504 | | - |
| 505 | if (!d->platformWindow) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 506 | | - |
| 507 | | - |
| 508 | if (parent() && !parent()->handle())| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 509 | return; never executed: return; | 0 |
| 510 | else | - |
| 511 | create(); never executed: create(); | 0 |
| 512 | } | - |
| 513 | | - |
| 514 | if (visible) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 515 | | - |
| 516 | QCoreApplication::removePostedEvents(qApp, QEvent::Quit); | - |
| 517 | | - |
| 518 | if (type() == Qt::Window) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 519 | QGuiApplicationPrivate *app_priv = QGuiApplicationPrivate::instance(); | - |
| 520 | QString &firstWindowTitle = app_priv->firstWindowTitle; | - |
| 521 | if (!firstWindowTitle.isEmpty()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 522 | setTitle(firstWindowTitle); | - |
| 523 | firstWindowTitle = QString(); | - |
| 524 | } never executed: end of block | 0 |
| 525 | if (!app_priv->forcedWindowIcon.isNull())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 526 | setIcon(app_priv->forcedWindowIcon); never executed: setIcon(app_priv->forcedWindowIcon); | 0 |
| 527 | | - |
| 528 | | - |
| 529 | static bool geometryApplied = false; | - |
| 530 | if (!geometryApplied) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 531 | geometryApplied = true; | - |
| 532 | QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(this); | - |
| 533 | } never executed: end of block | 0 |
| 534 | } never executed: end of block | 0 |
| 535 | | - |
| 536 | QShowEvent showEvent; | - |
| 537 | QGuiApplication::sendEvent(this, &showEvent); | - |
| 538 | } never executed: end of block | 0 |
| 539 | | - |
| 540 | if (isModal()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 541 | if (visible)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 542 | QGuiApplicationPrivate::showModalWindow(this); never executed: QGuiApplicationPrivate::showModalWindow(this); | 0 |
| 543 | else | - |
| 544 | QGuiApplicationPrivate::hideModalWindow(this); never executed: QGuiApplicationPrivate::hideModalWindow(this); | 0 |
| 545 | } | - |
| 546 | | - |
| 547 | #ifndef QT_NO_CURSOR | - |
| 548 | if (visible && (d->hasCursor || QGuiApplication::overrideCursor()))| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 549 | d->applyCursor(); never executed: d->applyCursor(); | 0 |
| 550 | #endif | - |
| 551 | | - |
| 552 | d->platformWindow->setVisible(visible); | - |
| 553 | | - |
| 554 | if (!visible) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 555 | QHideEvent hideEvent; | - |
| 556 | QGuiApplication::sendEvent(this, &hideEvent); | - |
| 557 | } never executed: end of block | 0 |
| 558 | } never executed: end of block | 0 |
| 559 | | - |
| 560 | bool QWindow::isVisible() const | - |
| 561 | { | - |
| 562 | Q_D(const QWindow); | - |
| 563 | | - |
| 564 | return d->visible; | - |
| 565 | } | - |
| 566 | | - |
| 567 | | - |
| 568 | | - |
| 569 | | - |
| 570 | | - |
| 571 | | - |
| 572 | | - |
| 573 | | - |
| 574 | | - |
| 575 | | - |
| 576 | | - |
| 577 | | - |
| 578 | | - |
| 579 | | - |
| 580 | | - |
| 581 | void QWindow::create() | - |
| 582 | { | - |
| 583 | Q_D(QWindow); | - |
| 584 | d->create(false); | - |
| 585 | } | - |
| 586 | | - |
| 587 | | - |
| 588 | | - |
| 589 | | - |
| 590 | | - |
| 591 | | - |
| 592 | | - |
| 593 | | - |
| 594 | | - |
| 595 | WId QWindow::winId() const | - |
| 596 | { | - |
| 597 | Q_D(const QWindow); | - |
| 598 | | - |
| 599 | if (type() == Qt::ForeignWindow) | - |
| 600 | return WId(property("_q_foreignWinId").value<WId>()); | - |
| 601 | | - |
| 602 | if(!d->platformWindow) | - |
| 603 | const_cast<QWindow *>(this)->create(); | - |
| 604 | | - |
| 605 | return d->platformWindow->winId(); | - |
| 606 | } | - |
| 607 | | - |
| 608 | | - |
| 609 | | - |
| 610 | | - |
| 611 | | - |
| 612 | | - |
| 613 | QWindow *QWindow::parent() const | - |
| 614 | { | - |
| 615 | Q_D(const QWindow); | - |
| 616 | return d->parentWindow; | - |
| 617 | } | - |
| 618 | | - |
| 619 | | - |
| 620 | | - |
| 621 | | - |
| 622 | | - |
| 623 | | - |
| 624 | | - |
| 625 | | - |
| 626 | | - |
| 627 | | - |
| 628 | void QWindow::setParent(QWindow *parent) | - |
| 629 | { | - |
| 630 | Q_D(QWindow); | - |
| 631 | if (d->parentWindow == parent)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 632 | return; never executed: return; | 0 |
| 633 | | - |
| 634 | QScreen *newScreen = parent ? parent->screen() : screen();| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 635 | if (d->windowRecreationRequired(newScreen)) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 636 | qWarning() << this << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')'; | - |
| 637 | return; never executed: return; | 0 |
| 638 | } | - |
| 639 | | - |
| 640 | QObject::setParent(parent); | - |
| 641 | d->parentWindow = parent; | - |
| 642 | | - |
| 643 | if (parent)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 644 | d->disconnectFromScreen(); never executed: d->disconnectFromScreen(); | 0 |
| 645 | else | - |
| 646 | d->connectToScreen(newScreen); never executed: d->connectToScreen(newScreen); | 0 |
| 647 | | - |
| 648 | | - |
| 649 | | - |
| 650 | | - |
| 651 | if (isVisible() && (!parent || parent->handle()))| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 652 | setVisible(true never executed: setVisible(true); );never executed: setVisible(true); | 0 |
| 653 | | - |
| 654 | if (d->platformWindow) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 655 | if (parent&&)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 656 | parent->d_func()->platformWindow) {create(); never executed: parent->create(); | 0 |
| 657 | | - |
| 658 | d->platformWindow->setParent(parent ? parent->d_func()->platformWindow); | - |
| } else { | |
| d->platformWindow ->setParent(: 0); | |
| 659 | }} never executed: end of block | 0 |
| 660 | | - |
| 661 | QGuiApplicationPrivate::updateBlockedStatus(this); | - |
| 662 | } never executed: end of block | 0 |
| 663 | | - |
| 664 | | - |
| 665 | | - |
| 666 | | - |
| 667 | bool QWindow::isTopLevel() const | - |
| 668 | { | - |
| 669 | Q_D(const QWindow); | - |
| 670 | return d->parentWindow == 0; | - |
| 671 | } | - |
| 672 | | - |
| 673 | | - |
| 674 | | - |
| 675 | | - |
| 676 | | - |
| 677 | | - |
| 678 | | - |
| 679 | | - |
| 680 | bool QWindow::isModal() const | - |
| 681 | { | - |
| 682 | Q_D(const QWindow); | - |
| 683 | return d->modality != Qt::NonModal; | - |
| 684 | } | - |
| 685 | | - |
| 686 | | - |
| 687 | | - |
| 688 | | - |
| 689 | | - |
| 690 | | - |
| 691 | | - |
| 692 | | - |
| 693 | | - |
| 694 | | - |
| 695 | | - |
| 696 | | - |
| 697 | Qt::WindowModality QWindow::modality() const | - |
| 698 | { | - |
| 699 | Q_D(const QWindow); | - |
| 700 | return d->modality; | - |
| 701 | } | - |
| 702 | | - |
| 703 | void QWindow::setModality(Qt::WindowModality modality) | - |
| 704 | { | - |
| 705 | Q_D(QWindow); | - |
| 706 | if (d->modality == modality) | - |
| 707 | return; | - |
| 708 | d->modality = modality; | - |
| 709 | emit modalityChanged(modality); | - |
| 710 | } | - |
| 711 | | - |
| 712 | | - |
| 713 | | - |
| 714 | | - |
| 715 | | - |
| 716 | | - |
| 717 | | - |
| 718 | | - |
| 719 | | - |
| 720 | | - |
| 721 | | - |
| 722 | | - |
| 723 | | - |
| 724 | | - |
| 725 | | - |
| 726 | | - |
| 727 | | - |
| 728 | | - |
| 729 | | - |
| 730 | | - |
| 731 | | - |
| 732 | | - |
| 733 | | - |
| 734 | | - |
| 735 | | - |
| 736 | | - |
| 737 | | - |
| 738 | | - |
| 739 | | - |
| 740 | | - |
| 741 | | - |
| 742 | | - |
| 743 | void QWindow::setFormat(const QSurfaceFormat &format) | - |
| 744 | { | - |
| 745 | Q_D(QWindow); | - |
| 746 | d->requestedFormat = format; | - |
| 747 | } | - |
| 748 | | - |
| 749 | | - |
| 750 | | - |
| 751 | | - |
| 752 | | - |
| 753 | | - |
| 754 | | - |
| 755 | | - |
| 756 | | - |
| 757 | | - |
| 758 | | - |
| 759 | QSurfaceFormat QWindow::requestedFormat() const | - |
| 760 | { | - |
| 761 | Q_D(const QWindow); | - |
| 762 | return d->requestedFormat; | - |
| 763 | } | - |
| 764 | | - |
| 765 | | - |
| 766 | | - |
| 767 | | - |
| 768 | | - |
| 769 | | - |
| 770 | | - |
| 771 | | - |
| 772 | | - |
| 773 | | - |
| 774 | | - |
| 775 | | - |
| 776 | | - |
| 777 | | - |
| 778 | | - |
| 779 | | - |
| 780 | | - |
| 781 | | - |
| 782 | QSurfaceFormat QWindow::format() const | - |
| 783 | { | - |
| 784 | Q_D(const QWindow); | - |
| 785 | if (d->platformWindow) | - |
| 786 | return d->platformWindow->format(); | - |
| 787 | return d->requestedFormat; | - |
| 788 | } | - |
| 789 | | - |
| 790 | | - |
| 791 | | - |
| 792 | | - |
| 793 | | - |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | | - |
| 798 | | - |
| 799 | | - |
| 800 | | - |
| 801 | void QWindow::setFlags(Qt::WindowFlags flags) | - |
| 802 | { | - |
| 803 | Q_D(QWindow); | - |
| 804 | if (d->platformWindow) | - |
| 805 | d->platformWindow->setWindowFlags(flags); | - |
| 806 | d->windowFlags = flags; | - |
| 807 | } | - |
| 808 | | - |
| 809 | Qt::WindowFlags QWindow::flags() const | - |
| 810 | { | - |
| 811 | Q_D(const QWindow); | - |
| 812 | return d->windowFlags; | - |
| 813 | } | - |
| 814 | | - |
| 815 | | - |
| 816 | | - |
| 817 | | - |
| 818 | | - |
| 819 | | - |
| 820 | | - |
| 821 | | - |
| 822 | | - |
| 823 | Qt::WindowType QWindow::type() const | - |
| 824 | { | - |
| 825 | Q_D(const QWindow); | - |
| 826 | return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask)); | - |
| 827 | } | - |
| 828 | | - |
| 829 | | - |
| 830 | | - |
| 831 | | - |
| 832 | | - |
| 833 | | - |
| 834 | | - |
| 835 | | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | | - |
| 840 | void QWindow::setTitle(const QString &title) | - |
| 841 | { | - |
| 842 | Q_D(QWindow); | - |
| 843 | bool changed = false; | - |
| 844 | if (d->windowTitle != title) { | - |
| 845 | d->windowTitle = title; | - |
| 846 | changed = true; | - |
| 847 | } | - |
| 848 | if (d->platformWindow && type() != Qt::Desktop) | - |
| 849 | d->platformWindow->setWindowTitle(title); | - |
| 850 | if (changed) | - |
| 851 | emit windowTitleChanged(title); | - |
| 852 | } | - |
| 853 | | - |
| 854 | QString QWindow::title() const | - |
| 855 | { | - |
| 856 | Q_D(const QWindow); | - |
| 857 | return d->windowTitle; | - |
| 858 | } | - |
| 859 | | - |
| 860 | | - |
| 861 | | - |
| 862 | | - |
| 863 | | - |
| 864 | | - |
| 865 | | - |
| 866 | | - |
| 867 | void QWindow::setFilePath(const QString &filePath) | - |
| 868 | { | - |
| 869 | Q_D(QWindow); | - |
| 870 | d->windowFilePath = filePath; | - |
| 871 | if (d->platformWindow) | - |
| 872 | d->platformWindow->setWindowFilePath(filePath); | - |
| 873 | } | - |
| 874 | | - |
| 875 | | - |
| 876 | | - |
| 877 | | - |
| 878 | | - |
| 879 | | - |
| 880 | QString QWindow::filePath() const | - |
| 881 | { | - |
| 882 | Q_D(const QWindow); | - |
| 883 | return d->windowFilePath; | - |
| 884 | } | - |
| 885 | | - |
| 886 | | - |
| 887 | | - |
| 888 | | - |
| 889 | | - |
| 890 | | - |
| 891 | | - |
| 892 | void QWindow::setIcon(const QIcon &icon) | - |
| 893 | { | - |
| 894 | Q_D(QWindow); | - |
| 895 | d->windowIcon = icon; | - |
| 896 | if (d->platformWindow) | - |
| 897 | d->platformWindow->setWindowIcon(icon); | - |
| 898 | QEvent e(QEvent::WindowIconChange); | - |
| 899 | QCoreApplication::sendEvent(this, &e); | - |
| 900 | } | - |
| 901 | | - |
| 902 | | - |
| 903 | | - |
| 904 | | - |
| 905 | | - |
| 906 | | - |
| 907 | QIcon QWindow::icon() const | - |
| 908 | { | - |
| 909 | Q_D(const QWindow); | - |
| 910 | if (d->windowIcon.isNull()) | - |
| 911 | return QGuiApplication::windowIcon(); | - |
| 912 | return d->windowIcon; | - |
| 913 | } | - |
| 914 | | - |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | | - |
| 920 | void QWindow::raise() | - |
| 921 | { | - |
| 922 | Q_D(QWindow); | - |
| 923 | if (d->platformWindow) | - |
| 924 | d->platformWindow->raise(); | - |
| 925 | } | - |
| 926 | | - |
| 927 | | - |
| 928 | | - |
| 929 | | - |
| 930 | | - |
| 931 | | - |
| 932 | void QWindow::lower() | - |
| 933 | { | - |
| 934 | Q_D(QWindow); | - |
| 935 | if (d->platformWindow) | - |
| 936 | d->platformWindow->lower(); | - |
| 937 | } | - |
| 938 | | - |
| 939 | | - |
| 940 | | - |
| 941 | | - |
| 942 | | - |
| 943 | | - |
| 944 | | - |
| 945 | | - |
| 946 | | - |
| 947 | | - |
| 948 | | - |
| 949 | | - |
| 950 | | - |
| 951 | | - |
| 952 | | - |
| 953 | void QWindow::setOpacity(qreal level) | - |
| 954 | { | - |
| 955 | Q_D(QWindow); | - |
| 956 | if (level == d->opacity) | - |
| 957 | return; | - |
| 958 | d->opacity = level; | - |
| 959 | if (d->platformWindow) { | - |
| 960 | d->platformWindow->setOpacity(level); | - |
| 961 | emit opacityChanged(level); | - |
| 962 | } | - |
| 963 | } | - |
| 964 | | - |
| 965 | qreal QWindow::opacity() const | - |
| 966 | { | - |
| 967 | Q_D(const QWindow); | - |
| 968 | return d->opacity; | - |
| 969 | } | - |
| 970 | | - |
| 971 | | - |
| 972 | | - |
| 973 | | - |
| 974 | | - |
| 975 | | - |
| 976 | | - |
| 977 | | - |
| 978 | | - |
| 979 | | - |
| 980 | | - |
| 981 | | - |
| 982 | | - |
| 983 | void QWindow::setMask(const QRegion ®ion) | - |
| 984 | { | - |
| 985 | Q_D(QWindow); | - |
| 986 | if (!d->platformWindow) | - |
| 987 | return; | - |
| 988 | d->platformWindow->setMask(QHighDpi::toNativeLocalRegion(region, this)); | - |
| 989 | d->mask = region; | - |
| 990 | } | - |
| 991 | | - |
| 992 | | - |
| 993 | | - |
| 994 | | - |
| 995 | | - |
| 996 | | - |
| 997 | | - |
| 998 | QRegion QWindow::mask() const | - |
| 999 | { | - |
| 1000 | Q_D(const QWindow); | - |
| 1001 | return d->mask; | - |
| 1002 | } | - |
| 1003 | | - |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | | - |
| 1008 | | - |
| 1009 | void QWindow::requestActivate() | - |
| 1010 | { | - |
| 1011 | Q_D(QWindow); | - |
| 1012 | if (flags() & Qt::WindowDoesNotAcceptFocus) { | - |
| 1013 | qWarning() << "requestActivate() called for " << this << " which has Qt::WindowDoesNotAcceptFocus set."; | - |
| 1014 | return; | - |
| 1015 | } | - |
| 1016 | if (d->platformWindow) | - |
| 1017 | d->platformWindow->requestActivateWindow(); | - |
| 1018 | } | - |
| 1019 | | - |
| 1020 | | - |
| 1021 | | - |
| 1022 | | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | | - |
| 1027 | | - |
| 1028 | | - |
| 1029 | | - |
| 1030 | | - |
| 1031 | bool QWindow::isExposed() const | - |
| 1032 | { | - |
| 1033 | Q_D(const QWindow); | - |
| 1034 | return d->exposed; | - |
| 1035 | } | - |
| 1036 | | - |
| 1037 | | - |
| 1038 | | - |
| 1039 | | - |
| 1040 | | - |
| 1041 | | - |
| 1042 | | - |
| 1043 | | - |
| 1044 | | - |
| 1045 | | - |
| 1046 | | - |
| 1047 | | - |
| 1048 | | - |
| 1049 | | - |
| 1050 | | - |
| 1051 | | - |
| 1052 | | - |
| 1053 | bool QWindow::isActive() const | - |
| 1054 | { | - |
| 1055 | Q_D(const QWindow); | - |
| 1056 | if (!d->platformWindow) | - |
| 1057 | return false; | - |
| 1058 | | - |
| 1059 | QWindow *focus = QGuiApplication::focusWindow(); | - |
| 1060 | | - |
| 1061 | | - |
| 1062 | if (!focus) | - |
| 1063 | return false; | - |
| 1064 | | - |
| 1065 | if (focus == this) | - |
| 1066 | return true; | - |
| 1067 | | - |
| 1068 | if (!parent() && !transientParent()) { | - |
| 1069 | return isAncestorOf(focus); | - |
| 1070 | } else { | - |
| 1071 | return (parent() && parent()->isActive()) || (transientParent() && transientParent()->isActive()); | - |
| 1072 | } | - |
| 1073 | } | - |
| 1074 | | - |
| 1075 | | - |
| 1076 | | - |
| 1077 | | - |
| 1078 | | - |
| 1079 | | - |
| 1080 | | - |
| 1081 | | - |
| 1082 | | - |
| 1083 | | - |
| 1084 | | - |
| 1085 | | - |
| 1086 | | - |
| 1087 | | - |
| 1088 | | - |
| 1089 | | - |
| 1090 | | - |
| 1091 | | - |
| 1092 | | - |
| 1093 | | - |
| 1094 | void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation) | - |
| 1095 | { | - |
| 1096 | Q_D(QWindow); | - |
| 1097 | if (d->contentOrientation == orientation) | - |
| 1098 | return; | - |
| 1099 | if (d->platformWindow) | - |
| 1100 | d->platformWindow->handleContentOrientationChange(orientation); | - |
| 1101 | d->contentOrientation = orientation; | - |
| 1102 | emit contentOrientationChanged(orientation); | - |
| 1103 | } | - |
| 1104 | | - |
| 1105 | Qt::ScreenOrientation QWindow::contentOrientation() const | - |
| 1106 | { | - |
| 1107 | Q_D(const QWindow); | - |
| 1108 | return d->contentOrientation; | - |
| 1109 | } | - |
| 1110 | | - |
| 1111 | | - |
| 1112 | | - |
| 1113 | | - |
| 1114 | | - |
| 1115 | | - |
| 1116 | | - |
| 1117 | | - |
| 1118 | | - |
| 1119 | | - |
| 1120 | | - |
| 1121 | | - |
| 1122 | | - |
| 1123 | | - |
| 1124 | qreal QWindow::devicePixelRatio() const | - |
| 1125 | { | - |
| 1126 | Q_D(const QWindow); | - |
| 1127 | | - |
| 1128 | | - |
| 1129 | | - |
| 1130 | | - |
| 1131 | if (!d->platformWindow) | - |
| 1132 | return qApp->devicePixelRatio(); | - |
| 1133 | | - |
| 1134 | return d->platformWindow->devicePixelRatio() * QHighDpiScaling::factor(this); | - |
| 1135 | } | - |
| 1136 | | - |
| 1137 | | - |
| 1138 | | - |
| 1139 | | - |
| 1140 | | - |
| 1141 | | - |
| 1142 | | - |
| 1143 | | - |
| 1144 | | - |
| 1145 | | - |
| 1146 | | - |
| 1147 | void QWindow::setWindowState(Qt::WindowState state) | - |
| 1148 | { | - |
| 1149 | if (state == Qt::WindowActive) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1150 | qWarning() << ("QWindow::setWindowState does not accept Qt::WindowActive";); | - |
| 1151 | return; never executed: return; | 0 |
| 1152 | } | - |
| 1153 | | - |
| 1154 | Q_D(QWindow); | - |
| 1155 | if (d->platformWindow)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1156 | d->platformWindow->setWindowState(state); never executed: d->platformWindow->setWindowState(state); | 0 |
| 1157 | d->windowState = state; | - |
| 1158 | emit windowStateChanged(d->windowState); | - |
| 1159 | d->updateVisibility(); | - |
| 1160 | } never executed: end of block | 0 |
| 1161 | | - |
| 1162 | | - |
| 1163 | | - |
| 1164 | | - |
| 1165 | | - |
| 1166 | | - |
| 1167 | Qt::WindowState QWindow::windowState() const | - |
| 1168 | { | - |
| 1169 | Q_D(const QWindow); | - |
| 1170 | return d->windowState; | - |
| 1171 | } | - |
| 1172 | | - |
| 1173 | | - |
| 1174 | | - |
| 1175 | | - |
| 1176 | | - |
| 1177 | | - |
| 1178 | | - |
| 1179 | | - |
| 1180 | | - |
| 1181 | | - |
| 1182 | | - |
| 1183 | | - |
| 1184 | | - |
| 1185 | | - |
| 1186 | | - |
| 1187 | | - |
| 1188 | | - |
| 1189 | | - |
| 1190 | | - |
| 1191 | | - |
| 1192 | | - |
| 1193 | void QWindow::setTransientParent(QWindow *parent) | - |
| 1194 | { | - |
| 1195 | Q_D(QWindow); | - |
| 1196 | if (parent && !parent->isTopLevel()) { | - |
| 1197 | qWarning() << parent << "must be a top level window."; | - |
| 1198 | return; | - |
| 1199 | } | - |
| 1200 | | - |
| 1201 | d->transientParent = parent; | - |
| 1202 | | - |
| 1203 | QGuiApplicationPrivate::updateBlockedStatus(this); | - |
| 1204 | } | - |
| 1205 | | - |
| 1206 | | - |
| 1207 | | - |
| 1208 | | - |
| 1209 | | - |
| 1210 | | - |
| 1211 | QWindow *QWindow::transientParent() const | - |
| 1212 | { | - |
| 1213 | Q_D(const QWindow); | - |
| 1214 | return d->transientParent.data(); | - |
| 1215 | } | - |
| 1216 | | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | | - |
| 1220 | | - |
| 1221 | | - |
| 1222 | | - |
| 1223 | | - |
| 1224 | | - |
| 1225 | | - |
| 1226 | | - |
| 1227 | | - |
| 1228 | | - |
| 1229 | | - |
| 1230 | | - |
| 1231 | bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const | - |
| 1232 | { | - |
| 1233 | if (child->parent() == this || (mode == IncludeTransients && child->transientParent() == this)) | - |
| 1234 | return true; | - |
| 1235 | | - |
| 1236 | return (child->parent() && isAncestorOf(child->parent(), mode)) | - |
| 1237 | || (mode == IncludeTransients && child->transientParent() && isAncestorOf(child->transientParent(), mode)); | - |
| 1238 | } | - |
| 1239 | | - |
| 1240 | | - |
| 1241 | | - |
| 1242 | | - |
| 1243 | | - |
| 1244 | | - |
| 1245 | QSize QWindow::minimumSize() const | - |
| 1246 | { | - |
| 1247 | Q_D(const QWindow); | - |
| 1248 | return d->minimumSize; | - |
| 1249 | } | - |
| 1250 | | - |
| 1251 | | - |
| 1252 | | - |
| 1253 | | - |
| 1254 | | - |
| 1255 | | - |
| 1256 | QSize QWindow::maximumSize() const | - |
| 1257 | { | - |
| 1258 | Q_D(const QWindow); | - |
| 1259 | return d->maximumSize; | - |
| 1260 | } | - |
| 1261 | | - |
| 1262 | | - |
| 1263 | | - |
| 1264 | | - |
| 1265 | | - |
| 1266 | | - |
| 1267 | QSize QWindow::baseSize() const | - |
| 1268 | { | - |
| 1269 | Q_D(const QWindow); | - |
| 1270 | return d->baseSize; | - |
| 1271 | } | - |
| 1272 | | - |
| 1273 | | - |
| 1274 | | - |
| 1275 | | - |
| 1276 | | - |
| 1277 | | - |
| 1278 | QSize QWindow::sizeIncrement() const | - |
| 1279 | { | - |
| 1280 | Q_D(const QWindow); | - |
| 1281 | return d->sizeIncrement; | - |
| 1282 | } | - |
| 1283 | | - |
| 1284 | | - |
| 1285 | | - |
| 1286 | | - |
| 1287 | | - |
| 1288 | | - |
| 1289 | | - |
| 1290 | | - |
| 1291 | void QWindow::setMinimumSize(const QSize &size) | - |
| 1292 | { | - |
| 1293 | Q_D(QWindow); | - |
| 1294 | QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); | - |
| 1295 | if (d->minimumSize == adjustedSize) | - |
| 1296 | return; | - |
| 1297 | QSize oldSize = d->minimumSize; | - |
| 1298 | d->minimumSize = adjustedSize; | - |
| 1299 | if (d->platformWindow && isTopLevel()) | - |
| 1300 | d->platformWindow->propagateSizeHints(); | - |
| 1301 | if (d->minimumSize.width() != oldSize.width()) | - |
| 1302 | emit minimumWidthChanged(d->minimumSize.width()); | - |
| 1303 | if (d->minimumSize.height() != oldSize.height()) | - |
| 1304 | emit minimumHeightChanged(d->minimumSize.height()); | - |
| 1305 | } | - |
| 1306 | | - |
| 1307 | | - |
| 1308 | | - |
| 1309 | | - |
| 1310 | | - |
| 1311 | void QWindow::setX(int arg) | - |
| 1312 | { | - |
| 1313 | Q_D(QWindow); | - |
| 1314 | if (x() != arg) | - |
| 1315 | setGeometry(QRect(arg, y(), width(), height())); | - |
| 1316 | else | - |
| 1317 | d->positionAutomatic = false; | - |
| 1318 | } | - |
| 1319 | | - |
| 1320 | | - |
| 1321 | | - |
| 1322 | | - |
| 1323 | | - |
| 1324 | void QWindow::setY(int arg) | - |
| 1325 | { | - |
| 1326 | Q_D(QWindow); | - |
| 1327 | if (y() != arg) | - |
| 1328 | setGeometry(QRect(x(), arg, width(), height())); | - |
| 1329 | else | - |
| 1330 | d->positionAutomatic = false; | - |
| 1331 | } | - |
| 1332 | | - |
| 1333 | | - |
| 1334 | | - |
| 1335 | | - |
| 1336 | | - |
| 1337 | void QWindow::setWidth(int arg) | - |
| 1338 | { | - |
| 1339 | if (width() != arg) | - |
| 1340 | resize(arg, height()); | - |
| 1341 | } | - |
| 1342 | | - |
| 1343 | | - |
| 1344 | | - |
| 1345 | | - |
| 1346 | | - |
| 1347 | void QWindow::setHeight(int arg) | - |
| 1348 | { | - |
| 1349 | if (height() != arg) | - |
| 1350 | resize(width(), arg); | - |
| 1351 | } | - |
| 1352 | | - |
| 1353 | | - |
| 1354 | | - |
| 1355 | | - |
| 1356 | | - |
| 1357 | void QWindow::setMinimumWidth(int w) | - |
| 1358 | { | - |
| 1359 | setMinimumSize(QSize(w, minimumHeight())); | - |
| 1360 | } | - |
| 1361 | | - |
| 1362 | | - |
| 1363 | | - |
| 1364 | | - |
| 1365 | | - |
| 1366 | void QWindow::setMinimumHeight(int h) | - |
| 1367 | { | - |
| 1368 | setMinimumSize(QSize(minimumWidth(), h)); | - |
| 1369 | } | - |
| 1370 | | - |
| 1371 | | - |
| 1372 | | - |
| 1373 | | - |
| 1374 | | - |
| 1375 | | - |
| 1376 | | - |
| 1377 | | - |
| 1378 | void QWindow::setMaximumSize(const QSize &size) | - |
| 1379 | { | - |
| 1380 | Q_D(QWindow); | - |
| 1381 | QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); | - |
| 1382 | if (d->maximumSize == adjustedSize) | - |
| 1383 | return; | - |
| 1384 | QSize oldSize = d->maximumSize; | - |
| 1385 | d->maximumSize = adjustedSize; | - |
| 1386 | if (d->platformWindow && isTopLevel()) | - |
| 1387 | d->platformWindow->propagateSizeHints(); | - |
| 1388 | if (d->maximumSize.width() != oldSize.width()) | - |
| 1389 | emit maximumWidthChanged(d->maximumSize.width()); | - |
| 1390 | if (d->maximumSize.height() != oldSize.height()) | - |
| 1391 | emit maximumHeightChanged(d->maximumSize.height()); | - |
| 1392 | } | - |
| 1393 | | - |
| 1394 | | - |
| 1395 | | - |
| 1396 | | - |
| 1397 | | - |
| 1398 | void QWindow::setMaximumWidth(int w) | - |
| 1399 | { | - |
| 1400 | setMaximumSize(QSize(w, maximumHeight())); | - |
| 1401 | } | - |
| 1402 | | - |
| 1403 | | - |
| 1404 | | - |
| 1405 | | - |
| 1406 | | - |
| 1407 | void QWindow::setMaximumHeight(int h) | - |
| 1408 | { | - |
| 1409 | setMaximumSize(QSize(maximumWidth(), h)); | - |
| 1410 | } | - |
| 1411 | | - |
| 1412 | | - |
| 1413 | | - |
| 1414 | | - |
| 1415 | | - |
| 1416 | | - |
| 1417 | | - |
| 1418 | | - |
| 1419 | | - |
| 1420 | void QWindow::setBaseSize(const QSize &size) | - |
| 1421 | { | - |
| 1422 | Q_D(QWindow); | - |
| 1423 | if (d->baseSize == size) | - |
| 1424 | return; | - |
| 1425 | d->baseSize = size; | - |
| 1426 | if (d->platformWindow && isTopLevel()) | - |
| 1427 | d->platformWindow->propagateSizeHints(); | - |
| 1428 | } | - |
| 1429 | | - |
| 1430 | | - |
| 1431 | | - |
| 1432 | | - |
| 1433 | | - |
| 1434 | | - |
| 1435 | | - |
| 1436 | | - |
| 1437 | | - |
| 1438 | | - |
| 1439 | | - |
| 1440 | | - |
| 1441 | | - |
| 1442 | | - |
| 1443 | | - |
| 1444 | void QWindow::setSizeIncrement(const QSize &size) | - |
| 1445 | { | - |
| 1446 | Q_D(QWindow); | - |
| 1447 | if (d->sizeIncrement == size) | - |
| 1448 | return; | - |
| 1449 | d->sizeIncrement = size; | - |
| 1450 | if (d->platformWindow && isTopLevel()) | - |
| 1451 | d->platformWindow->propagateSizeHints(); | - |
| 1452 | } | - |
| 1453 | | - |
| 1454 | | - |
| 1455 | | - |
| 1456 | | - |
| 1457 | | - |
| 1458 | | - |
| 1459 | | - |
| 1460 | void QWindow::setGeometry(int posx, int posy, int w, int h) | - |
| 1461 | { | - |
| 1462 | setGeometry(QRect(posx, posy, w, h)); | - |
| 1463 | } | - |
| 1464 | | - |
| 1465 | | - |
| 1466 | | - |
| 1467 | | - |
| 1468 | | - |
| 1469 | | - |
| 1470 | void QWindow::setGeometry(const QRect &rect) | - |
| 1471 | { | - |
| 1472 | Q_D(QWindow); | - |
| 1473 | d->positionAutomatic = false; | - |
| 1474 | const QRect oldRect = geometry(); | - |
| 1475 | if (rect == geometry())oldRect)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1476 | return; never executed: return; | 0 |
| 1477 | | - |
| 1478 | QRect oldRect = geometry();d->positionPolicy = QWindowPrivate::WindowFrameExclusive; | - |
| 1479 | if (d->platformWindow) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1480 | QRect nativeRect; | - |
| 1481 | QScreen *newScreen = d->screenForGeometry(rect); | - |
| 1482 | if (newScreen && isTopLevel())| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1483 | nativeRect = QHighDpi::toNativePixels(rect, newScreen); never executed: nativeRect = QHighDpi::toNativePixels(rect, newScreen); | 0 |
| 1484 | else | - |
| 1485 | nativeRect = QHighDpi::toNativePixels(rect, this); never executed: nativeRect = QHighDpi::toNativePixels(rect, this); | 0 |
| 1486 | d->platformWindow->setGeometry(nativeRect); | - |
| 1487 | } else { never executed: end of block | 0 |
| 1488 | d->geometry = rect; | - |
| 1489 | | - |
| 1490 | if (rect.x() != oldRect.x())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1491 | emit xChanged(rect.x()); never executed: xChanged(rect.x()); | 0 |
| 1492 | if (rect.y() != oldRect.y())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1493 | emit yChanged(rect.y()); never executed: yChanged(rect.y()); | 0 |
| 1494 | if (rect.width() != oldRect.width())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1495 | emit widthChanged(rect.width()); never executed: widthChanged(rect.width()); | 0 |
| 1496 | if (rect.height() != oldRect.height())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1497 | emit heightChanged(rect.height()); never executed: heightChanged(rect.height()); | 0 |
| 1498 | } never executed: end of block | 0 |
| 1499 | } | - |
| 1500 | | - |
| 1501 | | - |
| 1502 | | - |
| 1503 | | - |
| 1504 | | - |
| 1505 | | - |
| 1506 | | - |
| 1507 | QScreen *QWindowPrivate::screenForGeometry(const QRect &newGeometry) | - |
| 1508 | { | - |
| 1509 | Q_Q(QWindow); | - |
| 1510 | QScreen *currentScreen = q->screen(); | - |
| 1511 | QScreen *fallback = currentScreen; | - |
| 1512 | QPoint center = newGeometry.center(); | - |
| 1513 | if (!q->parent() && currentScreen && !currentScreen->geometry().contains(center)) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1514 | Q_FOREACHconst auto screens = currentScreen->virtualSiblings(); | - |
| 1515 | for (QScreen* screen , currentScreen->virtualSiblings()): screens) { | - |
| 1516 | if (screen->geometry().contains(center))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1517 | return screen; never executed: return screen; | 0 |
| 1518 | if (screen->geometry().intersects(newGeometry))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1519 | fallback = screen; never executed: fallback = screen; | 0 |
| 1520 | } never executed: end of block | 0 |
| 1521 | } never executed: end of block | 0 |
| 1522 | return fallback; never executed: return fallback; | 0 |
| 1523 | } | - |
| 1524 | | - |
| 1525 | | - |
| 1526 | | - |
| 1527 | | - |
| 1528 | | - |
| 1529 | | - |
| 1530 | | - |
| 1531 | QRect QWindow::geometry() const | - |
| 1532 | { | - |
| 1533 | Q_D(const QWindow); | - |
| 1534 | if (d->platformWindow) | - |
| 1535 | return QHighDpi::fromNativePixels(d->platformWindow->geometry(), this); | - |
| 1536 | return d->geometry; | - |
| 1537 | } | - |
| 1538 | | - |
| 1539 | | - |
| 1540 | | - |
| 1541 | | - |
| 1542 | | - |
| 1543 | | - |
| 1544 | QMargins QWindow::frameMargins() const | - |
| 1545 | { | - |
| 1546 | Q_D(const QWindow); | - |
| 1547 | if (d->platformWindow) | - |
| 1548 | return QHighDpi::fromNativePixels(d->platformWindow->frameMargins(), this); | - |
| 1549 | return QMargins(); | - |
| 1550 | } | - |
| 1551 | | - |
| 1552 | | - |
| 1553 | | - |
| 1554 | | - |
| 1555 | | - |
| 1556 | | - |
| 1557 | QRect QWindow::frameGeometry() const | - |
| 1558 | { | - |
| 1559 | Q_D(const QWindow); | - |
| 1560 | if (d->platformWindow) { | - |
| 1561 | QMargins m = frameMargins(); | - |
| 1562 | return QHighDpi::fromNativePixels(d->platformWindow->geometry(), this).adjusted(-m.left(), -m.top(), m.right(), m.bottom()); | - |
| 1563 | } | - |
| 1564 | return d->geometry; | - |
| 1565 | } | - |
| 1566 | | - |
| 1567 | | - |
| 1568 | | - |
| 1569 | | - |
| 1570 | | - |
| 1571 | | - |
| 1572 | | - |
| 1573 | | - |
| 1574 | QPoint QWindow::framePosition() const | - |
| 1575 | { | - |
| 1576 | Q_D(const QWindow); | - |
| 1577 | if (d->platformWindow) { | - |
| 1578 | QMargins margins = frameMargins(); | - |
| 1579 | return QHighDpi::fromNativePixels(d->platformWindow->geometry().topLeft(), this) - QPoint(margins.left(), margins.top()); | - |
| 1580 | } | - |
| 1581 | return d->geometry.topLeft(); | - |
| 1582 | } | - |
| 1583 | | - |
| 1584 | | - |
| 1585 | | - |
| 1586 | | - |
| 1587 | | - |
| 1588 | | - |
| 1589 | void QWindow::setFramePosition(const QPoint &point) | - |
| 1590 | { | - |
| 1591 | Q_D(QWindow); | - |
| 1592 | d->positionPolicy = QWindowPrivate::WindowFrameInclusive; | - |
| 1593 | d->positionAutomatic = false; | - |
| 1594 | if (d->platformWindow) { | - |
| 1595 | d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(point, size()), this)); | - |
| 1596 | } else { | - |
| 1597 | d->geometry.moveTopLeft(point); | - |
| 1598 | } | - |
| 1599 | } | - |
| 1600 | | - |
| 1601 | | - |
| 1602 | | - |
| 1603 | | - |
| 1604 | | - |
| 1605 | | - |
| 1606 | void QWindow::setPosition(const QPoint &pt) | - |
| 1607 | { | - |
| 1608 | setGeometry(QRect(pt, size())); | - |
| 1609 | } | - |
| 1610 | | - |
| 1611 | | - |
| 1612 | | - |
| 1613 | | - |
| 1614 | | - |
| 1615 | | - |
| 1616 | void QWindow::setPosition(int posx, int posy) | - |
| 1617 | { | - |
| 1618 | setPosition(QPoint(posx, posy)); | - |
| 1619 | } | - |
| 1620 | | - |
| 1621 | | - |
| 1622 | | - |
| 1623 | | - |
| 1624 | | - |
| 1625 | | - |
| 1626 | | - |
| 1627 | | - |
| 1628 | | - |
| 1629 | | - |
| 1630 | | - |
| 1631 | | - |
| 1632 | | - |
| 1633 | | - |
| 1634 | | - |
| 1635 | | - |
| 1636 | | - |
| 1637 | | - |
| 1638 | | - |
| 1639 | | - |
| 1640 | | - |
| 1641 | void QWindow::resize(int w, int h) | - |
| 1642 | { | - |
| 1643 | resize(QSize(w, h)); | - |
| 1644 | } | - |
| 1645 | | - |
| 1646 | | - |
| 1647 | | - |
| 1648 | | - |
| 1649 | | - |
| 1650 | | - |
| 1651 | void QWindow::resize(const QSize &newSize) | - |
| 1652 | { | - |
| 1653 | Q_D(QWindow); | - |
| 1654 | if (d->platformWindow) { | - |
| 1655 | d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this)); | - |
| 1656 | } else { | - |
| 1657 | const QSize oldSize = d->geometry.size(); | - |
| 1658 | d->geometry.setSize(newSize); | - |
| 1659 | if (newSize.width() != oldSize.width()) | - |
| 1660 | emit widthChanged(newSize.width()); | - |
| 1661 | if (newSize.height() != oldSize.height()) | - |
| 1662 | emit heightChanged(newSize.height()); | - |
| 1663 | } | - |
| 1664 | } | - |
| 1665 | | - |
| 1666 | | - |
| 1667 | | - |
| 1668 | | - |
| 1669 | | - |
| 1670 | | - |
| 1671 | void QWindow::destroy() | - |
| 1672 | { | - |
| 1673 | Q_D(QWindow); | - |
| 1674 | if (!d->platformWindow)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1675 | return; never executed: return; | 0 |
| 1676 | | - |
| 1677 | QObjectList childrenWindows = children(); | - |
| 1678 | for (int i = 0; i < childrenWindows.size(); i++) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1679 | QObject *object = childrenWindows.at(i); | - |
| 1680 | if (object->isWindowType()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1681 | QWindow *w = static_cast<QWindow*>(object); | - |
| 1682 | w->destroy(); | - |
| 1683 | } never executed: end of block | 0 |
| 1684 | } never executed: end of block | 0 |
| 1685 | | - |
| 1686 | if (QGuiApplicationPrivate::focus_window == this)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1687 | QGuiApplicationPrivate::focus_window = parent(); never executed: QGuiApplicationPrivate::focus_window = parent(); | 0 |
| 1688 | if (QGuiApplicationPrivate::currentMouseWindow == this)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1689 | QGuiApplicationPrivate::currentMouseWindow = parent(); never executed: QGuiApplicationPrivate::currentMouseWindow = parent(); | 0 |
| 1690 | if (QGuiApplicationPrivate::currentMousePressWindow == this)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1691 | QGuiApplicationPrivate::currentMousePressWindow = parent(); never executed: QGuiApplicationPrivate::currentMousePressWindow = parent(); | 0 |
| 1692 | | - |
| 1693 | for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size| TRUE | never evaluated | | FALSE | never evaluated |
(); ++i)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1694 | if (QGuiApplicationPrivate::tabletPressTargettabletDevicePoints.at(i).target == this)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1695 | QGuiApplicationPrivate::tabletPressTargettabletDevicePoints[i].target = parent(); never executed: QGuiApplicationPrivate::tabletDevicePoints[i].target = parent(); | 0 |
| 1696 | | - |
| 1697 | bool wasVisible = isVisible(); | - |
| 1698 | d->visibilityOnDestroy = wasVisible && d->platformWindow;| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1699 | | - |
| 1700 | setVisible(false); | - |
| 1701 | | - |
| 1702 | QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); | - |
| 1703 | QGuiApplication::sendEvent(this, &e); | - |
| 1704 | | - |
| 1705 | delete d->platformWindow; | - |
| 1706 | d->resizeEventPending = true; | - |
| 1707 | d->receivedExpose = false; | - |
| 1708 | d->exposed = false; | - |
| 1709 | d->platformWindow = 0; | - |
| 1710 | | - |
| 1711 | if (wasVisible)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1712 | d->maybeQuitOnLastWindowClosed(); never executed: d->maybeQuitOnLastWindowClosed(); | 0 |
| 1713 | } never executed: end of block | 0 |
| 1714 | | - |
| 1715 | | - |
| 1716 | | - |
| 1717 | | - |
| 1718 | | - |
| 1719 | | - |
| 1720 | QPlatformWindow *QWindow::handle() const | - |
| 1721 | { | - |
| 1722 | Q_D(const QWindow); | - |
| 1723 | return d->platformWindow; | - |
| 1724 | } | - |
| 1725 | | - |
| 1726 | | - |
| 1727 | | - |
| 1728 | | - |
| 1729 | | - |
| 1730 | | - |
| 1731 | QPlatformSurface *QWindow::surfaceHandle() const | - |
| 1732 | { | - |
| 1733 | Q_D(const QWindow); | - |
| 1734 | return d->platformWindow; | - |
| 1735 | } | - |
| 1736 | | - |
| 1737 | | - |
| 1738 | | - |
| 1739 | | - |
| 1740 | | - |
| 1741 | | - |
| 1742 | | - |
| 1743 | | - |
| 1744 | | - |
| 1745 | | - |
| 1746 | | - |
| 1747 | bool QWindow::setKeyboardGrabEnabled(bool grab) | - |
| 1748 | { | - |
| 1749 | Q_D(QWindow); | - |
| 1750 | if (d->platformWindow) | - |
| 1751 | return d->platformWindow->setKeyboardGrabEnabled(grab); | - |
| 1752 | return false; | - |
| 1753 | } | - |
| 1754 | | - |
| 1755 | | - |
| 1756 | | - |
| 1757 | | - |
| 1758 | | - |
| 1759 | | - |
| 1760 | | - |
| 1761 | | - |
| 1762 | | - |
| 1763 | | - |
| 1764 | bool QWindow::setMouseGrabEnabled(bool grab) | - |
| 1765 | { | - |
| 1766 | Q_D(QWindow); | - |
| 1767 | if (d->platformWindow) | - |
| 1768 | return d->platformWindow->setMouseGrabEnabled(grab); | - |
| 1769 | return false; | - |
| 1770 | } | - |
| 1771 | | - |
| 1772 | | - |
| 1773 | | - |
| 1774 | | - |
| 1775 | | - |
| 1776 | | - |
| 1777 | | - |
| 1778 | | - |
| 1779 | QScreen *QWindow::screen() const | - |
| 1780 | { | - |
| 1781 | Q_D(const QWindow); | - |
| 1782 | return d->parentWindow ? d->parentWindow->screen() : d->topLevelScreen.data(); | - |
| 1783 | } | - |
| 1784 | | - |
| 1785 | | - |
| 1786 | | - |
| 1787 | | - |
| 1788 | | - |
| 1789 | | - |
| 1790 | | - |
| 1791 | | - |
| 1792 | | - |
| 1793 | | - |
| 1794 | | - |
| 1795 | | - |
| 1796 | | - |
| 1797 | void QWindow::setScreen(QScreen *newScreen) | - |
| 1798 | { | - |
| 1799 | Q_D(QWindow); | - |
| 1800 | if (!newScreen) | - |
| 1801 | newScreen = QGuiApplication::primaryScreen(); | - |
| 1802 | d->setTopLevelScreen(newScreen, newScreen != 0); | - |
| 1803 | } | - |
| 1804 | | - |
| 1805 | | - |
| 1806 | | - |
| 1807 | | - |
| 1808 | | - |
| 1809 | | - |
| 1810 | | - |
| 1811 | | - |
| 1812 | | - |
| 1813 | | - |
| 1814 | | - |
| 1815 | | - |
| 1816 | | - |
| 1817 | | - |
| 1818 | QAccessibleInterface *QWindow::accessibleRoot() const | - |
| 1819 | { | - |
| 1820 | return 0; | - |
| 1821 | } | - |
| 1822 | | - |
| 1823 | | - |
| 1824 | | - |
| 1825 | | - |
| 1826 | | - |
| 1827 | | - |
| 1828 | | - |
| 1829 | | - |
| 1830 | | - |
| 1831 | | - |
| 1832 | | - |
| 1833 | | - |
| 1834 | | - |
| 1835 | | - |
| 1836 | QObject *QWindow::focusObject() const | - |
| 1837 | { | - |
| 1838 | return const_cast<QWindow *>(this); | - |
| 1839 | } | - |
| 1840 | | - |
| 1841 | | - |
| 1842 | | - |
| 1843 | | - |
| 1844 | | - |
| 1845 | | - |
| 1846 | | - |
| 1847 | | - |
| 1848 | | - |
| 1849 | void QWindow::show() | - |
| 1850 | { | - |
| 1851 | Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags); | - |
| 1852 | if (defaultState == Qt::WindowFullScreen) | - |
| 1853 | showFullScreen(); | - |
| 1854 | else if (defaultState == Qt::WindowMaximized) | - |
| 1855 | showMaximized(); | - |
| 1856 | else | - |
| 1857 | showNormal(); | - |
| 1858 | } | - |
| 1859 | | - |
| 1860 | | - |
| 1861 | | - |
| 1862 | | - |
| 1863 | | - |
| 1864 | | - |
| 1865 | | - |
| 1866 | | - |
| 1867 | void QWindow::hide() | - |
| 1868 | { | - |
| 1869 | setVisible(false); | - |
| 1870 | } | - |
| 1871 | | - |
| 1872 | | - |
| 1873 | | - |
| 1874 | | - |
| 1875 | | - |
| 1876 | | - |
| 1877 | | - |
| 1878 | | - |
| 1879 | | - |
| 1880 | void QWindow::showMinimized() | - |
| 1881 | { | - |
| 1882 | setWindowState(Qt::WindowMinimized); | - |
| 1883 | setVisible(true); | - |
| 1884 | } | - |
| 1885 | | - |
| 1886 | | - |
| 1887 | | - |
| 1888 | | - |
| 1889 | | - |
| 1890 | | - |
| 1891 | | - |
| 1892 | | - |
| 1893 | | - |
| 1894 | void QWindow::showMaximized() | - |
| 1895 | { | - |
| 1896 | setWindowState(Qt::WindowMaximized); | - |
| 1897 | setVisible(true); | - |
| 1898 | } | - |
| 1899 | | - |
| 1900 | | - |
| 1901 | | - |
| 1902 | | - |
| 1903 | | - |
| 1904 | | - |
| 1905 | | - |
| 1906 | | - |
| 1907 | | - |
| 1908 | void QWindow::showFullScreen() | - |
| 1909 | { | - |
| 1910 | setWindowState(Qt::WindowFullScreen); | - |
| 1911 | setVisible(true); | - |
| 1912 | #if !defined Q_OS_QNX // On QNX this window will be activated anyway from libscreen | - |
| 1913 | | - |
| 1914 | requestActivate(); | - |
| 1915 | #endif | - |
| 1916 | } | - |
| 1917 | | - |
| 1918 | | - |
| 1919 | | - |
| 1920 | | - |
| 1921 | | - |
| 1922 | | - |
| 1923 | | - |
| 1924 | | - |
| 1925 | | - |
| 1926 | void QWindow::showNormal() | - |
| 1927 | { | - |
| 1928 | setWindowState(Qt::WindowNoState); | - |
| 1929 | setVisible(true); | - |
| 1930 | } | - |
| 1931 | | - |
| 1932 | | - |
| 1933 | | - |
| 1934 | | - |
| 1935 | | - |
| 1936 | | - |
| 1937 | | - |
| 1938 | | - |
| 1939 | | - |
| 1940 | | - |
| 1941 | bool QWindow::close() | - |
| 1942 | { | - |
| 1943 | Q_D(QWindow); | - |
| 1944 | | - |
| 1945 | | - |
| 1946 | if (parent()) | - |
| 1947 | return false; | - |
| 1948 | | - |
| 1949 | if (!d->platformWindow) | - |
| 1950 | return true; | - |
| 1951 | | - |
| 1952 | bool accepted = false; | - |
| 1953 | QWindowSystemInterface::handleCloseEvent(this, &accepted); | - |
| 1954 | QWindowSystemInterface::flushWindowSystemEvents(); | - |
| 1955 | return accepted; | - |
| 1956 | } | - |
| 1957 | | - |
| 1958 | | - |
| 1959 | | - |
| 1960 | | - |
| 1961 | | - |
| 1962 | | - |
| 1963 | | - |
| 1964 | | - |
| 1965 | | - |
| 1966 | | - |
| 1967 | | - |
| 1968 | | - |
| 1969 | | - |
| 1970 | | - |
| 1971 | | - |
| 1972 | | - |
| 1973 | | - |
| 1974 | | - |
| 1975 | | - |
| 1976 | | - |
| 1977 | void QWindow::exposeEvent(QExposeEvent *ev) | - |
| 1978 | { | - |
| 1979 | ev->ignore(); | - |
| 1980 | } | - |
| 1981 | | - |
| 1982 | | - |
| 1983 | | - |
| 1984 | | - |
| 1985 | void QWindow::moveEvent(QMoveEvent *ev) | - |
| 1986 | { | - |
| 1987 | ev->ignore(); | - |
| 1988 | } | - |
| 1989 | | - |
| 1990 | | - |
| 1991 | | - |
| 1992 | | - |
| 1993 | | - |
| 1994 | | - |
| 1995 | | - |
| 1996 | | - |
| 1997 | void QWindow::resizeEvent(QResizeEvent *ev) | - |
| 1998 | { | - |
| 1999 | ev->ignore(); | - |
| 2000 | } | - |
| 2001 | | - |
| 2002 | | - |
| 2003 | | - |
| 2004 | | - |
| 2005 | | - |
| 2006 | | - |
| 2007 | | - |
| 2008 | | - |
| 2009 | | - |
| 2010 | void QWindow::showEvent(QShowEvent *ev) | - |
| 2011 | { | - |
| 2012 | ev->ignore(); | - |
| 2013 | } | - |
| 2014 | | - |
| 2015 | | - |
| 2016 | | - |
| 2017 | | - |
| 2018 | | - |
| 2019 | | - |
| 2020 | | - |
| 2021 | void QWindow::hideEvent(QHideEvent *ev) | - |
| 2022 | { | - |
| 2023 | ev->ignore(); | - |
| 2024 | } | - |
| 2025 | | - |
| 2026 | | - |
| 2027 | | - |
| 2028 | | - |
| 2029 | | - |
| 2030 | | - |
| 2031 | | - |
| 2032 | | - |
| 2033 | bool QWindow::event(QEvent *ev) | - |
| 2034 | { | - |
| 2035 | switch (ev->type()) { | - |
| 2036 | case QEvent::MouseMove: | - |
| 2037 | mouseMoveEvent(static_cast<QMouseEvent*>(ev)); | - |
| 2038 | break; | - |
| 2039 | | - |
| 2040 | case QEvent::MouseButtonPress: | - |
| 2041 | mousePressEvent(static_cast<QMouseEvent*>(ev)); | - |
| 2042 | break; | - |
| 2043 | | - |
| 2044 | case QEvent::MouseButtonRelease: | - |
| 2045 | mouseReleaseEvent(static_cast<QMouseEvent*>(ev)); | - |
| 2046 | break; | - |
| 2047 | | - |
| 2048 | case QEvent::MouseButtonDblClick: | - |
| 2049 | mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev)); | - |
| 2050 | break; | - |
| 2051 | | - |
| 2052 | case QEvent::TouchBegin: | - |
| 2053 | case QEvent::TouchUpdate: | - |
| 2054 | case QEvent::TouchEnd: | - |
| 2055 | case QEvent::TouchCancel: | - |
| 2056 | touchEvent(static_cast<QTouchEvent *>(ev)); | - |
| 2057 | break; | - |
| 2058 | | - |
| 2059 | case QEvent::Move: | - |
| 2060 | moveEvent(static_cast<QMoveEvent*>(ev)); | - |
| 2061 | break; | - |
| 2062 | | - |
| 2063 | case QEvent::Resize: | - |
| 2064 | resizeEvent(static_cast<QResizeEvent*>(ev)); | - |
| 2065 | break; | - |
| 2066 | | - |
| 2067 | case QEvent::KeyPress: | - |
| 2068 | keyPressEvent(static_cast<QKeyEvent *>(ev)); | - |
| 2069 | break; | - |
| 2070 | | - |
| 2071 | case QEvent::KeyRelease: | - |
| 2072 | keyReleaseEvent(static_cast<QKeyEvent *>(ev)); | - |
| 2073 | break; | - |
| 2074 | | - |
| 2075 | case QEvent::FocusIn: { | - |
| 2076 | focusInEvent(static_cast<QFocusEvent *>(ev)); | - |
| 2077 | #ifndef QT_NO_ACCESSIBILITY | - |
| 2078 | QAccessible::State state; | - |
| 2079 | state.active = true; | - |
| 2080 | QAccessibleStateChangeEvent event(this, state); | - |
| 2081 | QAccessible::updateAccessibility(&event); | - |
| 2082 | #endif | - |
| 2083 | break; } | - |
| 2084 | | - |
| 2085 | case QEvent::FocusOut: { | - |
| 2086 | focusOutEvent(static_cast<QFocusEvent *>(ev)); | - |
| 2087 | #ifndef QT_NO_ACCESSIBILITY | - |
| 2088 | QAccessible::State state; | - |
| 2089 | state.active = true; | - |
| 2090 | QAccessibleStateChangeEvent event(this, state); | - |
| 2091 | QAccessible::updateAccessibility(&event); | - |
| 2092 | #endif | - |
| 2093 | break; } | - |
| 2094 | | - |
| 2095 | #ifndef QT_NO_WHEELEVENT | - |
| 2096 | case QEvent::Wheel: | - |
| 2097 | wheelEvent(static_cast<QWheelEvent*>(ev)); | - |
| 2098 | break; | - |
| 2099 | #endif | - |
| 2100 | | - |
| 2101 | case QEvent::Close: | - |
| 2102 | if (ev->isAccepted()) | - |
| 2103 | destroy(); | - |
| 2104 | break; | - |
| 2105 | | - |
| 2106 | case QEvent::Expose: | - |
| 2107 | exposeEvent(static_cast<QExposeEvent *>(ev)); | - |
| 2108 | break; | - |
| 2109 | | - |
| 2110 | case QEvent::Show: | - |
| 2111 | showEvent(static_cast<QShowEvent *>(ev)); | - |
| 2112 | break; | - |
| 2113 | | - |
| 2114 | case QEvent::Hide: | - |
| 2115 | hideEvent(static_cast<QHideEvent *>(ev)); | - |
| 2116 | break; | - |
| 2117 | | - |
| 2118 | case QEvent::ApplicationWindowIconChange: | - |
| 2119 | setIcon(icon()); | - |
| 2120 | break; | - |
| 2121 | | - |
| 2122 | case QEvent::WindowStateChange: { | - |
| 2123 | Q_D(QWindow); | - |
| 2124 | emit windowStateChanged(d->windowState); | - |
| 2125 | d->updateVisibility(); | - |
| 2126 | break; | - |
| 2127 | } | - |
| 2128 | | - |
| 2129 | #ifndef QT_NO_TABLETEVENT | - |
| 2130 | case QEvent::TabletPress: | - |
| 2131 | case QEvent::TabletMove: | - |
| 2132 | case QEvent::TabletRelease: | - |
| 2133 | tabletEvent(static_cast<QTabletEvent *>(ev)); | - |
| 2134 | break; | - |
| 2135 | #endif | - |
| 2136 | | - |
| 2137 | case QEvent::Timer: { | - |
| 2138 | Q_D(QWindow); | - |
| 2139 | if (static_cast<QTimerEvent *>(ev)->timerId() == d->updateTimer) { | - |
| 2140 | killTimer(d->updateTimer); | - |
| 2141 | d->updateTimer = 0; | - |
| 2142 | d->deliverUpdateRequest(); | - |
| 2143 | } else { | - |
| 2144 | QObject::event(ev); | - |
| 2145 | } | - |
| 2146 | break; | - |
| 2147 | } | - |
| 2148 | | - |
| 2149 | case QEvent::PlatformSurface: { | - |
| 2150 | if ((static_cast<QPlatformSurfaceEvent *>(ev))->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) { | - |
| 2151 | #ifndef QT_NO_OPENGL | - |
| 2152 | QOpenGLContext *context = QOpenGLContext::currentContext(); | - |
| 2153 | if (context && context->surface() == static_cast<QSurface *>(this)) | - |
| 2154 | context->doneCurrent(); | - |
| 2155 | #endif | - |
| 2156 | } | - |
| 2157 | break; | - |
| 2158 | } | - |
| 2159 | | - |
| 2160 | default: | - |
| 2161 | return QObject::event(ev); | - |
| 2162 | } | - |
| 2163 | return true; | - |
| 2164 | } | - |
| 2165 | | - |
| 2166 | void QWindowPrivate::deliverUpdateRequest() | - |
| 2167 | { | - |
| 2168 | Q_Q(QWindow); | - |
| 2169 | updateRequestPending = false; | - |
| 2170 | QEvent request(QEvent::UpdateRequest); | - |
| 2171 | QCoreApplication::sendEvent(q, &request); | - |
| 2172 | } | - |
| 2173 | | - |
| 2174 | | - |
| 2175 | | - |
| 2176 | | - |
| 2177 | | - |
| 2178 | | - |
| 2179 | | - |
| 2180 | | - |
| 2181 | | - |
| 2182 | | - |
| 2183 | | - |
| 2184 | | - |
| 2185 | | - |
| 2186 | | - |
| 2187 | | - |
| 2188 | | - |
| 2189 | | - |
| 2190 | | - |
| 2191 | | - |
| 2192 | | - |
| 2193 | | - |
| 2194 | | - |
| 2195 | | - |
| 2196 | void QWindow::requestUpdate() | - |
| 2197 | { | - |
| 2198 | Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread(), | - |
| 2199 | "QWindow", "Updates can only be scheduled from the GUI (main) thread"); | - |
| 2200 | | - |
| 2201 | Q_D(QWindow); | - |
| 2202 | if (d->updateRequestPending || !d->platformWindow) | - |
| 2203 | return; | - |
| 2204 | d->updateRequestPending = true; | - |
| 2205 | d->platformWindow->requestUpdate(); | - |
| 2206 | } | - |
| 2207 | | - |
| 2208 | | - |
| 2209 | | - |
| 2210 | | - |
| 2211 | | - |
| 2212 | | - |
| 2213 | void QWindow::keyPressEvent(QKeyEvent *ev) | - |
| 2214 | { | - |
| 2215 | ev->ignore(); | - |
| 2216 | } | - |
| 2217 | | - |
| 2218 | | - |
| 2219 | | - |
| 2220 | | - |
| 2221 | | - |
| 2222 | | - |
| 2223 | void QWindow::keyReleaseEvent(QKeyEvent *ev) | - |
| 2224 | { | - |
| 2225 | ev->ignore(); | - |
| 2226 | } | - |
| 2227 | | - |
| 2228 | | - |
| 2229 | | - |
| 2230 | | - |
| 2231 | | - |
| 2232 | | - |
| 2233 | | - |
| 2234 | | - |
| 2235 | void QWindow::focusInEvent(QFocusEvent *ev) | - |
| 2236 | { | - |
| 2237 | ev->ignore(); | - |
| 2238 | } | - |
| 2239 | | - |
| 2240 | | - |
| 2241 | | - |
| 2242 | | - |
| 2243 | | - |
| 2244 | | - |
| 2245 | | - |
| 2246 | | - |
| 2247 | void QWindow::focusOutEvent(QFocusEvent *ev) | - |
| 2248 | { | - |
| 2249 | ev->ignore(); | - |
| 2250 | } | - |
| 2251 | | - |
| 2252 | | - |
| 2253 | | - |
| 2254 | | - |
| 2255 | | - |
| 2256 | | - |
| 2257 | void QWindow::mousePressEvent(QMouseEvent *ev) | - |
| 2258 | { | - |
| 2259 | ev->ignore(); | - |
| 2260 | } | - |
| 2261 | | - |
| 2262 | | - |
| 2263 | | - |
| 2264 | | - |
| 2265 | | - |
| 2266 | | - |
| 2267 | void QWindow::mouseReleaseEvent(QMouseEvent *ev) | - |
| 2268 | { | - |
| 2269 | ev->ignore(); | - |
| 2270 | } | - |
| 2271 | | - |
| 2272 | | - |
| 2273 | | - |
| 2274 | | - |
| 2275 | | - |
| 2276 | | - |
| 2277 | void QWindow::mouseDoubleClickEvent(QMouseEvent *ev) | - |
| 2278 | { | - |
| 2279 | ev->ignore(); | - |
| 2280 | } | - |
| 2281 | | - |
| 2282 | | - |
| 2283 | | - |
| 2284 | | - |
| 2285 | void QWindow::mouseMoveEvent(QMouseEvent *ev) | - |
| 2286 | { | - |
| 2287 | ev->ignore(); | - |
| 2288 | } | - |
| 2289 | | - |
| 2290 | #ifndef QT_NO_WHEELEVENT | - |
| 2291 | | - |
| 2292 | | - |
| 2293 | | - |
| 2294 | void QWindow::wheelEvent(QWheelEvent *ev) | - |
| 2295 | { | - |
| 2296 | ev->ignore(); | - |
| 2297 | } | - |
| 2298 | #endif //QT_NO_WHEELEVENT | - |
| 2299 | | - |
| 2300 | | - |
| 2301 | | - |
| 2302 | | - |
| 2303 | void QWindow::touchEvent(QTouchEvent *ev) | - |
| 2304 | { | - |
| 2305 | ev->ignore(); | - |
| 2306 | } | - |
| 2307 | | - |
| 2308 | #ifndef QT_NO_TABLETEVENT | - |
| 2309 | | - |
| 2310 | | - |
| 2311 | | - |
| 2312 | | - |
| 2313 | | - |
| 2314 | | - |
| 2315 | void QWindow::tabletEvent(QTabletEvent *ev) | - |
| 2316 | { | - |
| 2317 | ev->ignore(); | - |
| 2318 | } | - |
| 2319 | #endif | - |
| 2320 | | - |
| 2321 | | - |
| 2322 | | - |
| 2323 | | - |
| 2324 | | - |
| 2325 | | - |
| 2326 | | - |
| 2327 | | - |
| 2328 | | - |
| 2329 | bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) | - |
| 2330 | { | - |
| 2331 | Q_UNUSED(eventType); | - |
| 2332 | Q_UNUSED(message); | - |
| 2333 | Q_UNUSED(result); | - |
| 2334 | return false; | - |
| 2335 | } | - |
| 2336 | | - |
| 2337 | | - |
| 2338 | | - |
| 2339 | | - |
| 2340 | | - |
| 2341 | | - |
| 2342 | | - |
| 2343 | | - |
| 2344 | | - |
| 2345 | | - |
| 2346 | QPoint QWindow::mapToGlobal(const QPoint &pos) const | - |
| 2347 | { | - |
| 2348 | Q_D(const QWindow); | - |
| 2349 | | - |
| 2350 | if (d->platformWindow | - |
| 2351 | && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) { | - |
| 2352 | return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapToGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this); | - |
| 2353 | } | - |
| 2354 | return pos + d->globalPosition(); | - |
| 2355 | } | - |
| 2356 | | - |
| 2357 | | - |
| 2358 | | - |
| 2359 | | - |
| 2360 | | - |
| 2361 | | - |
| 2362 | | - |
| 2363 | | - |
| 2364 | | - |
| 2365 | | - |
| 2366 | QPoint QWindow::mapFromGlobal(const QPoint &pos) const | - |
| 2367 | { | - |
| 2368 | Q_D(const QWindow); | - |
| 2369 | | - |
| 2370 | if (d->platformWindow | - |
| 2371 | && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) { | - |
| 2372 | return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this); | - |
| 2373 | } | - |
| 2374 | return pos - d->globalPosition(); | - |
| 2375 | } | - |
| 2376 | | - |
| 2377 | | - |
| 2378 | Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window) | - |
| 2379 | { | - |
| 2380 | return window->d_func(); | - |
| 2381 | } | - |
| 2382 | | - |
| 2383 | void QWindowPrivate::maybeQuitOnLastWindowClosed() | - |
| 2384 | { | - |
| 2385 | if (!QCoreApplication::instance()) | - |
| 2386 | return; | - |
| 2387 | | - |
| 2388 | Q_Q(QWindow); | - |
| 2389 | | - |
| 2390 | bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent(); | - |
| 2391 | QWindowList list = QGuiApplication::topLevelWindows(); | - |
| 2392 | bool lastWindowClosed = true; | - |
| 2393 | for (int i = 0; i < list.size(); ++i) { | - |
| 2394 | QWindow *w = list.at(i); | - |
| 2395 | if (!w->isVisible() || w->transientParent() || w->type() == Qt::ToolTip) | - |
| 2396 | continue; | - |
| 2397 | lastWindowClosed = false; | - |
| 2398 | break; | - |
| 2399 | } | - |
| 2400 | if (lastWindowClosed) { | - |
| 2401 | QGuiApplicationPrivate::emitLastWindowClosed(); | - |
| 2402 | if (quitOnClose) { | - |
| 2403 | QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance())); | - |
| 2404 | applicationPrivate->maybeQuit(); | - |
| 2405 | } | - |
| 2406 | } | - |
| 2407 | } | - |
| 2408 | | - |
| 2409 | QWindow *QWindowPrivate::topLevelWindow() const | - |
| 2410 | { | - |
| 2411 | Q_Q(const QWindow); | - |
| 2412 | | - |
| 2413 | QWindow *window = const_cast<QWindow *>(q); | - |
| 2414 | | - |
| 2415 | while (window) { | - |
| 2416 | QWindow *parent = window->parent(); | - |
| 2417 | if (!parent) | - |
| 2418 | parent = window->transientParent(); | - |
| 2419 | | - |
| 2420 | if (!parent) | - |
| 2421 | break; | - |
| 2422 | | - |
| 2423 | window = parent; | - |
| 2424 | } | - |
| 2425 | | - |
| 2426 | return window; | - |
| 2427 | } | - |
| 2428 | | - |
| 2429 | | - |
| 2430 | | - |
| 2431 | | - |
| 2432 | | - |
| 2433 | | - |
| 2434 | | - |
| 2435 | | - |
| 2436 | | - |
| 2437 | | - |
| 2438 | | - |
| 2439 | | - |
| 2440 | | - |
| 2441 | | - |
| 2442 | | - |
| 2443 | | - |
| 2444 | | - |
| 2445 | | - |
| 2446 | | - |
| 2447 | | - |
| 2448 | | - |
| 2449 | | - |
| 2450 | | - |
| 2451 | QWindow *QWindow::fromWinId(WId id) | - |
| 2452 | { | - |
| 2453 | if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ForeignWindows)) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2454 | qWarning() << ("QWindow::fromWinId(): platform plugin does not support foreign windows.";); | - |
| 2455 | return 0; never executed: return 0; | 0 |
| 2456 | } | - |
| 2457 | | - |
| 2458 | QWindow *window = new QWindow; | - |
| 2459 | window->setFlags(Qt::ForeignWindow); | - |
| 2460 | window->setProperty("_q_foreignWinId", QVariant::fromValue(id)); | - |
| 2461 | window->create(); | - |
| 2462 | if (!window->handle()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2463 | delete window; | - |
| 2464 | return nullptr; never executed: return nullptr; | 0 |
| 2465 | } | - |
| 2466 | return window; never executed: return window; | 0 |
| 2467 | } | - |
| 2468 | | - |
| 2469 | | - |
| 2470 | | - |
| 2471 | | - |
| 2472 | | - |
| 2473 | | - |
| 2474 | | - |
| 2475 | | - |
| 2476 | | - |
| 2477 | | - |
| 2478 | | - |
| 2479 | | - |
| 2480 | void QWindow::alert(int msec) | - |
| 2481 | { | - |
| 2482 | Q_D(QWindow); | - |
| 2483 | if (!d->platformWindow || d->platformWindow->isAlertState() || isActive()) | - |
| 2484 | return; | - |
| 2485 | d->platformWindow->setAlertState(true); | - |
| 2486 | if (d->platformWindow->isAlertState() && msec) | - |
| 2487 | QTimer::singleShot(msec, this, SLOT(_q_clearAlert())); | - |
| 2488 | } | - |
| 2489 | | - |
| 2490 | void QWindowPrivate::_q_clearAlert() | - |
| 2491 | { | - |
| 2492 | if (platformWindow && platformWindow->isAlertState()) | - |
| 2493 | platformWindow->setAlertState(false); | - |
| 2494 | } | - |
| 2495 | | - |
| 2496 | #ifndef QT_NO_CURSOR | - |
| 2497 | | - |
| 2498 | | - |
| 2499 | | - |
| 2500 | | - |
| 2501 | | - |
| 2502 | | - |
| 2503 | | - |
| 2504 | | - |
| 2505 | | - |
| 2506 | | - |
| 2507 | | - |
| 2508 | | - |
| 2509 | | - |
| 2510 | | - |
| 2511 | | - |
| 2512 | | - |
| 2513 | | - |
| 2514 | | - |
| 2515 | | - |
| 2516 | | - |
| 2517 | void QWindow::setCursor(const QCursor &cursor) | - |
| 2518 | { | - |
| 2519 | Q_D(QWindow); | - |
| 2520 | d->setCursor(&cursor); | - |
| 2521 | } | - |
| 2522 | | - |
| 2523 | | - |
| 2524 | | - |
| 2525 | | - |
| 2526 | void QWindow::unsetCursor() | - |
| 2527 | { | - |
| 2528 | Q_D(QWindow); | - |
| 2529 | d->setCursor(0); | - |
| 2530 | } | - |
| 2531 | | - |
| 2532 | | - |
| 2533 | | - |
| 2534 | | - |
| 2535 | | - |
| 2536 | | - |
| 2537 | QCursor QWindow::cursor() const | - |
| 2538 | { | - |
| 2539 | Q_D(const QWindow); | - |
| 2540 | return d->cursor; | - |
| 2541 | } | - |
| 2542 | | - |
| 2543 | void QWindowPrivate::setCursor(const QCursor *newCursor) | - |
| 2544 | { | - |
| 2545 | | - |
| 2546 | Q_Q(QWindow); | - |
| 2547 | if (newCursor) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2548 | const Qt::CursorShape newShape = newCursor->shape(); | - |
| 2549 | if (newShape <= Qt::LastCursor && hasCursor && newShape == cursor.shape())| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2550 | return; never executed: return; | 0 |
| 2551 | cursor = *newCursor; | - |
| 2552 | hasCursor = true; | - |
| 2553 | } else { never executed: end of block | 0 |
| 2554 | if (!hasCursor)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2555 | return; never executed: return; | 0 |
| 2556 | cursor = QCursor(Qt::ArrowCursor); | - |
| 2557 | hasCursor = false; | - |
| 2558 | } never executed: end of block | 0 |
| 2559 | | - |
| 2560 | QScreen* screen = q->screen(); | - |
| 2561 | if (applyCursorscreen && screen->handle()->cursor()) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2562 | applyCursor(); | - |
| 2563 | QEvent event(QEvent::CursorChange); | - |
| 2564 | QGuiApplication::sendEvent(q, &event); | - |
| 2565 | } never executed: end of block | 0 |
| 2566 | } never executed: end of block | 0 |
| 2567 | | - |
| boolvoid QWindowPrivate::applyCursor() | |
| 2569 | { | - |
| 2570 | Q_Q(QWindow); | - |
| 2571 | if (QScreen *screen = q->screen())platformWindow) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2572 | if (QPlatformCursor *platformCursor = screenq->screen()->handle()->cursor()) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2573 | if (!platformWindow) | - |
| return true;QCursor *c = QGuiApplication::overrideCursor(); | |
| 2574 | if (!c && hasCursor)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2575 | c = &cursor; never executed: c = &cursor; | 0 |
| 2576 | platformCursor->changeCursor(c, q); | - |
| 2577 | return true;} never executed: end of block | 0 |
| 2578 | }return false; never executed: end of block | 0 |
| 2579 | } never executed: end of block | 0 |
| 2580 | #endif // QT_NO_CURSOR | - |
| 2581 | | - |
| 2582 | #ifndef QT_NO_DEBUG_STREAM | - |
| 2583 | QDebug operator<<(QDebug debug, const QWindow *window) | - |
| 2584 | { | - |
| 2585 | QDebugStateSaver saver(debug); | - |
| 2586 | debug.nospace(); | - |
| 2587 | if (window) { | - |
| 2588 | debug << window->metaObject()->className() << '(' << (const void *)window; | - |
| 2589 | if (!window->objectName().isEmpty()) | - |
| 2590 | debug << ", name=" << window->objectName(); | - |
| 2591 | if (debug.verbosity() > 2) { | - |
| 2592 | const QRect geometry = window->geometry(); | - |
| 2593 | if (window->isVisible()) | - |
| 2594 | debug << ", visible"; | - |
| 2595 | if (window->isExposed()) | - |
| 2596 | debug << ", exposed"; | - |
| 2597 | debug << ", state=" << window->windowState() | - |
| 2598 | << ", type=" << window->type() << ", flags=" << window->flags() | - |
| 2599 | << ", surface type=" << window->surfaceType(); | - |
| 2600 | if (window->isTopLevel()) | - |
| 2601 | debug << ", toplevel"; | - |
| 2602 | debug << ", " << geometry.width() << 'x' << geometry.height() | - |
| 2603 | << forcesign << geometry.x() << geometry.y() << noforcesign; | - |
| 2604 | const QMargins margins = window->frameMargins(); | - |
| 2605 | if (!margins.isNull()) | - |
| 2606 | debug << ", margins=" << margins; | - |
| 2607 | debug << ", devicePixelRatio=" << window->devicePixelRatio(); | - |
| 2608 | if (const QPlatformWindow *platformWindow = window->handle()) | - |
| 2609 | debug << ", winId=0x" << hex << platformWindow->winId() << dec; | - |
| 2610 | if (const QScreen *screen = window->screen()) | - |
| 2611 | debug << ", on " << screen->name(); | - |
| 2612 | } | - |
| 2613 | debug << ')'; | - |
| 2614 | } else { | - |
| 2615 | debug << "QWindow(0x0)"; | - |
| 2616 | } | - |
| 2617 | return debug; | - |
| 2618 | } | - |
| 2619 | #endif // !QT_NO_DEBUG_STREAM | - |
| 2620 | | - |
| 2621 | QT_END_NAMESPACE | - |
| 2622 | | - |
| 2623 | #include "moc_qwindow.cpp" | - |
| | |