From 829b457e77735deedac14b29a8fd8236388ff454 Mon Sep 17 00:00:00 2001 From: Kevin Hendricks Date: Thu, 18 Apr 2024 14:11:08 -0400 Subject: [PATCH] move tab focus fixes into ui files wherever possible --- src/Dialogs/EditTOC.cpp | 2 +- src/Dialogs/HeadingSelector.cpp | 7 - .../KeyboardShortcutsWidget.cpp | 3 - .../PreferenceWidgets/PluginWidget.cpp | 9 +- .../PreferenceWidgets/SpellCheckWidget.cpp | 13 -- src/Form_Files/EditTOC.ui | 24 +++ src/Form_Files/FindReplace.ui | 154 +++++++++++------- src/Form_Files/HeadingSelector.ui | 20 ++- src/Form_Files/PKeyboardShortcutsWidget.ui | 9 + src/Form_Files/PPluginWidget.ui | 114 +++++++++---- src/Form_Files/PSpellCheckWidget.ui | 44 ++++- src/MainUI/FindReplace.cpp | 16 +- src/main.cpp | 2 +- 13 files changed, 275 insertions(+), 142 deletions(-) diff --git a/src/Dialogs/EditTOC.cpp b/src/Dialogs/EditTOC.cpp index ba0c8d1ba3..7522311184 100644 --- a/src/Dialogs/EditTOC.cpp +++ b/src/Dialogs/EditTOC.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2016-2021 Kevin B. Hendricks, Stratford, Ontario, Canada +** Copyright (C) 2016-2024 Kevin B. Hendricks, Stratford, Ontario, Canada ** Copyright (C) 2013 Dave Heiland ** ** This file is part of Sigil. diff --git a/src/Dialogs/HeadingSelector.cpp b/src/Dialogs/HeadingSelector.cpp index 265a73c151..86da97b500 100644 --- a/src/Dialogs/HeadingSelector.cpp +++ b/src/Dialogs/HeadingSelector.cpp @@ -71,13 +71,6 @@ HeadingSelector::HeadingSelector(QSharedPointer book, QWidget *parent) PopulateSelectHeadingCombo(GetMaxHeadingLevel(flat_headings)); RefreshTOCModelDisplay(); ReadSettings(); - ui.tvTOCDisplay->setFocusPolicy(Qt::StrongFocus); - ui.rename->setFocusPolicy(Qt::StrongFocus); - ui.bleft->setFocusPolicy(Qt::StrongFocus); - ui.bright->setFocusPolicy(Qt::StrongFocus); - ui.cbTOCItemsOnly->setFocusPolicy(Qt::StrongFocus); - ui.cbTOCSetHeadingLevel->setFocusPolicy(Qt::StrongFocus); - ui.buttonBox->setFocusPolicy(Qt::StrongFocus); } diff --git a/src/Dialogs/PreferenceWidgets/KeyboardShortcutsWidget.cpp b/src/Dialogs/PreferenceWidgets/KeyboardShortcutsWidget.cpp index 1f22ec162b..8455ada0f7 100644 --- a/src/Dialogs/PreferenceWidgets/KeyboardShortcutsWidget.cpp +++ b/src/Dialogs/PreferenceWidgets/KeyboardShortcutsWidget.cpp @@ -49,9 +49,6 @@ KeyboardShortcutsWidget::KeyboardShortcutsWidget() ui.setupUi(this); connectSignalsSlots(); readSettings(); - ui.resetAllButton->setFocusPolicy(Qt::ClickFocus); - ui.assignButton->setFocusPolicy(Qt::StrongFocus); - ui.removeButton->setFocusPolicy(Qt::StrongFocus); } PreferencesWidget::ResultActions KeyboardShortcutsWidget::saveSettings() diff --git a/src/Dialogs/PreferenceWidgets/PluginWidget.cpp b/src/Dialogs/PreferenceWidgets/PluginWidget.cpp index 792d4a21df..6174c045aa 100644 --- a/src/Dialogs/PreferenceWidgets/PluginWidget.cpp +++ b/src/Dialogs/PreferenceWidgets/PluginWidget.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2015-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2015-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -57,14 +57,7 @@ PluginWidget::PluginWidget() m_qlcbxs.append(ui.comboBox_9); m_qlcbxs.append(ui.comboBox_10); - ui.pluginTabWidget->setFocusPolicy(Qt::StrongFocus); - foreach(QComboBox* cb, m_qlcbxs) { - cb->setFocusPolicy(Qt::StrongFocus); - } ui.pluginTable->setTabKeyNavigation(false); - ui.addButton->setFocusPolicy(Qt::StrongFocus); - ui.removeButton->setFocusPolicy(Qt::StrongFocus); - ui.removeAllButton->setFocusPolicy(Qt::StrongFocus); readSettings(); connectSignalsToSlots(); } diff --git a/src/Dialogs/PreferenceWidgets/SpellCheckWidget.cpp b/src/Dialogs/PreferenceWidgets/SpellCheckWidget.cpp index e20432c6fe..8f6fc8a60a 100644 --- a/src/Dialogs/PreferenceWidgets/SpellCheckWidget.cpp +++ b/src/Dialogs/PreferenceWidgets/SpellCheckWidget.cpp @@ -45,19 +45,6 @@ SpellCheckWidget::SpellCheckWidget() setUpTable(); readSettings(); connectSignalsToSlots(); - ui.dictionaries->setFocusPolicy(Qt::StrongFocus); - ui.dictionaries2d->setFocusPolicy(Qt::StrongFocus); - ui.HighlightMisspelled->setFocusPolicy(Qt::StrongFocus); - ui.CheckNumbers->setFocusPolicy(Qt::StrongFocus); - ui.spellTabWidget->setFocusPolicy(Qt::StrongFocus); - ui.addUserDict->setFocusPolicy(Qt::StrongFocus); - ui.renameUserDict->setFocusPolicy(Qt::StrongFocus); - ui.copyUserDict->setFocusPolicy(Qt::StrongFocus); - ui.removeUserDict->setFocusPolicy(Qt::StrongFocus); - ui.addUserWords->setFocusPolicy(Qt::StrongFocus); - ui.editWord->setFocusPolicy(Qt::StrongFocus); - ui.removeWord->setFocusPolicy(Qt::StrongFocus); - ui.removeAll->setFocusPolicy(Qt::StrongFocus); } void SpellCheckWidget::setUpTable() diff --git a/src/Form_Files/EditTOC.ui b/src/Form_Files/EditTOC.ui index 91fa4f5c20..0e87dd9f5a 100644 --- a/src/Form_Files/EditTOC.ui +++ b/src/Form_Files/EditTOC.ui @@ -54,6 +54,9 @@ Add Above + + Qt::StrongFocus + @@ -64,6 +67,9 @@ Add Below + + Qt::StrongFocus + @@ -74,6 +80,9 @@ Delete + + Qt::StrongFocus + @@ -84,6 +93,9 @@ Select Target + + Qt::StrongFocus + @@ -116,6 +128,9 @@ You can also use the left arrow key. Qt::LeftArrow + + Qt::StrongFocus + @@ -128,6 +143,9 @@ You can also use the left arrow key. Qt::UpArrow + + Qt::StrongFocus + @@ -138,6 +156,9 @@ You can also use the left arrow key. Qt::DownArrow + + Qt::StrongFocus + @@ -154,6 +175,9 @@ You can also use the right arrow key. Qt::RightArrow + + Qt::StrongFocus + diff --git a/src/Form_Files/FindReplace.ui b/src/Form_Files/FindReplace.ui index 5b3728bd70..24625c8b7b 100644 --- a/src/Form_Files/FindReplace.ui +++ b/src/Form_Files/FindReplace.ui @@ -7,7 +7,7 @@ 0 0 566 - 93 + 127 @@ -23,7 +23,7 @@ 0 - + 0 @@ -38,7 +38,7 @@ 0 - + 0 @@ -122,6 +122,9 @@ + + Qt::StrongFocus + true @@ -150,22 +153,24 @@ 22 - - Find + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Find</b></p> <p style="margin-left: 0.5em;">Find next match.</p> - - - :/main/find.svg:/main/find.svg - - + + Find + + + + :/main/find.svg:/main/find.svg + @@ -182,8 +187,8 @@ 22 - - Replace + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Replace</b></p> @@ -193,10 +198,12 @@ + + Replace + - - :/main/replace.svg:/main/replace.svg - + + :/main/replace.svg:/main/replace.svg @@ -214,8 +221,8 @@ 22 - - Restart + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Restart</b></p> @@ -225,10 +232,12 @@ + + Restart + - - :/main/restart.svg:/main/restart.svg - + + :/main/restart.svg:/main/restart.svg @@ -244,6 +253,9 @@ + + Qt::StrongFocus + true @@ -272,8 +284,8 @@ 22 - - Replace/Find + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Replace/Find</b></p> @@ -284,10 +296,12 @@ then find the Next match in Code View.</p> + + Replace/Find + - - :/main/replace-find.svg:/main/replace-find.svg - + + :/main/replace-find.svg:/main/replace-find.svg @@ -305,8 +319,8 @@ then find the Next match in Code View.</p> 22 - - Replace All + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Replace All</b></p> @@ -317,10 +331,12 @@ then find the Next match in Code View.</p> + + Replace All + - - :/main/replace-all.svg:/main/replace-all.svg - + + :/main/replace-all.svg:/main/replace-all.svg @@ -338,8 +354,8 @@ then find the Next match in Code View.</p> 22 - - Count All + + Qt::StrongFocus <p style="padding-top: 0.5em;" ><b>Count All</b></p> @@ -350,10 +366,12 @@ then find the Next match in Code View.</p> + + Count All + - - :/main/count-all.svg:/main/count-all.svg - + + :/main/count-all.svg:/main/count-all.svg @@ -368,18 +386,34 @@ then find the Next match in Code View.</p> - + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + @@ -401,7 +435,7 @@ then find the Next match in Code View.</p> Regex Valid? - + @@ -416,9 +450,12 @@ then find the Next match in Code View.</p> - + + + Qt::StrongFocus + Set advanced Regex search flags / options. @@ -430,14 +467,17 @@ then find the Next match in Code View.</p> - + - - Search from current position to top or end of the + + Qt::StrongFocus + + + Search from current position to top or end of the current file and then wrap to the other end to continue searching. @@ -449,14 +489,17 @@ other end to continue searching. - + + + Qt::StrongFocus + - Search only in text (outside tags). + Search only in text (outside tags). Valid only when searching HTML files. @@ -467,7 +510,7 @@ Valid only when searching HTML files. - + @@ -488,7 +531,6 @@ Valid only when searching HTML files. - 75 true @@ -506,6 +548,13 @@ Valid only when searching HTML files. + + + PasteTargetComboBox + QComboBox +
Misc/PasteTargetComboBox.h
+
+
cbFind cbReplace @@ -523,13 +572,6 @@ Valid only when searching HTML files. count close - - - PasteTargetComboBox - QComboBox -
Misc/PasteTargetComboBox.h
-
-
diff --git a/src/Form_Files/HeadingSelector.ui b/src/Form_Files/HeadingSelector.ui index d4f7213fd8..37e4ad9d77 100644 --- a/src/Form_Files/HeadingSelector.ui +++ b/src/Form_Files/HeadingSelector.ui @@ -48,6 +48,9 @@ + + Qt::StrongFocus + Change the name of the entry in the TOC. The heading's title attribute will be updated in the document. @@ -77,6 +80,9 @@ The heading's title attribute will be updated in the document. + + Qt::StrongFocus + Decrease the heading level of the selected entry by 1. The heading's tag will be updated in the document. @@ -92,6 +98,9 @@ You can also use the left arrow key. + + Qt::StrongFocus + Increase the heading level of the selected entry by 1. The heading's tag will be updated in the document. @@ -126,6 +135,9 @@ You can also use the right arrow key. + + Qt::StrongFocus + Only display the items that will be added to the Table Of Contents. Check or uncheck an entry to determine if it will be added to the TOC. @@ -147,7 +159,7 @@ Check or uncheck an entry to determine if it will be added to the TOC. - Qt::ClickFocus + Qt::StrongFocus Quickly mark which headings are included in the TOC. @@ -172,8 +184,8 @@ You can then check or uncheck individual headings in the list above. - - + + tvTOCDisplay rename bleft @@ -181,7 +193,7 @@ You can then check or uncheck individual headings in the list above. cbTOCItemsOnly cbTOCSetHeadingLevel buttonBox - + diff --git a/src/Form_Files/PKeyboardShortcutsWidget.ui b/src/Form_Files/PKeyboardShortcutsWidget.ui index 0438b7898e..f1ce5041a0 100755 --- a/src/Form_Files/PKeyboardShortcutsWidget.ui +++ b/src/Form_Files/PKeyboardShortcutsWidget.ui @@ -101,6 +101,9 @@ + + Qt::StrongFocus + Enable AltGr on international keyboard @@ -144,6 +147,9 @@ 0
+ + Qt::StrongFocus + Assign this keyboard shortcut, overriding any conflicting usages. @@ -163,6 +169,9 @@ false + + Qt::StrongFocus + Remove this keyboard shortcut. diff --git a/src/Form_Files/PPluginWidget.ui b/src/Form_Files/PPluginWidget.ui index bb2c9b7d2b..9d65b17964 100644 --- a/src/Form_Files/PPluginWidget.ui +++ b/src/Form_Files/PPluginWidget.ui @@ -100,6 +100,9 @@ + + Qt::StrongFocus + 0 @@ -200,6 +203,9 @@ + + Qt::StrongFocus + Add Plugin @@ -207,6 +213,9 @@ + + Qt::StrongFocus + Remove Plugin @@ -214,6 +223,9 @@ + + Qt::StrongFocus + Remove All @@ -264,34 +276,74 @@ - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + - + + + Qt::StrongFocus + + @@ -406,27 +458,27 @@ - chkUseBundled - editPathPy3 - Py3Auto - Py3Set - pluginTabWidget - plugManageTab - pluginTable - addButton - removeButton - removeAllButton - plugShorcutsTab - comboBox - comboBox_2 - comboBox_3 - comboBox_4 - comboBox_5 - comboBox_6 - comboBox_7 - comboBox_8 - comboBox_9 - comboBox_10 + chkUseBundled + editPathPy3 + Py3Auto + Py3Set + pluginTabWidget + plugManageTab + pluginTable + addButton + removeButton + removeAllButton + plugShorcutsTab + comboBox + comboBox_2 + comboBox_3 + comboBox_4 + comboBox_5 + comboBox_6 + comboBox_7 + comboBox_8 + comboBox_9 + comboBox_10 diff --git a/src/Form_Files/PSpellCheckWidget.ui b/src/Form_Files/PSpellCheckWidget.ui index 9503c0abfe..c00648ed16 100644 --- a/src/Form_Files/PSpellCheckWidget.ui +++ b/src/Form_Files/PSpellCheckWidget.ui @@ -7,7 +7,7 @@ 0 0 550 - 436 + 449
@@ -15,7 +15,6 @@ - @@ -32,6 +31,9 @@ 0
+ + Qt::StrongFocus + @@ -62,6 +64,9 @@ 0
+ + Qt::StrongFocus + @@ -79,6 +84,9 @@ + + Qt::StrongFocus + Highlight misspelled words in Code View. @@ -102,6 +110,9 @@ + + Qt::StrongFocus + Check words with numbers in them. @@ -172,8 +183,11 @@ + + Qt::StrongFocus + - 0 + 1 @@ -186,6 +200,9 @@ + + Qt::StrongFocus + Add @@ -193,6 +210,9 @@ + + Qt::StrongFocus + Rename @@ -200,6 +220,9 @@ + + Qt::StrongFocus + Copy @@ -207,6 +230,9 @@ + + Qt::StrongFocus + Remove the selected dictionary. @@ -287,6 +313,9 @@ and to make it the default dictionary. + + Qt::StrongFocus + Enter or paste words to add to the dictionary. Words can be separated by lines, commas, or spaces. @@ -298,6 +327,9 @@ Words can be separated by lines, commas, or spaces. + + Qt::StrongFocus + Edit @@ -305,6 +337,9 @@ Words can be separated by lines, commas, or spaces. + + Qt::StrongFocus + Remove @@ -312,6 +347,9 @@ Words can be separated by lines, commas, or spaces. + + Qt::StrongFocus + Remove All diff --git a/src/MainUI/FindReplace.cpp b/src/MainUI/FindReplace.cpp index 76b2ed9c6a..2df29ca84f 100644 --- a/src/MainUI/FindReplace.cpp +++ b/src/MainUI/FindReplace.cpp @@ -84,7 +84,7 @@ FindReplace::FindReplace(MainWindow *main_window) m_StartingResource(nullptr), m_StartingPos(-1), m_InRemainder(false), - m_RestartPerformed(false), + m_SearchRunning(false), m_DryRunRunning(false), m_ShiftUsed(false), @@ -113,20 +113,6 @@ FindReplace::FindReplace(MainWindow *main_window) ShowHideMarkedText(false); ReadSettings(); m_PreviousSearch.clear(); - ui.cbFind->setFocusPolicy(Qt::StrongFocus); - ui.findNext->setFocusPolicy(Qt::StrongFocus); - ui.replaceCurrent->setFocusPolicy(Qt::StrongFocus); - ui.restart->setFocusPolicy(Qt::StrongFocus); - ui.cbReplace->setFocusPolicy(Qt::StrongFocus); - ui.replaceFind->setFocusPolicy(Qt::StrongFocus); - ui.replaceAll->setFocusPolicy(Qt::StrongFocus); - ui.count->setFocusPolicy(Qt::StrongFocus); - ui.cbSearchMode->setFocusPolicy(Qt::StrongFocus); - ui.cbLookWhere->setFocusPolicy(Qt::StrongFocus); - ui.cbSearchDirection->setFocusPolicy(Qt::StrongFocus); - ui.tbRegexOptions->setFocusPolicy(Qt::StrongFocus); - ui.chkOptionWrap->setFocusPolicy(Qt::StrongFocus); - ui.chkOptionTextOnly->setFocusPolicy(Qt::StrongFocus); } diff --git a/src/main.cpp b/src/main.cpp index 8423e44713..a390eacd1a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -98,7 +98,7 @@ const QString FOCUS_HIGHLIGHT_QSS = "QTableWidget:focus, QTreeWidget:focus, QLineEdit:focus, " "QPlainTextEdit:focus, QTextEdit:focus,QTreeView::focus, " "QTabWidget:focus, QListView:focus, QScrollArea:focus, " - "QToolButton:focus, QPushButton:focus, QTabBar:focus { " + "QToolButton:focus, QTabBar:focus { " " border: 1px solid HIGHLIGHT_COLOR;" "}"; #else