From 092723b892938806d5f88d828bc59bfa4843e5d1 Mon Sep 17 00:00:00 2001 From: lily Date: Wed, 16 Apr 2025 23:16:55 -0400 Subject: [PATCH] add: dock background --- src/dock.cpp | 20 +++++++++++++++----- src/dock.h | 8 +++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/dock.cpp b/src/dock.cpp index 0605350..44aa15a 100644 --- a/src/dock.cpp +++ b/src/dock.cpp @@ -9,10 +9,19 @@ void Dock::createDockWindows(QApplication* app) { qDebug() << "Creating dock window for screen:" << screen->name(); QWidget* container = new QWidget(nullptr, Qt::FramelessWindowHint | Qt::Tool); - container->setAttribute(Qt::WA_TranslucentBackground); - container->setAttribute(Qt::WA_NoSystemBackground); + // container->setAttribute(Qt::WA_TranslucentBackground); + // container->setAttribute(Qt::WA_NoSystemBackground); container->setWindowFlag(Qt::WindowStaysOnTopHint); + container->setObjectName("rootWindow"); + container->setAutoFillBackground(true); container->resize(screen->geometry().size().width() / 2, 60); + container->setStyleSheet(R"( + #rootWindow { + background-color: rgba(0,0,0,0.6); + } + )"); + + this->m_dockWindows.push_front(container); QLabel* label = new QLabel(QString("✨ Dock %1 ✨").arg(i)); label->setAlignment(Qt::AlignCenter); @@ -20,13 +29,14 @@ void Dock::createDockWindows(QApplication* app) { QLabel { color: white; font-size: 18px; - background-color: rgba(0, 0, 0, 180); - border-radius: 10px; } )"); - QVBoxLayout* layout = new QVBoxLayout(container); + QPushButton* button = new QPushButton(QString("Start")); + + QHBoxLayout* layout = new QHBoxLayout(container); layout->addWidget(label); + layout->addWidget(button); layout->setContentsMargins(0, 0, 0, 0); QRect screenRect = screen->geometry(); diff --git a/src/dock.h b/src/dock.h index 3a48883..9003188 100644 --- a/src/dock.h +++ b/src/dock.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -20,11 +21,8 @@ class Dock { private: - /// @brief Stores all dock windows - QList m_dockWindows; - - /// @brief QWidget container for dock windows - QList m_dockWindowContainters; + /// @brief QWidget dock windows + QList m_dockWindows; /// @brief Stores all configuration windows QList m_configWindows;