From dc3c07f95c6e8c87f184afb5ac45ec52b38579a8 Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 29 Jun 2022 10:43:03 +0800
Subject: [PATCH] Repair menu button hover style exception

---
 src/leftupsearchbox.cpp |  9 +++------
 src/menumodule.cpp      | 10 +++++++++-
 src/menumodule.h        |  1 +
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/leftupsearchbox.cpp b/src/leftupsearchbox.cpp
index 5412056..6e2a95e 100644
--- a/src/leftupsearchbox.cpp
+++ b/src/leftupsearchbox.cpp
@@ -87,18 +87,15 @@ bool LeftUpSearchBox::event(QEvent *e){
         switch(k->key()){
             case Qt::Key_Up:{
                 emit lineEditKeyEvent("up");
-//                return true;
-            break;
+                break;
             }
             case Qt::Key_Down:{
                 emit lineEditKeyEvent("down");
-            //                return true;
-                        break;
+                break;
             }
             case Qt::Key_Return:{
                 emit lineEditKeyEvent("enter");
-            //                return true;
-                        break;
+                break;
             }
         }
     }
diff --git a/src/menumodule.cpp b/src/menumodule.cpp
index 39d8a8d..3e83462 100644
--- a/src/menumodule.cpp
+++ b/src/menumodule.cpp
@@ -14,7 +14,9 @@ void menuModule::initAction(){
     iconSize = QSize(30,30);
     menuButton = new QPushButton;
     menuButton->setIcon(QIcon::fromTheme("application-menu"));
+    menuButton->setFlat(true);
     menuButton->setFixedSize(iconSize);
+
     m_menu = new QMenu();
     addCityAction = new AddCityAction(m_menu);
     QList<QAction *> actions ;
@@ -249,7 +251,13 @@ QVBoxLayout* menuModule::initBody(){
 }
 
 void menuModule::setStyle(){
-    menuButton->setStyleSheet("QPushButton::menu-indicator{image:None;}");
+    //menuButton->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;}"
+    //                          "QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.1);}"
+    //                          "QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.15);}");
+    menuButton->setStyleSheet("QPushButton{border:0px;border-radius:4px;background:transparent;}"
+    		              "QPushButton:Hover{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.1);}"
+    		              "QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;background-color:rgba(0,0,0,0.15);}"
+    		              "QPushButton::menu-indicator{image:None;}");
 }
 
 void menuModule::initGsetting(){
diff --git a/src/menumodule.h b/src/menumodule.h
index 480443b..d3a8717 100644
--- a/src/menumodule.h
+++ b/src/menumodule.h
@@ -9,6 +9,7 @@
 #include <QWidget>
 #include <QMenu>
 #include <QPushButton>
+#include <QToolButton>
 #include <QDebug>
 #include <QString>
 #include <QLabel>
-- 
2.33.0

