From fde6144791e55b44fdd4d2b8f81bd7ab4d834ff9 Mon Sep 17 00:00:00 2001 From: Kevin Hendricks Date: Thu, 18 Apr 2024 17:00:18 -0400 Subject: [PATCH] more places to fix unspecified FocusPolicy on Buttons and CB --- src/Dialogs/CPCompare.cpp | 3 ++- src/Dialogs/CPCompare.h | 2 +- src/Dialogs/ListSelector.h | 4 +++- src/Dialogs/ManageRepos.cpp | 2 +- src/Dialogs/ManageRepos.h | 4 +--- src/Dialogs/MetaEditorItemDelegate.cpp | 3 ++- src/Dialogs/SelectCharacter.cpp | 3 ++- src/Dialogs/ViewAV.cpp | 1 + src/Dialogs/ViewFont.cpp | 3 ++- src/Dialogs/ViewImage.cpp | 3 ++- src/Tabs/WellFormedCheckComponent.cpp | 2 +- src/Tabs/WellFormedCheckComponent.h | 1 + src/Widgets/Navigator.h | 10 +++++++++- src/Widgets/Navigator2.h | 7 ++++++- 14 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/Dialogs/CPCompare.cpp b/src/Dialogs/CPCompare.cpp index 60d3660620..eb2b4f60f5 100644 --- a/src/Dialogs/CPCompare.cpp +++ b/src/Dialogs/CPCompare.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -84,6 +84,7 @@ CPCompare::CPCompare(const QString& bookroot, setWindowTitle(tr("Results of Comparison")); m_bp->setText(tr("Done")); m_bp->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); QHBoxLayout *hl = new QHBoxLayout(); hl->addWidget(m_dlist); hl->addWidget(m_alist); diff --git a/src/Dialogs/CPCompare.h b/src/Dialogs/CPCompare.h index 09ae711039..4986e59868 100644 --- a/src/Dialogs/CPCompare.h +++ b/src/Dialogs/CPCompare.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** diff --git a/src/Dialogs/ListSelector.h b/src/Dialogs/ListSelector.h index 564c784267..b40017c28f 100644 --- a/src/Dialogs/ListSelector.h +++ b/src/Dialogs/ListSelector.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -48,6 +48,8 @@ class ListSelector : public QWidget m_bp->setToolTip(tr("View selected")); m_bp->setText(btext); m_bp->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); + m_lw->setFocusPolicy(Qt::StrongFocus); QStringList sortedlist = Utility::LocaleAwareSort(alist); foreach(QString aitem, sortedlist) { m_lw->addItem(aitem); diff --git a/src/Dialogs/ManageRepos.cpp b/src/Dialogs/ManageRepos.cpp index 541a5acb1f..40b4b16b45 100644 --- a/src/Dialogs/ManageRepos.cpp +++ b/src/Dialogs/ManageRepos.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** diff --git a/src/Dialogs/ManageRepos.h b/src/Dialogs/ManageRepos.h index c6cc14c378..f2653baa5a 100644 --- a/src/Dialogs/ManageRepos.h +++ b/src/Dialogs/ManageRepos.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -27,8 +27,6 @@ #include "ui_ManageRepos.h" -class QComboBox; - class ManageRepos : public QDialog { Q_OBJECT diff --git a/src/Dialogs/MetaEditorItemDelegate.cpp b/src/Dialogs/MetaEditorItemDelegate.cpp index 6a4bda0450..1d15e1e5d5 100644 --- a/src/Dialogs/MetaEditorItemDelegate.cpp +++ b/src/Dialogs/MetaEditorItemDelegate.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2021 Kevin B. Hendricks, Stratford Ontario Canada +** Copyright (C) 2021-2024 Kevin B. Hendricks, Stratford Ontario Canada ** Copyright (C) 2011-2012 John Schember ** Copyright (C) 2012 Dave Heiland ** Copyright (C) 2009-2011 Strahinja Markovic @@ -60,6 +60,7 @@ QWidget *MetaEditorItemDelegate::createEditor(QWidget *parent, const QStyleOptio if (!choices.isEmpty()) { // Create the combobox and populate it QComboBox *cb = new QComboBox(parent); + cb->setFocusPolicy(Qt::StrongFocus); foreach(QString opt, choices) { QStringList parts = opt.split(_GS); cb->addItem(parts.at(0), QVariant(parts.at(1))); diff --git a/src/Dialogs/SelectCharacter.cpp b/src/Dialogs/SelectCharacter.cpp index a40b4dd63f..b421d92d70 100644 --- a/src/Dialogs/SelectCharacter.cpp +++ b/src/Dialogs/SelectCharacter.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2018-2021 Kevin B. Hendricks, Stratford, ON Canada +** Copyright (C) 2018-2024 Kevin B. Hendricks, Stratford, ON Canada ** Copyright (C) 2012 John Schember ** Copyright (C) 2012 Dave Heiland ** @@ -376,6 +376,7 @@ void SelectCharacter::AddGrid(const QStringList &characters, int width) button->setToolTip(entity + " " + description); button->setText(display_text); button->setFont(font); + button->setFocusPolicy(Qt::StrongFocus); connect(button, SIGNAL(clicked()), m_buttonMapper, SLOT(map())); m_buttonMapper->setMapping(button, insert_text); grid->addWidget(button, row, col); diff --git a/src/Dialogs/ViewAV.cpp b/src/Dialogs/ViewAV.cpp index 341165284b..997437191a 100644 --- a/src/Dialogs/ViewAV.cpp +++ b/src/Dialogs/ViewAV.cpp @@ -52,6 +52,7 @@ ViewAV::ViewAV(QWidget *parent) m_bp->setToolTip(tr("Close this window")); m_bp->setText(tr("Done")); m_bp->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); QHBoxLayout* hl = new QHBoxLayout(); hl->addStretch(0); hl->addWidget(m_bp); diff --git a/src/Dialogs/ViewFont.cpp b/src/Dialogs/ViewFont.cpp index de640b28c8..28c36941a3 100644 --- a/src/Dialogs/ViewFont.cpp +++ b/src/Dialogs/ViewFont.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks + ** Copyright (C) 2020-2024 Kevin B. Hendricks ** ** This file is part of Sigil. ** @@ -46,6 +46,7 @@ ViewFont::ViewFont(QWidget *parent) m_bp->setToolTip(tr("Close this window")); m_bp->setText(tr("Done")); m_bp->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); QHBoxLayout* hl = new QHBoxLayout(); hl->addStretch(0); hl->addWidget(m_bp); diff --git a/src/Dialogs/ViewImage.cpp b/src/Dialogs/ViewImage.cpp index ed1ca86205..992d433e2f 100644 --- a/src/Dialogs/ViewImage.cpp +++ b/src/Dialogs/ViewImage.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2019-2020 Kevin B. Hendricks +** Copyright (C) 2019-2024 Kevin B. Hendricks ** Copyright (C) 2013 Dave Heiland ** ** This file is part of Sigil. @@ -50,6 +50,7 @@ ViewImage::ViewImage(QWidget *parent, bool delete_on_close) m_bp->setToolTip(tr("Close this window")); m_bp->setText(tr("Done")); m_bp->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); QHBoxLayout* hl = new QHBoxLayout(); hl->addStretch(0); hl->addWidget(m_bp); diff --git a/src/Tabs/WellFormedCheckComponent.cpp b/src/Tabs/WellFormedCheckComponent.cpp index 8bd0480f18..875ea097b8 100644 --- a/src/Tabs/WellFormedCheckComponent.cpp +++ b/src/Tabs/WellFormedCheckComponent.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2015-2019 Kevin B. Hendricks, Stratford Ontario Canada +** Copyright (C) 2015-2024 Kevin B. Hendricks, Stratford Ontario Canada ** Copyright (C) 2009-2011 Strahinja Markovic ** ** This file is part of Sigil. diff --git a/src/Tabs/WellFormedCheckComponent.h b/src/Tabs/WellFormedCheckComponent.h index 3127fc93fc..77758ad045 100644 --- a/src/Tabs/WellFormedCheckComponent.h +++ b/src/Tabs/WellFormedCheckComponent.h @@ -1,5 +1,6 @@ /************************************************************************ ** +** Copyright (C) 2024 Kevin B. Hendricks, Stratford, Ontario Canada ** Copyright (C) 2009-2011 Strahinja Markovic ** ** This file is part of Sigil. diff --git a/src/Widgets/Navigator.h b/src/Widgets/Navigator.h index 057a95a6d0..7598daa4e4 100644 --- a/src/Widgets/Navigator.h +++ b/src/Widgets/Navigator.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -54,12 +54,14 @@ class Navigator : public QWidget m_bp->setIcon(QIcon(":/main/back.svg")); m_bp->setToolTip(tr("Go to previous change - [p]")); m_bp->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_bp, r, 0); // next change m_bn->setIcon(QIcon(":/main/forward.svg")); m_bn->setToolTip(tr("Go to next change - [n]")); m_bn->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_bn->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_bn, r, 1); // search field @@ -70,12 +72,14 @@ class Navigator : public QWidget m_sn->setIcon(QIcon(":/main/arrow-down.svg")); m_sn->setToolTip(tr("Find Next")); m_sn->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_sn->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_sn, r, 3); // find previous m_sp->setIcon(QIcon(":/main/arrow-up.svg")); m_sp->setToolTip(tr("Find Previous")); m_sp->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_sp->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_sp, r, 4); // left panel @@ -90,8 +94,12 @@ class Navigator : public QWidget m_done->setToolTip(tr("Close this window")); m_done->setText(tr("Done")); m_done->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_done->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_done, r, 7); + m_lb->setFocusPolicy(Qt::StrongFocus); + m_rb->setFocusPolicy(Qt::StrongFocus); + connect(m_bp, SIGNAL(clicked()), this, SLOT(do_prev_change())); connect(m_bn, SIGNAL(clicked()), this, SLOT(do_next_change())); connect(m_search, SIGNAL(returnPressed()), this, SLOT(do_search())); diff --git a/src/Widgets/Navigator2.h b/src/Widgets/Navigator2.h index 060f1e80d3..bc6d46a227 100644 --- a/src/Widgets/Navigator2.h +++ b/src/Widgets/Navigator2.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario Canada + ** Copyright (C) 2020-2024 Kevin B. Hendricks, Stratford Ontario Canada ** ** This file is part of Sigil. ** @@ -52,6 +52,7 @@ class Navigator2 : public QWidget m_bp->setIcon(QIcon(":/main/back.svg")); m_bp->setToolTip(tr("Go to previous page - [p]")); m_bp->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_bp->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_bp, r, c); c++; @@ -59,6 +60,7 @@ class Navigator2 : public QWidget m_bn->setIcon(QIcon(":/main/forward.svg")); m_bn->setToolTip(tr("Go to next page - [n]")); m_bn->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_bn->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_bn, r, c); c++; @@ -71,6 +73,7 @@ class Navigator2 : public QWidget m_sn->setIcon(QIcon(":/main/arrow-down.svg")); m_sn->setToolTip(tr("Find Next")); m_sn->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_sn->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_sn, r, c); c++; @@ -78,6 +81,7 @@ class Navigator2 : public QWidget m_sp->setIcon(QIcon(":/main/arrow-up.svg")); m_sp->setToolTip(tr("Find Previous")); m_sp->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_sp->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_sp, r, c); c++; @@ -85,6 +89,7 @@ class Navigator2 : public QWidget m_done->setToolTip(tr("Close this window")); m_done->setText(tr("Done")); m_done->setToolButtonStyle(Qt::ToolButtonTextOnly); + m_done->setFocusPolicy(Qt::StrongFocus); m_layout->addWidget(m_done, r, c); connect(m_bp, SIGNAL(clicked()), this, SLOT(do_prev_page()));