mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[RTL Layout] Set layoutDirection of widgets with LTR contents to LTR, for having a better look.
- closes #971
This commit is contained in:
parent
4848def230
commit
d3cb32247a
@ -39,6 +39,14 @@ CookieManager::CookieManager(QWidget* parent)
|
||||
ui->setupUi(this);
|
||||
QzTools::centerWidgetOnScreen(this);
|
||||
|
||||
if (isRightToLeft()) {
|
||||
ui->cookieTree->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->cookieTree->headerItem()->setTextAlignment(1, Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->cookieTree->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->whiteList->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->blackList->setLayoutDirection(Qt::LeftToRight);
|
||||
}
|
||||
|
||||
// Stored Cookies
|
||||
connect(ui->cookieTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
|
||||
connect(ui->removeAll, SIGNAL(clicked()), this, SLOT(removeAll()));
|
||||
|
@ -293,8 +293,15 @@ void ClickToFlash::showInfo()
|
||||
widg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
widg->setWindowTitle(tr("Flash Object"));
|
||||
QFormLayout* lay = new QFormLayout(widg);
|
||||
QLabel* attrib = new QLabel(tr("<b>Attribute Name</b>"));
|
||||
QLabel* value = new QLabel(tr("<b>Value</b>"));
|
||||
if (isRightToLeft()) {
|
||||
widg->setLayoutDirection(Qt::LeftToRight);
|
||||
attrib->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
value->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
lay->addRow(new QLabel(tr("<b>Attribute Name</b>")), new QLabel(tr("<b>Value</b>")));
|
||||
lay->addRow(attrib, value);
|
||||
|
||||
int i = 0;
|
||||
foreach (const QString &name, m_argumentNames) {
|
||||
|
@ -73,6 +73,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
|
||||
, ui(new Ui::AcceptLanguage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->listWidget->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
Settings settings;
|
||||
settings.beginGroup("Language");
|
||||
@ -130,6 +131,7 @@ void AcceptLanguage::addLanguage()
|
||||
Ui_AddAcceptLanguage acceptLangUi;
|
||||
QDialog dialog(this);
|
||||
acceptLangUi.setupUi(&dialog);
|
||||
acceptLangUi.listWidget->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
QStringList allLanguages;
|
||||
for (int i = 1 + (int)QLocale::C; i <= (int)QLocale::LastLanguage; ++i) {
|
||||
|
@ -38,6 +38,13 @@ AutoFillManager::AutoFillManager(QWidget* parent)
|
||||
, m_passwordsShown(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if (isRightToLeft()) {
|
||||
ui->treePass->headerItem()->setTextAlignment(0, Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->treePass->headerItem()->setTextAlignment(1, Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->treePass->headerItem()->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter);
|
||||
ui->treePass->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->treeExcept->setLayoutDirection(Qt::LeftToRight);
|
||||
}
|
||||
|
||||
connect(ui->removePass, SIGNAL(clicked()), this, SLOT(removePass()));
|
||||
connect(ui->removeAllPass, SIGNAL(clicked()), this, SLOT(removeAllPass()));
|
||||
|
@ -35,10 +35,11 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
|
||||
|
||||
const QWidget* w = opt.widget;
|
||||
const QStyle* style = w ? w->style() : QApplication::style();
|
||||
const Qt::LayoutDirection direction = w ? w->layoutDirection() : QApplication::layoutDirection();
|
||||
const int height = opt.rect.height();
|
||||
const int center = height / 2 + opt.rect.top();
|
||||
|
||||
painter->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
// Prepare title font
|
||||
QFont titleFont = opt.font;
|
||||
titleFont.setBold(true);
|
||||
@ -63,19 +64,16 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
|
||||
QStyleOptionViewItemV4 opt2 = opt;
|
||||
opt2.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
|
||||
QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w);
|
||||
styleCheckBoxRect.setRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height());
|
||||
QRect visualCheckBoxRect = style->visualRect(direction, opt.rect, styleCheckBoxRect);
|
||||
opt2.rect = visualCheckBoxRect;
|
||||
opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height());
|
||||
style->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w);
|
||||
leftPosition = styleCheckBoxRect.right() + m_padding;
|
||||
leftPosition = opt2.rect.right() + m_padding;
|
||||
|
||||
// Draw icon
|
||||
const int iconSize = 32;
|
||||
const int iconYPos = center - (iconSize / 2);
|
||||
QRect iconRect(leftPosition, iconYPos, iconSize, iconSize);
|
||||
QRect visualIconRect = style->visualRect(direction, opt.rect, iconRect);
|
||||
QPixmap pixmap = index.data(Qt::DecorationRole).value<QIcon>().pixmap(iconSize);
|
||||
painter->drawPixmap(visualIconRect, pixmap);
|
||||
painter->drawPixmap(iconRect, pixmap);
|
||||
leftPosition = iconRect.right() + m_padding;
|
||||
|
||||
// Draw plugin name
|
||||
@ -84,9 +82,8 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
|
||||
const int rightTitleEdge = rightPosition - m_padding;
|
||||
const int leftPosForVersion = titleMetrics.width(name) + m_padding;
|
||||
QRect nameRect(leftTitleEdge, opt.rect.top() + m_padding, rightTitleEdge - leftTitleEdge, titleMetrics.height());
|
||||
QRect visualNameRect = style->visualRect(direction, opt.rect, nameRect);
|
||||
painter->setFont(titleFont);
|
||||
style->drawItemText(painter, visualNameRect, Qt::AlignLeft, opt.palette, true, name, colorRole);
|
||||
style->drawItemText(painter, nameRect, Qt::AlignLeft, opt.palette, true, name, colorRole);
|
||||
|
||||
// Draw version
|
||||
const QString &version = index.data(Qt::UserRole).toString();
|
||||
@ -98,7 +95,7 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
|
||||
|
||||
// Draw info
|
||||
const int infoYPos = nameRect.bottom() + opt.fontMetrics.leading();
|
||||
QRect infoRect(visualNameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height());
|
||||
QRect infoRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height());
|
||||
const QString &info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width());
|
||||
painter->setFont(opt.font);
|
||||
style->drawItemText(painter, infoRect, Qt::TextSingleLine | Qt::AlignLeft, opt.palette, true, info, colorRole);
|
||||
|
@ -34,6 +34,8 @@ PluginsManager::PluginsManager(QWidget* parent)
|
||||
, m_loaded(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->list->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->whitelist->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
//Application Extensions
|
||||
Settings settings;
|
||||
|
@ -64,6 +64,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
ui->languages->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
m_themesManager = new ThemeManager(ui->themesWidget, this);
|
||||
m_autoFillManager = new AutoFillManager(this);
|
||||
|
@ -31,6 +31,9 @@ SSLManager::SSLManager(QWidget* parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
ui->caList->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->localList->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->pathList->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
refreshLocalList();
|
||||
refreshCAList();
|
||||
|
@ -33,6 +33,7 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
|
||||
, m_preferences(preferences)
|
||||
{
|
||||
ui->setupUi(parent);
|
||||
ui->listWidget->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->license->hide();
|
||||
|
||||
Settings settings;
|
||||
|
@ -32,6 +32,8 @@ UserAgentDialog::UserAgentDialog(QWidget* parent)
|
||||
, m_manager(mApp->uaManager())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->globalComboBox->setLayoutDirection(Qt::LeftToRight);
|
||||
ui->table->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
const QString &os = QzTools::operatingSystem();
|
||||
m_knownUserAgents << QString("Opera/9.80 (%1) Presto/2.10.229 Version/11.61").arg(os)
|
||||
@ -182,6 +184,7 @@ bool UserAgentDialog::showEditDialog(const QString &title, QString* rSite, QStri
|
||||
QFormLayout* layout = new QFormLayout(dialog);
|
||||
QLineEdit* editSite = new QLineEdit(dialog);
|
||||
QComboBox* editAgent = new QComboBox(dialog);
|
||||
editAgent->setLayoutDirection(Qt::LeftToRight);
|
||||
editAgent->setEditable(true);
|
||||
editAgent->addItems(m_knownUserAgents);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user