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

Fixed padding of text and widgets position in address bar

- after recent RTL commit

closes #500
This commit is contained in:
nowrep 2012-08-13 15:41:08 +02:00
parent 341739cf59
commit 5de31410a4
15 changed files with 30 additions and 59 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 526 B

View File

@ -130,6 +130,7 @@ IconProvider
padding-left: 0px;
padding-top: -2px;
qproperty-fixedheight: 27;
qproperty-leftMargin: 28;
}
#locationbar-bookmarkicon
@ -169,7 +170,6 @@ IconProvider
#locationbar-down-icon
{
margin-right: -4px;
margin-bottom: 1px;
qproperty-pixmap: url(images/navigation-dropdown.png);
}

View File

@ -139,6 +139,7 @@ IconProvider
padding-right: -2px;
padding-left: -2px;
qproperty-fixedheight: 25;
qproperty-leftMargin: 35;
}
#locationbar-bookmarkicon

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 526 B

View File

@ -120,6 +120,7 @@ IconProvider
padding-left: -4px;
padding-top: -2px;
qproperty-fixedheight: 27;
qproperty-leftMargin: 26;
}
#locationbar[secured="true"]
@ -160,7 +161,6 @@ IconProvider
#locationbar-down-icon
{
margin-right: -4px;
margin-bottom: 1px;
qproperty-pixmap: url(images/navigation-dropdown.png);
}

View File

@ -125,6 +125,7 @@ IconProvider
padding-left: -5px;
padding-top: -2px;
qproperty-fixedheight: 23;
qproperty-leftMargin: 40;
}
#locationbar-bookmarkicon

View File

@ -134,6 +134,7 @@ IconProvider
padding-right: -4px;
padding-left: -4px;
qproperty-fixedheight: 22;
qproperty-leftMargin: 29;
}
#locationbar-bookmarkicon

View File

@ -52,7 +52,7 @@ void LineEdit::init()
//// subclasses in all themes and use same value for padding-left and padding-right,
//// with this new implementation padding-left and padding-right show padding from
//// edges of m_leftWidget and m_rightWidget.
//setStyleSheet(QString("QLineEdit{padding-left: 0; padding-right: 0;}"));
mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(0);
@ -83,9 +83,9 @@ void LineEdit::init()
m_rightLayout->setContentsMargins(0, 0, 2, 0);
QSpacerItem* horizontalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
mainLayout->addWidget(m_leftWidget, 0, Qt::AlignVCenter|Qt::AlignLeft);
mainLayout->addWidget(m_leftWidget, 0, Qt::AlignVCenter | Qt::AlignLeft);
mainLayout->addItem(horizontalSpacer);
mainLayout->addWidget(m_rightWidget, 0, Qt::AlignVCenter|Qt::AlignRight);
mainLayout->addWidget(m_rightWidget, 0, Qt::AlignVCenter | Qt::AlignRight);
//by this we undo reversing of layout when direction is RTL. //TODO: don't do this and show reversed icon when needed
mainLayout->setDirection(isRightToLeft() ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight);
@ -213,31 +213,3 @@ void LineEdit::updateTextMargins()
// updateSideWidgetLocations();
// QLineEdit::resizeEvent(event);
//}
QString LineEdit::inactiveText() const
{
return m_inactiveText;
}
void LineEdit::setInactiveText(const QString &text)
{
m_inactiveText = text;
}
void LineEdit::paintEvent(QPaintEvent* event)
{
QLineEdit::paintEvent(event);
if (text().isEmpty() && !m_inactiveText.isEmpty() && !hasFocus()) {
QStyleOptionFrameV2 panel;
initStyleOption(&panel);
QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
int horizontalMargin = 2;
textRect.adjust(horizontalMargin, 0, 0, 0);
int left = textMargin(LineEdit::LeftSide);
int right = textMargin(LineEdit::RightSide);
textRect.adjust(left, 0, -right, 0);
QPainter painter(this);
painter.setPen(palette().brush(QPalette::Disabled, QPalette::Text).color());
painter.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, m_inactiveText);
}
}

View File

@ -48,7 +48,7 @@ class SideWidget;
class QT_QUPZILLA_EXPORT LineEdit : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(QString inactiveText READ inactiveText WRITE setInactiveText)
Q_PROPERTY(int leftMargin READ leftMargin WRITE setLeftMargin)
public:
enum WidgetPosition {
@ -64,14 +64,11 @@ public:
void setWidgetSpacing(int spacing);
int widgetSpacing() const;
int textMargin(WidgetPosition position) const;
QString inactiveText() const;
void setInactiveText(const QString &text);
void paintEvent(QPaintEvent* event);
void setLeftMargin(int margin);
int leftMargin() { return m_leftMargin; }
public slots:
void setLeftMargin(int margin);
void updateTextMargins();
protected:
@ -87,7 +84,7 @@ private:
QHBoxLayout* m_leftLayout;
QHBoxLayout* m_rightLayout;
QHBoxLayout* mainLayout;
QString m_inactiveText;
int m_leftMargin;
};

