|
45 | 45 | #include <QToolBar> |
46 | 46 | #include <QXmlStreamWriter> |
47 | 47 |
|
| 48 | +#include <QGuiApplication> |
| 49 | +#include <QScreen> |
| 50 | +#include <QWindow> |
| 51 | + |
48 | 52 | #include "DockContainerWidget.h" |
49 | 53 | #include "DockAreaWidget.h" |
50 | 54 | #include "DockManager.h" |
@@ -296,6 +300,7 @@ void CDockWidget::setFeatures(DockWidgetFeatures features) |
296 | 300 | return; |
297 | 301 | } |
298 | 302 | d->Features = features; |
| 303 | + emit featuresChanged(d->Features); |
299 | 304 | d->TabWidget->onDockWidgetFeaturesChanged(); |
300 | 305 | } |
301 | 306 |
|
@@ -517,23 +522,50 @@ void CDockWidget::flagAsUnassigned() |
517 | 522 | //============================================================================ |
518 | 523 | bool CDockWidget::event(QEvent *e) |
519 | 524 | { |
520 | | - if (e->type() == QEvent::WindowTitleChange) |
| 525 | + switch (e->type()) |
521 | 526 | { |
522 | | - const auto title = windowTitle(); |
523 | | - if (d->TabWidget) |
524 | | - { |
525 | | - d->TabWidget->setText(title); |
526 | | - } |
527 | | - if (d->ToggleViewAction) |
| 527 | + case QEvent::Hide: |
| 528 | + emit visibilityChanged(false); |
| 529 | + break; |
| 530 | + |
| 531 | + case QEvent::Show: |
528 | 532 | { |
529 | | - d->ToggleViewAction->setText(title); |
530 | | - } |
531 | | - if (d->DockArea) |
| 533 | + QPoint parentTopLeft(0, 0); |
| 534 | + if (isWindow()) |
| 535 | + { |
| 536 | + if (const QWindow *window = windowHandle()) |
| 537 | + parentTopLeft = window->screen()->availableVirtualGeometry().topLeft(); |
| 538 | + else |
| 539 | + parentTopLeft = QGuiApplication::primaryScreen()->availableVirtualGeometry().topLeft(); |
| 540 | + std::cout << "QEvent::Show isWindow()" << std::endl; |
| 541 | + } |
| 542 | + emit visibilityChanged(geometry().right() >= parentTopLeft.x() && geometry().bottom() >= parentTopLeft.y()); |
| 543 | + } |
| 544 | + break; |
| 545 | + |
| 546 | + case QEvent::WindowTitleChange : |
532 | 547 | { |
533 | | - d->DockArea->markTitleBarMenuOutdated();//update tabs menu |
| 548 | + const auto title = windowTitle(); |
| 549 | + if (d->TabWidget) |
| 550 | + { |
| 551 | + d->TabWidget->setText(title); |
| 552 | + } |
| 553 | + if (d->ToggleViewAction) |
| 554 | + { |
| 555 | + d->ToggleViewAction->setText(title); |
| 556 | + } |
| 557 | + if (d->DockArea) |
| 558 | + { |
| 559 | + d->DockArea->markTitleBarMenuOutdated();//update tabs menu |
| 560 | + } |
| 561 | + emit titleChanged(title); |
534 | 562 | } |
535 | | - emit titleChanged(title); |
| 563 | + break; |
| 564 | + |
| 565 | + default: |
| 566 | + break; |
536 | 567 | } |
| 568 | + |
537 | 569 | return Super::event(e); |
538 | 570 | } |
539 | 571 |
|
|
0 commit comments