feat: update shadow with focus change
Change-Id: I20abbacda4148e3688da09c49692cf24c33c632e
Sian Cao
6 years ago
519 | 519 | |
520 | 520 | if (composited) { |
521 | 521 | setAttribute(Qt::WA_TranslucentBackground, true); |
522 | setAttribute(Qt::WA_NoSystemBackground, false); | |
522 | //setAttribute(Qt::WA_NoSystemBackground, false); | |
523 | 523 | } |
524 | 524 | |
525 | 525 | DThemeManager::instance()->registerWidget(this); |
529 | 529 | if (DApplication::isDXcbPlatform()) { |
530 | 530 | _handle = new DPlatformWindowHandle(this, this); |
531 | 531 | setAttribute(Qt::WA_TranslucentBackground, true); |
532 | if (composited) | |
533 | _handle->setTranslucentBackground(true); | |
532 | //if (composited) | |
533 | //_handle->setTranslucentBackground(true); | |
534 | 534 | _handle->setEnableSystemResize(false); |
535 | 535 | _handle->setEnableSystemMove(false); |
536 | 536 | _handle->setWindowRadius(4); |
537 | connect(qApp, &QGuiApplication::focusWindowChanged, this, &MainWindow::updateShadow); | |
538 | updateShadow(); | |
537 | 539 | } |
538 | 540 | #else |
539 | 541 | winId(); |
785 | 787 | qDebug() << "event listener"; |
786 | 788 | #endif |
787 | 789 | } |
790 | ||
791 | #ifdef USE_DXCB | |
792 | void MainWindow::updateShadow() | |
793 | { | |
794 | if (isActiveWindow()) { | |
795 | _handle->setShadowRadius(60); | |
796 | _handle->setShadowColor(SHADOW_COLOR_ACTIVE); | |
797 | } else { | |
798 | _handle->setShadowRadius(60); | |
799 | _handle->setShadowColor(SHADOW_COLOR_NORMAL); | |
800 | } | |
801 | } | |
802 | #endif | |
788 | 803 | |
789 | 804 | bool MainWindow::event(QEvent *ev) |
790 | 805 | { |