mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
Fix focus when open settings page #LINQT-2208
This commit is contained in:
parent
433c479958
commit
db6e4f6ec5
7 changed files with 31 additions and 1 deletions
|
|
@ -30,6 +30,12 @@
|
|||
<extracomment>Back to previous menu</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Page/Form/Settings/AbstractSettingsMenu.qml" line="76"/>
|
||||
<source>settings_page_selection_accessible_name</source>
|
||||
<extracomment>Settings page selection</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AbstractWindow</name>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@
|
|||
<extracomment>Back to previous menu</extracomment>
|
||||
<translation>Back to previous menu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Page/Form/Settings/AbstractSettingsMenu.qml" line="76"/>
|
||||
<source>settings_page_selection_accessible_name</source>
|
||||
<extracomment>Settings page selection</extracomment>
|
||||
<translation>Settings page selection</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AbstractWindow</name>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@
|
|||
<extracomment>Back to previous menu</extracomment>
|
||||
<translation>Retour au menu précédent</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Page/Form/Settings/AbstractSettingsMenu.qml" line="76"/>
|
||||
<source>settings_page_selection_accessible_name</source>
|
||||
<extracomment>Settings page selection</extracomment>
|
||||
<translation>Selection de la page de paramètre</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AbstractWindow</name>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ FocusNavigator::FocusNavigator(QObject *parent) : QObject(parent) {
|
|||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
bool FocusNavigator::doesLastFocusWasKeyboard() {
|
||||
return m_lastFocusWasKeyboard;
|
||||
}
|
||||
|
||||
bool FocusNavigator::eventFilter(QObject *, QEvent *event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::FocusIn: {
|
||||
|
|
@ -45,6 +49,7 @@ bool FocusNavigator::eventFilter(QObject *, QEvent *event) {
|
|||
}
|
||||
|
||||
void FocusNavigator::onFocusObjectChanged(QObject *obj) {
|
||||
// qDebug() << "New focus object" << obj; // Usefull to debug focus problems
|
||||
auto item = qobject_cast<QQuickItem *>(obj);
|
||||
if (!item) return;
|
||||
emit focusChanged(item, m_lastFocusWasKeyboard);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class FocusNavigator : public QObject {
|
|||
|
||||
public:
|
||||
explicit FocusNavigator(QObject *parent = nullptr);
|
||||
Q_INVOKABLE bool doesLastFocusWasKeyboard();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Item {
|
|||
|
||||
//: %1 settings
|
||||
Accessible.name: qsTr("setting_tab_accessible_name").arg(titleText)
|
||||
Accessible.role: Accessible.ListItem
|
||||
|
||||
Keys.onPressed: (event)=>{
|
||||
if(event.key == Qt.Key_Space || event.key == Qt.Key_Return || event.key == Qt.Key_Enter){
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ AbstractMainPage {
|
|||
property int selectedIndex: mainItem.defaultIndex != -1 ? mainItem.defaultIndex : 0
|
||||
activeFocusOnTab: true
|
||||
spacing: Utils.getSizeWithScreenRatio(5)
|
||||
Accessible.role: Accessible.List
|
||||
//: Settings page selection
|
||||
Accessible.name: qsTr("settings_page_selection_accessible_name")
|
||||
|
||||
delegate: SettingsMenuItem {
|
||||
titleText: modelData.title
|
||||
|
|
@ -88,7 +91,9 @@ AbstractMainPage {
|
|||
let initialEntry = mainItem.families[familiesList.selectedIndex]
|
||||
rightPanelStackView.push(layoutUrl(initialEntry.layout), { titleText: initialEntry.title, model: initialEntry.model, container: rightPanelStackView})
|
||||
familiesList.currentIndex = familiesList.selectedIndex
|
||||
backButton.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
Control.StackView.onActivated: {
|
||||
familiesList.forceActiveFocus(FocusNavigator.doesLastFocusWasKeyboard() ? Qt.TabFocusReason : Qt.MouseFocusReason)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue