Merge pull request #721 from kiwix/issue595

Fix Back & Forward button alignment for -reverse launch
This commit is contained in:
Kelson 2021-11-15 13:09:56 +01:00 committed by GitHub
commit 77d452e60e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 9 deletions

View File

@ -70,10 +70,13 @@ TopWidget QToolButton::menu-arrow {
image: none;
}
TopWidget QToolButton#backButton {
margin-left: 6px;
TopWidget QToolButton#leftHistoryButton {
margin-left: 4px;
}
TopWidget QToolButton#rightHistoryButton {
margin-right: 4px;
}
TopWidget QToolButton#fullScreenButton {
margin-right: 6px;

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -4,8 +4,8 @@
<file>icons/minimize.svg</file>
<file>icons/download.svg</file>
<file>icons/checkbox.svg</file>
<file>icons/back.svg</file>
<file>icons/forward.svg</file>
<file>icons/history-left.svg</file>
<file>icons/history-right.svg</file>
<file>icons/help.svg</file>
<file>icons/tick.svg</file>
<file>icons/menu.svg</file>

View File

@ -355,10 +355,18 @@ void KiwixApp::createAction()
CREATE_ACTION_SHORTCUT(OpenHomePageAction, gt("home-page"), QKeySequence(Qt::ALT + Qt::Key_Home));
CREATE_ACTION_ICON_SHORTCUT(HistoryBackAction, "back", gt("back"), QKeySequence(Qt::ALT + Qt::Key_Left));
if (QGuiApplication::isLeftToRight()) {
CREATE_ACTION_ICON_SHORTCUT(HistoryBackAction, "history-left", gt("back"), QKeySequence(Qt::ALT + Qt::Key_Left));
} else {
CREATE_ACTION_ICON_SHORTCUT(HistoryBackAction, "history-right", gt("back"), QKeySequence(Qt::ALT + Qt::Key_Right));
}
DISABLE_ACTION(HistoryBackAction);
CREATE_ACTION_ICON_SHORTCUT(HistoryForwardAction, "forward", gt("forward"), QKeySequence(Qt::ALT + Qt::Key_Right));
if (QGuiApplication::isLeftToRight()) {
CREATE_ACTION_ICON_SHORTCUT(HistoryForwardAction, "history-right", gt("forward"), QKeySequence(Qt::ALT + Qt::Key_Right));
} else {
CREATE_ACTION_ICON_SHORTCUT(HistoryForwardAction, "history-left", gt("forward"), QKeySequence(Qt::ALT + Qt::Key_Left));
}
DISABLE_ACTION(HistoryForwardAction);
CREATE_ACTION_ICON_SHORTCUT(PrintAction, "print", gt("print"), QKeySequence::Print);

View File

@ -17,7 +17,6 @@ TopWidget::TopWidget(QWidget *parent) :
KiwixApp::instance()->getTabWidget()->triggerWebPageAction(QWebEnginePage::Back);
});
addAction(back);
widgetForAction(back)->setObjectName("backButton"); // For CSS
QAction *forward = app->getAction(KiwixApp::HistoryForwardAction);
connect(forward, &QAction::triggered, [](){
@ -25,6 +24,15 @@ TopWidget::TopWidget(QWidget *parent) :
});
addAction(forward);
// For CSS
if (QGuiApplication::isLeftToRight()) {
widgetForAction(back)->setObjectName("leftHistoryButton");
widgetForAction(forward)->setObjectName("rightHistoryButton");
} else {
widgetForAction(forward)->setObjectName("leftHistoryButton");
widgetForAction(back)->setObjectName("rightHistoryButton");
}
addSeparator();
addWidget(&m_searchEntry);
@ -77,7 +85,7 @@ void TopWidget::handleWebActionEnabledChanged(QWebEnginePage::WebAction action,
void TopWidget::mousePressEvent(QMouseEvent *event) {
if(event->button() != Qt::LeftButton)
if (event->button() != Qt::LeftButton)
return;
m_cursorPos = event->globalPos() + frameGeometry().topLeft() - parentWidget()->frameGeometry().topLeft();
@ -86,7 +94,7 @@ void TopWidget::mousePressEvent(QMouseEvent *event) {
}
void TopWidget::mouseMoveEvent(QMouseEvent *event) {
if(event->timestamp() <= m_timestamp)
if (event->timestamp() <= m_timestamp)
return;
m_timestamp = event->timestamp();