1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

[Themes] Set navigationbar layout margin and spacing from style sheet.

This commit is contained in:
nowrep 2013-04-27 13:51:08 +02:00
parent a618cb7249
commit c106c2376b
8 changed files with 61 additions and 5 deletions

View File

@ -56,6 +56,12 @@
}
/*NavigationBar*/
#navigationbar
{
qproperty-layoutMargin: 3;
qproperty-layoutSpacing: 3;
}
#navigationbar QSplitter::handle
{
background-color:transparent;

View File

@ -54,6 +54,12 @@
}
/*NavigationBar*/
#navigationbar
{
qproperty-layoutMargin: 2;
qproperty-layoutSpacing: 3;
}
#navigationbar QSplitter::handle
{
background-color:transparent;

View File

@ -50,6 +50,12 @@
}
/*NavigationBar*/
#navigationbar
{
qproperty-layoutMargin: 4;
qproperty-layoutSpacing: 3;
}
#navigationbar QSplitter::handle
{
height: 8px;

View File

@ -56,6 +56,12 @@
}
/*NavigationBar*/
#navigationbar
{
qproperty-layoutMargin: 3;
qproperty-layoutSpacing: 3;
}
#navigationbar QSplitter::handle
{
background-color:transparent;

View File

@ -74,9 +74,6 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
{
setObjectName("navigationbar");
m_layout = new QHBoxLayout(this);
m_layout->setMargin(3);
m_layout->setSpacing(3);
m_layout->setMargin(style()->pixelMetric(QStyle::PM_ToolBarItemMargin, 0, this));
m_layout->setSpacing(style()->pixelMetric(QStyle::PM_ToolBarItemSpacing, 0, this));
setLayout(m_layout);
@ -218,6 +215,26 @@ void NavigationBar::setSuperMenuVisible(bool visible)
m_supMenu->setVisible(visible);
}
int NavigationBar::layoutMargin() const
{
return m_layout->margin();
}
void NavigationBar::setLayoutMargin(int margin)
{
m_layout->setMargin(margin);
}
int NavigationBar::layoutSpacing() const
{
return m_layout->spacing();
}
void NavigationBar::setLayoutSpacing(int spacing)
{
m_layout->setSpacing(spacing);
}
void NavigationBar::aboutToShowHistoryBackMenu()
{
if (!m_menuBack || !p_QupZilla->weView()) {

View File

@ -38,6 +38,9 @@ class QT_QUPZILLA_EXPORT NavigationBar : public QWidget
public:
explicit NavigationBar(QupZilla* mainClass);
Q_PROPERTY(int layoutMargin READ layoutMargin WRITE setLayoutMargin)
Q_PROPERTY(int layoutSpacing READ layoutSpacing WRITE setLayoutSpacing)
void setSplitterSizes(int locationBar, int websearchBar);
void showReloadButton();
@ -54,6 +57,12 @@ public:
void setSuperMenuVisible(bool visible);
int layoutMargin() const;
void setLayoutMargin(int margin);
int layoutSpacing() const;
void setLayoutSpacing(int spacing);
signals:
public slots:

View File

@ -18,7 +18,6 @@
#include "clickablelabel.h"
#include <QMouseEvent>
#include <QIcon>
ClickableLabel::ClickableLabel(QWidget* parent)
: QLabel(parent)
@ -35,6 +34,11 @@ void ClickableLabel::setThemeIcon(const QString &name)
}
}
QIcon ClickableLabel::fallbackIcon() const
{
return pixmap() ? QIcon(*pixmap()) : QIcon();
}
void ClickableLabel::setFallbackIcon(const QIcon &image)
{
if (!pixmap() || pixmap()->isNull()) {

View File

@ -19,6 +19,7 @@
#define CLICKABLELABEL_H
#include <QLabel>
#include <QIcon>
#include "qz_namespace.h"
@ -31,7 +32,7 @@ class QT_QUPZILLA_EXPORT ClickableLabel : public QLabel
Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth)
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon)
Q_PROPERTY(QIcon fallbackIcon WRITE setFallbackIcon)
Q_PROPERTY(QIcon fallbackIcon READ fallbackIcon WRITE setFallbackIcon)
public:
explicit ClickableLabel(QWidget* parent = 0);
@ -39,6 +40,7 @@ public:
QString themeIcon() const;
void setThemeIcon(const QString &name);
QIcon fallbackIcon() const;
void setFallbackIcon(const QIcon &image);
signals: