From b936bccd9d0d7f50f37c078b7aad9e75ee9fc981 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 16 Jun 2018 09:46:48 +0200 Subject: Add Plasma option to cmake that turns on KF5 blur window effect --- src/CMakeLists.txt | 10 +++++++++- src/mainwindow/mainwindow.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c6876d..cf66a53 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,7 +58,15 @@ target_link_libraries(poi about addressbar configuration - bookmarks downloads web) + bookmarks downloads web +) + +if(Plasma) + target_link_libraries(poi KF5::WindowSystem) + target_compile_definitions(poi + PRIVATE PLASMA_BLUR # give the main window a translucent background and blur + ) +endif(Plasma) target_compile_definitions(poi PRIVATE QTBUG_65223_WORKAROUND diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 6558c65..b2c79cc 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -30,6 +30,10 @@ #include #include "browser.h" +#ifdef PLASMA_BLUR +#include +#endif + MainWindow::MainWindow(std::shared_ptr &config, QWidget *parent) : QMainWindow(parent) , mdiArea(new QMdiArea(this)) @@ -37,6 +41,11 @@ MainWindow::MainWindow(std::shared_ptr &config, QWidget *parent) Q_ASSERT(config); m_config = config; +#ifdef PLASMA_BLUR + setAttribute(Qt::WA_TranslucentBackground, true); + KWindowEffects::enableBlurBehind(this->winId(), true); +#endif + // create UI setWindowTitle(QString::fromStdString(config->value("mainwindow.title").value())); resize(config->value("mainwindow.width").value(), config->value("mainwindow.height").value()); @@ -55,6 +64,7 @@ MainWindow::MainWindow(std::shared_ptr &config, QWidget *parent) addressBar = new AddressBar(config->section("addressbar"), this); navigationToolBar->addWidget(addressBar); + mdiArea->setBackground(Qt::NoBrush); setCentralWidget(mdiArea); mdiArea->setFocus(); -- cgit v1.2.1