From 92b9379d6985ea170200cc7d133e13abbce1f978 Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Fri, 15 Jan 2021 17:51:23 -0600 Subject: [PATCH] Made changes after review of merge --- CMakeLists.txt | 4 +- {src/core => external}/QHotkey/CMakeLists.txt | 0 {src/core => external}/QHotkey/LICENSE | 0 {src/core => external}/QHotkey/QHotkey | 0 {src/core => external}/QHotkey/README.md | 0 {src/core => external}/QHotkey/qhotkey.cpp | 0 {src/core => external}/QHotkey/qhotkey.h | 0 .../core => external}/QHotkey/qhotkey_mac.cpp | 0 {src/core => external}/QHotkey/qhotkey_p.h | 0 .../core => external}/QHotkey/qhotkey_win.cpp | 0 .../core => external}/QHotkey/qhotkey_x11.cpp | 0 src/CMakeLists.txt | 31 ++-- src/core/controller.cpp | 152 ++++++++---------- src/widgets/panel/utilitypanel.cpp | 44 ++--- 14 files changed, 93 insertions(+), 138 deletions(-) rename {src/core => external}/QHotkey/CMakeLists.txt (100%) rename {src/core => external}/QHotkey/LICENSE (100%) rename {src/core => external}/QHotkey/QHotkey (100%) rename {src/core => external}/QHotkey/README.md (100%) rename {src/core => external}/QHotkey/qhotkey.cpp (100%) rename {src/core => external}/QHotkey/qhotkey.h (100%) rename {src/core => external}/QHotkey/qhotkey_mac.cpp (100%) rename {src/core => external}/QHotkey/qhotkey_p.h (100%) rename {src/core => external}/QHotkey/qhotkey_win.cpp (100%) rename {src/core => external}/QHotkey/qhotkey_x11.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d15a8a0..14f014e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ cmake_minimum_required(VERSION 3.13) set(FLAMESHOT_VERSION 0.8.5.6) # Flameshot-org -#set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/latest") +set(GIT_API_URL "https://api.github.com/repos/flameshot-org/flameshot/releases/latest") # Namecheap -set(GIT_API_URL "https://api.github.com/repos/namecheap/flameshot/releases/latest") +# set(GIT_API_URL "https://api.github.com/repos/namecheap/flameshot/releases/latest") # TODO - fix it for all linux distros # find_package (Git) diff --git a/src/core/QHotkey/CMakeLists.txt b/external/QHotkey/CMakeLists.txt similarity index 100% rename from src/core/QHotkey/CMakeLists.txt rename to external/QHotkey/CMakeLists.txt diff --git a/src/core/QHotkey/LICENSE b/external/QHotkey/LICENSE similarity index 100% rename from src/core/QHotkey/LICENSE rename to external/QHotkey/LICENSE diff --git a/src/core/QHotkey/QHotkey b/external/QHotkey/QHotkey similarity index 100% rename from src/core/QHotkey/QHotkey rename to external/QHotkey/QHotkey diff --git a/src/core/QHotkey/README.md b/external/QHotkey/README.md similarity index 100% rename from src/core/QHotkey/README.md rename to external/QHotkey/README.md diff --git a/src/core/QHotkey/qhotkey.cpp b/external/QHotkey/qhotkey.cpp similarity index 100% rename from src/core/QHotkey/qhotkey.cpp rename to external/QHotkey/qhotkey.cpp diff --git a/src/core/QHotkey/qhotkey.h b/external/QHotkey/qhotkey.h similarity index 100% rename from src/core/QHotkey/qhotkey.h rename to external/QHotkey/qhotkey.h diff --git a/src/core/QHotkey/qhotkey_mac.cpp b/external/QHotkey/qhotkey_mac.cpp similarity index 100% rename from src/core/QHotkey/qhotkey_mac.cpp rename to external/QHotkey/qhotkey_mac.cpp diff --git a/src/core/QHotkey/qhotkey_p.h b/external/QHotkey/qhotkey_p.h similarity index 100% rename from src/core/QHotkey/qhotkey_p.h rename to external/QHotkey/qhotkey_p.h diff --git a/src/core/QHotkey/qhotkey_win.cpp b/external/QHotkey/qhotkey_win.cpp similarity index 100% rename from src/core/QHotkey/qhotkey_win.cpp rename to external/QHotkey/qhotkey_win.cpp diff --git a/src/core/QHotkey/qhotkey_x11.cpp b/external/QHotkey/qhotkey_x11.cpp similarity index 100% rename from src/core/QHotkey/qhotkey_x11.cpp rename to external/QHotkey/qhotkey_x11.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ffb3b24f..a8666078 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -149,29 +149,22 @@ target_include_directories( $ $) +target_link_libraries( + flameshot + project_warnings + project_options + Qt5::Svg + Qt5::DBus + Qt5::Network + Qt5::Widgets + SingleApplication::SingleApplication + spdlog::spdlog +) + if (APPLE) target_link_libraries( flameshot - project_warnings - project_options qhotkey - Qt5::Svg - Qt5::DBus - Qt5::Network - Qt5::Widgets - SingleApplication::SingleApplication - spdlog::spdlog) -else () - target_link_libraries( - flameshot - project_warnings - project_options - Qt5::Svg - Qt5::DBus - Qt5::Network - Qt5::Widgets - SingleApplication::SingleApplication - spdlog::spdlog ) endif () diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 2e34fe10..8ff11829 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -17,7 +17,7 @@ #include "controller.h" #include "src/config/configwindow.h" -#include "src/core/QHotkey/QHotkey" +#include "external/QHotkey/QHotkey" #include "src/utils/confighandler.h" #include "src/utils/history.h" #include "src/utils/screengrabber.h" @@ -45,7 +45,7 @@ #include "src/core/globalshortcutfilter.h" #endif -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) #include #include @@ -55,15 +55,12 @@ // launches the capture widget Controller::Controller() - : m_captureWindow(nullptr) - , m_history(nullptr) - , m_trayIconMenu(nullptr) - , m_networkCheckUpdates(nullptr) - , m_showCheckAppUpdateStatus(false) -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ + : m_captureWindow(nullptr), m_history(nullptr), m_trayIconMenu(nullptr), m_networkCheckUpdates(nullptr), + m_showCheckAppUpdateStatus(false) +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) - , m_HotkeyScreenshotCapture(nullptr) - , m_HotkeyScreenshotHistory(nullptr) +, m_HotkeyScreenshotCapture(nullptr) +, m_HotkeyScreenshotHistory(nullptr) #endif { m_appLatestVersion = QStringLiteral(APP_VERSION).replace("v", ""); @@ -90,7 +87,7 @@ Controller::Controller() QString StyleSheet = CaptureButton::globalStyleSheet(); qApp->setStyleSheet(StyleSheet); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) // Try to take a test screenshot, MacOS will request a "Screen Recording" // permissions on the first run. Otherwise it will be hidden under the @@ -115,28 +112,24 @@ Controller::Controller() getLatestAvailableVersion(); } -Controller::~Controller() -{ +Controller::~Controller() { delete m_history; delete m_trayIconMenu; } -Controller* Controller::getInstance() -{ +Controller *Controller::getInstance() { static Controller c; return &c; } -void Controller::enableExports() -{ +void Controller::enableExports() { connect( - this, &Controller::captureTaken, this, &Controller::handleCaptureTaken); + this, &Controller::captureTaken, this, &Controller::handleCaptureTaken); connect( - this, &Controller::captureFailed, this, &Controller::handleCaptureFailed); + this, &Controller::captureFailed, this, &Controller::handleCaptureFailed); } -void Controller::getLatestAvailableVersion() -{ +void Controller::getLatestAvailableVersion() { // This features is required for MacOS and Windows user and for Linux users // who installed Flameshot not from the repository. m_networkCheckUpdates = new QNetworkAccessManager(this); @@ -153,18 +146,17 @@ void Controller::getLatestAvailableVersion() }); } -void Controller::handleReplyCheckUpdates(QNetworkReply* reply) -{ +void Controller::handleReplyCheckUpdates(QNetworkReply *reply) { if (reply->error() == QNetworkReply::NoError) { QJsonDocument response = QJsonDocument::fromJson(reply->readAll()); QJsonObject json = response.object(); m_appLatestVersion = json["tag_name"].toString().replace("v", ""); if (QStringLiteral(APP_VERSION) - .replace("v", "") - .compare(m_appLatestVersion) < 0) { + .replace("v", "") + .compare(m_appLatestVersion) < 0) { m_appLatestUrl = json["html_url"].toString(); QString newVersion = - tr("New version %1 is available").arg(m_appLatestVersion); + tr("New version %1 is available").arg(m_appLatestVersion); m_appUpdates->setText(newVersion); if (m_showCheckAppUpdateStatus) { sendTrayNotification(newVersion, "Flameshot"); @@ -179,15 +171,14 @@ void Controller::handleReplyCheckUpdates(QNetworkReply* reply) << reply->errorString(); if (m_showCheckAppUpdateStatus) { sendTrayNotification( - tr("Failed to get information about the latest version."), - "Flameshot"); + tr("Failed to get information about the latest version."), + "Flameshot"); } } m_showCheckAppUpdateStatus = false; } -void Controller::appUpdates() -{ +void Controller::appUpdates() { if (m_appLatestUrl.isEmpty()) { m_showCheckAppUpdateStatus = true; getLatestAvailableVersion(); @@ -196,8 +187,7 @@ void Controller::appUpdates() } } -void Controller::requestCapture(const CaptureRequest& request) -{ +void Controller::requestCapture(const CaptureRequest &request) { uint id = request.id(); m_requestMap.insert(id, request); @@ -207,17 +197,17 @@ void Controller::requestCapture(const CaptureRequest& request) this->startFullscreenCapture(id); }); break; - // TODO: Figure out the code path that gets here so the deprated warning - // can be fixed + // TODO: Figure out the code path that gets here so the deprated warning + // can be fixed case CaptureRequest::SCREEN_MODE: { - int&& number = request.data().toInt(); + int &&number = request.data().toInt(); doLater(request.delay(), this, [this, id, number]() { this->startScreenGrab(id, number); }); break; } case CaptureRequest::GRAPHICAL_MODE: { - QString&& path = request.path(); + QString &&path = request.path(); doLater(request.delay(), this, [this, id, path]() { this->startVisualCapture(id, path); }); @@ -231,10 +221,9 @@ void Controller::requestCapture(const CaptureRequest& request) // creation of a new capture in GUI mode void Controller::startVisualCapture(const uint id, - const QString& forcedSavePath) -{ + const QString &forcedSavePath) { if (!m_captureWindow) { - QWidget* modalWidget = nullptr; + QWidget *modalWidget = nullptr; do { modalWidget = qApp->activeModalWidget(); if (modalWidget) { @@ -257,7 +246,7 @@ void Controller::startVisualCapture(const uint id, #ifdef Q_OS_WIN m_captureWindow->show(); -#elif (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#elif (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) // In "Emulate fullscreen mode" m_captureWindow->showFullScreen(); @@ -265,10 +254,11 @@ void Controller::startVisualCapture(const uint id, m_captureWindow->raise(); #else m_captureWindow->showFullScreen(); + //m_captureWindow->show(); //Debug #endif if (!m_appLatestUrl.isEmpty() && ConfigHandler().ignoreUpdateToVersion().compare( - m_appLatestVersion) < 0) { + m_appLatestVersion) < 0) { m_captureWindow->showAppUpdateNotification(m_appLatestVersion, m_appLatestUrl); } @@ -277,8 +267,7 @@ void Controller::startVisualCapture(const uint id, } } -void Controller::startScreenGrab(const uint id, const int screenNumber) -{ +void Controller::startScreenGrab(const uint id, const int screenNumber) { bool ok = true; int n = screenNumber; @@ -296,12 +285,11 @@ void Controller::startScreenGrab(const uint id, const int screenNumber) } // creation of the configuration window -void Controller::openConfigWindow() -{ +void Controller::openConfigWindow() { if (!m_configWindow) { m_configWindow = new ConfigWindow(); m_configWindow->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) m_configWindow->activateWindow(); m_configWindow->raise(); @@ -310,11 +298,10 @@ void Controller::openConfigWindow() } // creation of the window of information -void Controller::openInfoWindow() -{ +void Controller::openInfoWindow() { if (!m_infoWindow) { m_infoWindow = new InfoWindow(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) m_infoWindow->activateWindow(); m_infoWindow->raise(); @@ -322,53 +309,51 @@ void Controller::openInfoWindow() } } -void Controller::openLauncherWindow() -{ +void Controller::openLauncherWindow() { if (!m_launcherWindow) { m_launcherWindow = new CaptureLauncher(); } m_launcherWindow->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) m_launcherWindow->activateWindow(); m_launcherWindow->raise(); #endif } -void Controller::enableTrayIcon() -{ +void Controller::enableTrayIcon() { if (m_trayIcon) { return; } m_trayIconMenu = new QMenu(); ConfigHandler().setDisabledTrayIcon(false); - QAction* captureAction = new QAction(tr("&Take Screenshot"), this); + QAction *captureAction = new QAction(tr("&Take Screenshot"), this); connect(captureAction, &QAction::triggered, this, [this]() { // Wait 400 ms to hide the QMenu doLater(400, this, [this]() { this->startVisualCapture(); }); }); - QAction* launcherAction = new QAction(tr("&Open Launcher"), this); + QAction *launcherAction = new QAction(tr("&Open Launcher"), this); connect(launcherAction, &QAction::triggered, this, &Controller::openLauncherWindow); - QAction* configAction = new QAction(tr("&Configuration"), this); + QAction *configAction = new QAction(tr("&Configuration"), this); connect( - configAction, &QAction::triggered, this, &Controller::openConfigWindow); - QAction* infoAction = new QAction(tr("&About"), this); + configAction, &QAction::triggered, this, &Controller::openConfigWindow); + QAction *infoAction = new QAction(tr("&About"), this); connect(infoAction, &QAction::triggered, this, &Controller::openInfoWindow); m_appUpdates = new QAction(tr("Check for updates"), this); connect(m_appUpdates, &QAction::triggered, this, &Controller::appUpdates); - QAction* quitAction = new QAction(tr("&Quit"), this); + QAction *quitAction = new QAction(tr("&Quit"), this); connect(quitAction, &QAction::triggered, qApp, &QCoreApplication::quit); // recent screenshots - QAction* recentAction = new QAction(tr("&Latest Uploads"), this); + QAction *recentAction = new QAction(tr("&Latest Uploads"), this); connect( - recentAction, SIGNAL(triggered()), this, SLOT(showRecentScreenshots())); + recentAction, SIGNAL(triggered()), this, SLOT(showRecentScreenshots())); // generate menu m_trayIconMenu->addAction(captureAction); @@ -385,7 +370,7 @@ void Controller::enableTrayIcon() m_trayIcon = new QSystemTrayIcon(); m_trayIcon->setToolTip(QStringLiteral("Flameshot")); -#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX) // Because of the following issues on MacOS "Catalina": // https://bugreports.qt.io/browse/QTBUG-86393 @@ -398,10 +383,10 @@ void Controller::enableTrayIcon() m_trayIcon->setContextMenu(m_trayIconMenu); #endif QIcon trayicon = - QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png")); + QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png")); m_trayIcon->setIcon(trayicon); -#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX) if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) { // Because of the following issues on MacOS "Catalina": @@ -435,8 +420,7 @@ void Controller::enableTrayIcon() m_trayIcon->show(); } -void Controller::disableTrayIcon() -{ +void Controller::disableTrayIcon() { #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) if (m_trayIcon) { m_trayIcon->deleteLater(); @@ -445,25 +429,22 @@ void Controller::disableTrayIcon() #endif } -void Controller::sendTrayNotification(const QString& text, - const QString& title, - const int timeout) -{ +void Controller::sendTrayNotification(const QString &text, + const QString &title, + const int timeout) { if (m_trayIcon) { m_trayIcon->showMessage( - title, text, QIcon(":img/app/flameshot.svg"), timeout); + title, text, QIcon(":img/app/flameshot.svg"), timeout); } } -void Controller::updateConfigComponents() -{ +void Controller::updateConfigComponents() { if (m_configWindow) { m_configWindow->updateChildren(); } } -void Controller::updateRecentScreenshots() -{ +void Controller::updateRecentScreenshots() { if (nullptr != m_history) { if (m_history->isVisible()) { m_history->loadHistory(); @@ -471,22 +452,20 @@ void Controller::updateRecentScreenshots() } } -void Controller::showRecentScreenshots() -{ +void Controller::showRecentScreenshots() { if (nullptr == m_history) { m_history = new HistoryWidget(); } m_history->loadHistory(); m_history->show(); -#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ +#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) m_history->activateWindow(); m_history->raise(); #endif } -void Controller::startFullscreenCapture(const uint id) -{ +void Controller::startFullscreenCapture(const uint id) { bool ok = true; QPixmap p(ScreenGrabber().grabEntireDesktop(ok)); if (ok) { @@ -497,8 +476,7 @@ void Controller::startFullscreenCapture(const uint id) } } -void Controller::handleCaptureTaken(uint id, QPixmap p, QRect selection) -{ +void Controller::handleCaptureTaken(uint id, QPixmap p, QRect selection) { auto it = m_requestMap.find(id); if (it != m_requestMap.end()) { it.value().exportCapture(p); @@ -506,14 +484,12 @@ void Controller::handleCaptureTaken(uint id, QPixmap p, QRect selection) } } -void Controller::handleCaptureFailed(uint id) -{ +void Controller::handleCaptureFailed(uint id) { m_requestMap.remove(id); } -void Controller::doLater(int msec, QObject* receiver, lambda func) -{ - QTimer* timer = new QTimer(receiver); +void Controller::doLater(int msec, QObject *receiver, lambda func) { + QTimer *timer = new QTimer(receiver); QObject::connect(timer, &QTimer::timeout, receiver, [timer, func]() { func(); timer->deleteLater(); diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp index 18189b62..43efe1e6 100644 --- a/src/widgets/panel/utilitypanel.cpp +++ b/src/widgets/panel/utilitypanel.cpp @@ -23,9 +23,8 @@ #include #include -UtilityPanel::UtilityPanel(QWidget* parent) - : QWidget(parent) -{ +UtilityPanel::UtilityPanel(QWidget *parent) + : QWidget(parent) { initInternalPanel(); setAttribute(Qt::WA_TransparentForMouseEvents); setCursor(Qt::ArrowCursor); @@ -43,19 +42,17 @@ UtilityPanel::UtilityPanel(QWidget* parent) m_internalPanel, &QWidget::hide); -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \ +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \ defined(Q_OS_MACOS) || defined(Q_OS_MACX)) move(0, 0); #endif } -QWidget* UtilityPanel::toolWidget() const -{ +QWidget *UtilityPanel::toolWidget() const { return m_toolWidget; } -void UtilityPanel::addToolWidget(QWidget* w) -{ +void UtilityPanel::addToolWidget(QWidget *w) { if (m_toolWidget) { m_toolWidget->deleteLater(); } @@ -67,34 +64,30 @@ void UtilityPanel::addToolWidget(QWidget* w) } } -void UtilityPanel::clearToolWidget() -{ +void UtilityPanel::clearToolWidget() { if (m_toolWidget) { m_toolWidget->deleteLater(); } } -void UtilityPanel::pushWidget(QWidget* w) -{ +void UtilityPanel::pushWidget(QWidget *w) { m_layout->insertWidget(m_layout->count() - 1, w); } -void UtilityPanel::show() -{ +void UtilityPanel::show() { setAttribute(Qt::WA_TransparentForMouseEvents, false); m_showAnimation->setStartValue(QRect(-width(), 0, 0, height())); m_showAnimation->setEndValue(QRect(0, 0, width(), height())); m_internalPanel->show(); m_showAnimation->start(); -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \ +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_MAC64) || \ defined(Q_OS_MACOS) || defined(Q_OS_MACX)) move(0, 0); #endif QWidget::show(); } -void UtilityPanel::hide() -{ +void UtilityPanel::hide() { setAttribute(Qt::WA_TransparentForMouseEvents); m_hideAnimation->setStartValue(QRect(0, 0, width(), height())); m_hideAnimation->setEndValue(QRect(-width(), 0, 0, height())); @@ -103,8 +96,7 @@ void UtilityPanel::hide() QWidget::hide(); } -void UtilityPanel::toggle() -{ +void UtilityPanel::toggle() { if (m_internalPanel->isHidden()) { show(); } else { @@ -112,11 +104,10 @@ void UtilityPanel::toggle() } } -void UtilityPanel::initInternalPanel() -{ +void UtilityPanel::initInternalPanel() { m_internalPanel = new QScrollArea(this); m_internalPanel->setAttribute(Qt::WA_NoMousePropagation); - QWidget* widget = new QWidget(); + QWidget *widget = new QWidget(); m_internalPanel->setWidget(widget); m_internalPanel->setWidgetResizable(true); @@ -127,7 +118,7 @@ void UtilityPanel::initInternalPanel() m_layout->addLayout(m_bottomLayout); widget->setLayout(m_layout); - QPushButton* closeButton = new QPushButton(this); + QPushButton *closeButton = new QPushButton(this); closeButton->setText(tr("Close")); connect(closeButton, &QPushButton::clicked, this, &UtilityPanel::toggle); m_bottomLayout->addWidget(closeButton); @@ -135,11 +126,6 @@ void UtilityPanel::initInternalPanel() QColor bgColor = palette().window().color(); bgColor.setAlphaF(0.0); m_internalPanel->setStyleSheet( - QStringLiteral("QScrollArea {background-color: %1}").arg(bgColor.name())); - - m_hide = new QPushButton(); - m_hide->setText(tr("Hide")); - m_upLayout->addWidget(m_hide); - connect(m_hide, SIGNAL(clicked()), this, SLOT(slotHidePanel())); + QStringLiteral("QScrollArea {background-color: %1}").arg(bgColor.name())); m_internalPanel->hide(); }