1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[ToolBar] Use size of icons according to Qt style.

This commit is contained in:
nowrep 2013-04-27 12:57:13 +02:00
parent 90ccae62f2
commit ba9535a727
2 changed files with 16 additions and 7 deletions

View File

@ -21,7 +21,6 @@
{ {
qproperty-themeIcon: "go-previous"; qproperty-themeIcon: "go-previous";
qproperty-fallbackIcon: url(images/go-previous.png); qproperty-fallbackIcon: url(images/go-previous.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-back::menu-indicator #navigation-button-back::menu-indicator
@ -33,7 +32,6 @@
{ {
qproperty-themeIcon: "go-next"; qproperty-themeIcon: "go-next";
qproperty-fallbackIcon: url(images/go-next.png); qproperty-fallbackIcon: url(images/go-next.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-next::menu-indicator #navigation-button-next::menu-indicator
@ -45,35 +43,30 @@
{ {
qproperty-themeIcon: "process-stop"; qproperty-themeIcon: "process-stop";
qproperty-fallbackIcon: url(images/process-stop.png); qproperty-fallbackIcon: url(images/process-stop.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-reload #navigation-button-reload
{ {
qproperty-themeIcon: "view-refresh"; qproperty-themeIcon: "view-refresh";
qproperty-fallbackIcon: url(images/view-refresh.png); qproperty-fallbackIcon: url(images/view-refresh.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-home #navigation-button-home
{ {
qproperty-themeIcon: "go-home"; qproperty-themeIcon: "go-home";
qproperty-fallbackIcon: url(images/go-home.png); qproperty-fallbackIcon: url(images/go-home.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-addtab #navigation-button-addtab
{ {
qproperty-themeIcon: "list-add"; qproperty-themeIcon: "list-add";
qproperty-fallbackIcon: url(images/list-add.png); qproperty-fallbackIcon: url(images/list-add.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-supermenu #navigation-button-supermenu
{ {
qproperty-themeIcon: "preferences-desktop"; qproperty-themeIcon: "preferences-desktop";
qproperty-fallbackIcon: url(images/preferences-desktop.png); qproperty-fallbackIcon: url(images/preferences-desktop.png);
qproperty-iconSize: 24px 24px;
} }
#navigation-button-supermenu::menu-indicator #navigation-button-supermenu::menu-indicator

View File

@ -34,6 +34,7 @@
#include <QStackedWidget> #include <QStackedWidget>
#include <QWebHistory> #include <QWebHistory>
#include <QMouseEvent> #include <QMouseEvent>
#include <QStyleOption>
QString NavigationBar::titleForUrl(QString title, const QUrl &url) QString NavigationBar::titleForUrl(QString title, const QUrl &url)
{ {
@ -59,6 +60,14 @@ QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon)
return icon; return icon;
} }
static inline void setButtonIconSize(ToolButton* button)
{
QStyleOption opt;
opt.initFrom(button);
int size = button->style()->pixelMetric(QStyle::PM_ToolBarIconSize, &opt, button);
button->setIconSize(QSize(size, size));
}
NavigationBar::NavigationBar(QupZilla* mainClass) NavigationBar::NavigationBar(QupZilla* mainClass)
: QWidget(mainClass) : QWidget(mainClass)
, p_QupZilla(mainClass) , p_QupZilla(mainClass)
@ -79,6 +88,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_buttonBack->setAutoRaise(true); m_buttonBack->setAutoRaise(true);
m_buttonBack->setEnabled(false); m_buttonBack->setEnabled(false);
m_buttonBack->setFocusPolicy(Qt::NoFocus); m_buttonBack->setFocusPolicy(Qt::NoFocus);
setButtonIconSize(m_buttonBack);
m_buttonNext = new ToolButton(this); m_buttonNext = new ToolButton(this);
m_buttonNext->setObjectName("navigation-button-next"); m_buttonNext->setObjectName("navigation-button-next");
@ -87,6 +97,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_buttonNext->setAutoRaise(true); m_buttonNext->setAutoRaise(true);
m_buttonNext->setEnabled(false); m_buttonNext->setEnabled(false);
m_buttonNext->setFocusPolicy(Qt::NoFocus); m_buttonNext->setFocusPolicy(Qt::NoFocus);
setButtonIconSize(m_buttonNext);
QHBoxLayout* backNextLayout = new QHBoxLayout(); QHBoxLayout* backNextLayout = new QHBoxLayout();
backNextLayout->setContentsMargins(0, 0, 0, 0); backNextLayout->setContentsMargins(0, 0, 0, 0);
@ -95,6 +106,8 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
backNextLayout->addWidget(m_buttonNext); backNextLayout->addWidget(m_buttonNext);
m_reloadStop = new ReloadStopButton(this); m_reloadStop = new ReloadStopButton(this);
setButtonIconSize(m_reloadStop->buttonReload());
setButtonIconSize(m_reloadStop->buttonStop());
m_buttonHome = new ToolButton(this); m_buttonHome = new ToolButton(this);
m_buttonHome->setObjectName("navigation-button-home"); m_buttonHome->setObjectName("navigation-button-home");
@ -102,6 +115,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_buttonHome->setToolButtonStyle(Qt::ToolButtonIconOnly); m_buttonHome->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_buttonHome->setAutoRaise(true); m_buttonHome->setAutoRaise(true);
m_buttonHome->setFocusPolicy(Qt::NoFocus); m_buttonHome->setFocusPolicy(Qt::NoFocus);
setButtonIconSize(m_buttonHome);
m_buttonAddTab = new ToolButton(this); m_buttonAddTab = new ToolButton(this);
m_buttonAddTab->setObjectName("navigation-button-addtab"); m_buttonAddTab->setObjectName("navigation-button-addtab");
@ -109,6 +123,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_buttonAddTab->setToolButtonStyle(Qt::ToolButtonIconOnly); m_buttonAddTab->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_buttonAddTab->setAutoRaise(true); m_buttonAddTab->setAutoRaise(true);
m_buttonAddTab->setFocusPolicy(Qt::NoFocus); m_buttonAddTab->setFocusPolicy(Qt::NoFocus);
setButtonIconSize(m_buttonAddTab);
m_menuBack = new Menu(this); m_menuBack = new Menu(this);
m_buttonBack->setMenu(m_menuBack); m_buttonBack->setMenu(m_menuBack);
@ -124,6 +139,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
m_supMenu->setFocusPolicy(Qt::NoFocus); m_supMenu->setFocusPolicy(Qt::NoFocus);
m_supMenu->setMenu(p_QupZilla->superMenu()); m_supMenu->setMenu(p_QupZilla->superMenu());
m_supMenu->setShowMenuInside(true); m_supMenu->setShowMenuInside(true);
setButtonIconSize(m_supMenu);
#endif #endif
m_searchLine = new WebSearchBar(p_QupZilla); m_searchLine = new WebSearchBar(p_QupZilla);