mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Merge pull request #721 from kiwix/issue595
Fix Back & Forward button alignment for -reverse launch
This commit is contained in:
commit
77d452e60e
@ -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;
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user