mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
bigger menu icon
apply a custom proxystyle for the menu widget to change the icon size
This commit is contained in:
parent
6e25496141
commit
840e409cec
@ -96,7 +96,8 @@ HEADERS += \
|
||||
src/opdsrequestmanager.h \
|
||||
src/localkiwixserver.h \
|
||||
src/fullscreenwindow.h \
|
||||
src/fullscreennotification.h
|
||||
src/fullscreennotification.h \
|
||||
src/menuproxystyle.h
|
||||
|
||||
FORMS += \
|
||||
ui/mainwindow.ui \
|
||||
|
@ -88,7 +88,7 @@ QMenu::item {
|
||||
min-height: 40px;
|
||||
max-height: 40px;
|
||||
border: 1px solid transparent;
|
||||
padding: 2px 12px 2px 40px;
|
||||
padding: 2px 12px 2px 20px;
|
||||
}
|
||||
|
||||
QMenu::icon {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "mainmenu.h"
|
||||
#include "kiwixapp.h"
|
||||
#include "menuproxystyle.h"
|
||||
|
||||
#define ADD_ACTION(ID) addAction(app->getAction(KiwixApp::ID));
|
||||
|
||||
@ -9,6 +10,7 @@ MainMenu::MainMenu(QWidget *parent) :
|
||||
QMenu(parent)
|
||||
{
|
||||
auto app = KiwixApp::instance();
|
||||
setStyle(new MenuProxyStyle());
|
||||
|
||||
ADD_ACTION(KiwixServeAction);
|
||||
ADD_ACTION(RandomArticleAction);
|
||||
|
19
src/menuproxystyle.h
Normal file
19
src/menuproxystyle.h
Normal file
@ -0,0 +1,19 @@
|
||||
#include <QProxyStyle>
|
||||
|
||||
class MenuProxyStyle: public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MenuProxyStyle(QStyle * style = 0) : QProxyStyle(style) {}
|
||||
MenuProxyStyle(const QString & key) : QProxyStyle(key) {}
|
||||
|
||||
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const {
|
||||
switch ( metric ) {
|
||||
case QStyle::PM_SmallIconSize:
|
||||
return 25;
|
||||
default:
|
||||
return QProxyStyle::pixelMetric( metric, option, widget );
|
||||
}
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user