View File

@ -38,15 +38,15 @@
* these functions will simply not do anything.
*/
#ifdef Q_WS_WIN
#ifdef W7API
#include <ShlObj.h>
#include <shlwapi.h>
#include <Propvarutil.h>
#include "msvc2008.h"
DEFINE_PROPERTYKEY(PKEY_Title, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2);
DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDestListSeparator, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 6);
#endif
#ifdef W7API
#include <ShlObj.h>
#include <shlwapi.h>
#include <Propvarutil.h>
#include "msvc2008.h"
DEFINE_PROPERTYKEY(PKEY_Title, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2);
DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDestListSeparator, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 6);
#endif
#endif
class WindowNotifier;
class QT_QUPZILLA_EXPORT QtWin : public QObject

View File

@ -278,7 +278,7 @@ void MainApplication::loadSettings()
cssFile.close();
//resetting style sheet
//it seems the css properties of previous theme that was not setted
// in the new theme are applied to new theme! for this we reset all properties here!!
// in the new theme are applied to new theme! for this we reset all properties here!!
setStyleSheet("");
#ifdef Q_WS_X11
if (QFile(m_activeThemePath + "linux.css").exists()) {
@ -307,7 +307,7 @@ void MainApplication::loadSettings()
//RTL Support
//loading 'rtl.css' when layout is right to left!
if ( isRightToLeft() && QFile(m_activeThemePath + "rtl.css").exists()) {
if (isRightToLeft() && QFile(m_activeThemePath + "rtl.css").exists()) {
cssFile.setFileName(m_activeThemePath + "rtl.css");
cssFile.open(QFile::ReadOnly);
css.append(cssFile.readAll());

View File

@ -67,7 +67,7 @@ QSettings* Settings::globalSettings()
return s_settings;
}
QzSettings *Settings::staticSettings()
QzSettings* Settings::staticSettings()
{
return s_qzSettings;
}

View File

@ -51,7 +51,7 @@ CookieManager::CookieManager(QWidget* parent)
connect(ui->blackAdd, SIGNAL(clicked()), this, SLOT(addBlacklist()));
connect(ui->blackRemove, SIGNAL(clicked()), this, SLOT(removeBlacklist()));
ui->search->setInactiveText(tr("Search"));
ui->search->setPlaceholderText(tr("Search"));
ui->cookieTree->setDefaultItemShowMode(TreeWidget::ItemsCollapsed);
ui->cookieTree->sortItems(0, Qt::AscendingOrder);
ui->cookieTree->header()->setDefaultSectionSize(220);

View File

@ -66,12 +66,10 @@ LocationBar::LocationBar(QupZilla* mainClass)
//// not changed dynamically this create padding problems.
addWidget(m_siteIcon, LineEdit::LeftSide);
addWidget(down, LineEdit::RightSide);
addWidget(m_bookmarkIcon, LineEdit::RightSide);
addWidget(m_goIcon, LineEdit::RightSide);
addWidget(m_bookmarkIcon, LineEdit::RightSide);
addWidget(m_rssIcon, LineEdit::RightSide);
setWidgetSpacing(0);
addWidget(down, LineEdit::RightSide);
m_completer.setLocationBar(this);
connect(&m_completer, SIGNAL(showCompletion(QString)), this, SLOT(showCompletion(QString)));

View File

@ -48,15 +48,16 @@ PopupLocationBar::PopupLocationBar(QWidget* parent)
{
m_siteIcon = new PopupSiteIcon(this);
m_siteIcon->setIcon(qIconProvider->emptyWebIcon());
m_siteIcon->setFixedSize(20, 26);
m_siteIcon->setFixedSize(26, 26);
m_loadingAnimation = new QLabel(this);
QMovie* movie = new QMovie(":icons/other/progress.gif", QByteArray(), m_loadingAnimation);
m_loadingAnimation->setMovie(movie);
m_loadingAnimation->setFixedSize(20, 26);
addWidget(m_siteIcon, LineEdit::LeftSide);
addWidget(m_loadingAnimation, LineEdit::RightSide);
setWidgetSpacing(1);
setLeftMargin(20);
setFixedHeight(26);
setReadOnly(true);