Skip to content

Commit

Permalink
more places to fix unspecified FocusPolicy on Buttons and CB
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Apr 18, 2024
1 parent 9605b68 commit fde6144
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/Dialogs/CPCompare.cpp
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs/CPCompare.h
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down
4 changes: 3 additions & 1 deletion src/Dialogs/ListSelector.h
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs/ManageRepos.cpp
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down
4 changes: 1 addition & 3 deletions src/Dialogs/ManageRepos.h
Original file line number Diff line number Diff line change
@@ -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.
**
Expand All @@ -27,8 +27,6 @@

#include "ui_ManageRepos.h"

class QComboBox;

class ManageRepos : public QDialog
{
Q_OBJECT
Expand Down
3 changes: 2 additions & 1 deletion src/Dialogs/MetaEditorItemDelegate.cpp
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
** Copyright (C) 2012 Dave Heiland
** Copyright (C) 2009-2011 Strahinja Markovic <[email protected]>
Expand Down Expand Up @@ -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)));
Expand Down
3 changes: 2 additions & 1 deletion src/Dialogs/SelectCharacter.cpp
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
** Copyright (C) 2012 Dave Heiland
**
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Dialogs/ViewAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/Dialogs/ViewFont.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/************************************************************************
**
** Copyright (C) 2020-2021 Kevin B. Hendricks
** Copyright (C) 2020-2024 Kevin B. Hendricks
**
** This file is part of Sigil.
**
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/Dialogs/ViewImage.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Tabs/WellFormedCheckComponent.cpp
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
**
** This file is part of Sigil.
Expand Down
1 change: 1 addition & 0 deletions src/Tabs/WellFormedCheckComponent.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/************************************************************************
**
** Copyright (C) 2024 Kevin B. Hendricks, Stratford, Ontario Canada
** Copyright (C) 2009-2011 Strahinja Markovic <[email protected]>
**
** This file is part of Sigil.
Expand Down
10 changes: 9 additions & 1 deletion src/Widgets/Navigator.h
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()));
Expand Down
7 changes: 6 additions & 1 deletion src/Widgets/Navigator2.h
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down Expand Up @@ -52,13 +52,15 @@ 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++;

// next change
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++;

Expand All @@ -71,20 +73,23 @@ 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++;

// 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, c);
c++;

// done button
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()));
Expand Down

0 comments on commit fde6144

Please sign in to comment.