diff --git a/src/Form_Files/FindReplace.ui b/src/Form_Files/FindReplace.ui index cc13f1a212..5b3728bd70 100644 --- a/src/Form_Files/FindReplace.ui +++ b/src/Form_Files/FindReplace.ui @@ -509,12 +509,12 @@ Valid only when searching HTML files. cbFind cbReplace - tbRegexOptions - chkOptionWrap - chkOptionTextOnly cbSearchMode cbLookWhere cbSearchDirection + tbRegexOptions + chkOptionWrap + chkOptionTextOnly findNext replaceFind replaceCurrent diff --git a/src/MainUI/MainWindow.cpp b/src/MainUI/MainWindow.cpp index bc813ed0b4..2ae31b6a29 100644 --- a/src/MainUI/MainWindow.cpp +++ b/src/MainUI/MainWindow.cpp @@ -6223,6 +6223,16 @@ void MainWindow::ExtendUI() ui.tbAutomate2->setDefaultAction(ui.actionAutomate2); ui.tbAutomate3->setDefaultAction(ui.actionAutomate3); +#if 1 + // use this code to disable any QToolButtons with pull down menus + // from inadvertantly being on the tab to shift focus chain + ui.tbHeadings->setFocusPolicy(Qt::ClickFocus); + ui.tbCase->setFocusPolicy(Qt::ClickFocus); + ui.tbAutomate1->setFocusPolicy(Qt::ClickFocus); + ui.tbAutomate2->setFocusPolicy(Qt::ClickFocus); + ui.tbAutomate3->setFocusPolicy(Qt::ClickFocus); +#endif + UpdateClipsUI(); } diff --git a/src/MainUI/PreviewWindow.cpp b/src/MainUI/PreviewWindow.cpp index aea5c9dc13..b61b0aa134 100644 --- a/src/MainUI/PreviewWindow.cpp +++ b/src/MainUI/PreviewWindow.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "MainUI/PreviewWindow.h" @@ -68,9 +69,15 @@ static const QString MATHJAX3_CONFIG = PreviewWindow::PreviewWindow(QWidget *parent) : QDockWidget(tr("Preview"), parent), - m_MainWidget(new QWidget(this)), + m_MainWidget(new QFrame(this)), + m_binspect(new QToolButton(m_MainWidget)), + m_bselect(new QToolButton(m_MainWidget)), + m_bcopy(new QToolButton(m_MainWidget)), + m_breload(new QToolButton(m_MainWidget)), + m_bcycle(new QToolButton(m_MainWidget)), + m_bprint(new QToolButton(m_MainWidget)), m_wrapper(new QWidget(m_MainWidget)), - m_Layout(new QVBoxLayout(m_MainWidget)), + m_Layout(new QVBoxLayout()), m_buttons(new QHBoxLayout()), m_overlayBase(new OverlayHelperWidget(this)), m_Preview(new ViewPreview(m_overlayBase)), @@ -92,7 +99,24 @@ PreviewWindow::PreviewWindow(QWidget *parent) SetupOverlayTimer(); LoadSettings(); ConnectSignalsToSlots(); - setFocusPolicy(Qt::StrongFocus); + setFocusProxy(m_MainWidget); + m_MainWidget->setFocusPolicy(Qt::StrongFocus); + m_wrapper->setFocusPolicy(Qt::NoFocus); + m_Preview->setFocusPolicy(Qt::StrongFocus); + + m_binspect->setFocusPolicy(Qt::StrongFocus); + m_bselect->setFocusPolicy(Qt::StrongFocus); + m_bcopy->setFocusPolicy(Qt::StrongFocus); + m_breload->setFocusPolicy(Qt::StrongFocus); + m_bcycle->setFocusPolicy(Qt::StrongFocus); + m_bprint->setFocusPolicy(Qt::StrongFocus); + + setTabOrder(m_binspect, m_bselect); + setTabOrder(m_bselect, m_bcopy); + setTabOrder(m_bcopy, m_breload); + setTabOrder(m_breload, m_bcycle); + setTabOrder(m_bcycle, m_bprint); + setTabOrder(m_bprint, m_Preview); } PreviewWindow::~PreviewWindow() @@ -238,43 +262,49 @@ void PreviewWindow::SetupView() // QWebEngineView events are routed to their parent m_Preview->installEventFilter(this); -#if 1 //!defined(Q_OS_WIN32) && !defined(Q_OS_MAC) - // this may be needed by all platforms in the future QWidget * fp = m_Preview->focusProxy(); if (fp) fp->installEventFilter(this); -#endif + + m_Layout->setContentsMargins(0, 0, 0, 0); // use a QWidget wrapper around the QWebEnginePreview // with a single pixel margin to use as focus indicator m_wrapper->setObjectName("PreviewWrapper"); m_wrapper->setFocusProxy(m_Preview); - // m_wrapper->setAttribute(Qt::WA_StyledBackground, true); QVBoxLayout * wl = new QVBoxLayout(m_wrapper); wl->setContentsMargins(1,1,1,1); wl->addWidget(m_Preview); - - m_Layout->setContentsMargins(0, 0, 0, 0); m_Layout->addWidget(m_wrapper); m_inspectAction = new QAction(QIcon(":/main/inspect.svg"),"", this); m_inspectAction ->setEnabled(true); m_inspectAction->setToolTip(tr("Inspect Page")); + m_binspect->setDefaultAction(m_inspectAction); + m_binspect->setAutoRaise(true); m_selectAction = new QAction(QIcon(":/main/edit-select-all.svg"),"", this); m_selectAction ->setEnabled(true); m_selectAction->setToolTip(tr("Select-All")); + m_bselect->setDefaultAction(m_selectAction); + m_bselect->setAutoRaise(true); m_copyAction = new QAction(QIcon(":/main/edit-copy.svg"),"", this); m_copyAction ->setEnabled(true); m_copyAction->setToolTip(tr("Copy Selection To ClipBoard")); + m_bcopy->setDefaultAction(m_copyAction); + m_bcopy->setAutoRaise(true); m_reloadAction = new QAction(QIcon(":/main/reload-page.svg"),"", this); m_reloadAction ->setEnabled(true); m_reloadAction->setToolTip(tr("Update Preview Window")); + m_breload->setDefaultAction(m_reloadAction); + m_breload->setAutoRaise(true); m_cycleCSSAction = new QAction(QIcon(":/main/cycle-css.svg"),"", this); m_cycleCSSAction ->setEnabled(false); m_cycleCSSAction->setToolTip(tr("Cycle Custom CSS Files")); + m_bcycle->setDefaultAction(m_cycleCSSAction); + m_bcycle->setAutoRaise(true); QIcon pricon; pricon.addFile(":/main/document-print.svg", QSize(), QIcon::Normal); @@ -282,19 +312,22 @@ void PreviewWindow::SetupView() m_webviewPrint = new QAction(pricon, "", this); m_webviewPrint ->setEnabled(true); m_webviewPrint->setToolTip(tr("Print Preview View")); - - QToolBar * tb = new QToolBar(); - tb->addAction(m_inspectAction); - tb->addAction(m_selectAction); - tb->addAction(m_copyAction); - tb->addAction(m_reloadAction); - tb->addAction(m_cycleCSSAction); - tb->addAction(m_webviewPrint); - tb->addWidget(m_progress); - - m_buttons->setContentsMargins(0,0,0,0); - m_buttons->addWidget(tb); + m_bprint->setDefaultAction(m_webviewPrint); + m_bprint->setAutoRaise(true); + + m_buttons->setContentsMargins(1,1,1,1); + m_buttons->addWidget(m_binspect); + m_buttons->addWidget(m_bselect); + m_buttons->addWidget(m_bcopy); + m_buttons->addWidget(m_breload); + m_buttons->addWidget(m_bcycle); + m_buttons->addWidget(m_bprint); + m_buttons->addWidget(m_progress); + m_Layout->addLayout(m_buttons); + + m_MainWidget->setLayout(m_Layout); + setWidget(m_MainWidget); QApplication::restoreOverrideCursor(); } diff --git a/src/MainUI/PreviewWindow.h b/src/MainUI/PreviewWindow.h index 770738c85a..f31ad1c332 100644 --- a/src/MainUI/PreviewWindow.h +++ b/src/MainUI/PreviewWindow.h @@ -44,6 +44,7 @@ class QHBoxLayout; class QProgressBar; class OverlayHelperWidget; class WebViewPrinter; +class QToolButton; class PreviewWindow : public QDockWidget { @@ -131,7 +132,13 @@ public slots: const QString titleText(); - QWidget *m_MainWidget; + QFrame *m_MainWidget; + QToolButton * m_binspect; + QToolButton * m_bselect; + QToolButton * m_bcopy; + QToolButton * m_breload; + QToolButton * m_bcycle; + QToolButton * m_bprint; QWidget *m_wrapper; QVBoxLayout *m_Layout; QHBoxLayout *m_buttons; @@ -164,6 +171,7 @@ public slots: bool m_skipPrintPreview; WebViewPrinter *m_WebViewPrinter; bool m_use_focus_highlight; + }; #endif // PREVIEWWINDOW_H diff --git a/src/ViewEditors/CodeViewEditor.cpp b/src/ViewEditors/CodeViewEditor.cpp index e2b00f1313..a73d8efab6 100644 --- a/src/ViewEditors/CodeViewEditor.cpp +++ b/src/ViewEditors/CodeViewEditor.cpp @@ -132,7 +132,13 @@ CodeViewEditor::CodeViewEditor(HighlighterType high_type, bool check_spelling, Q m_Highlighter = NULL; } - setFocusPolicy(Qt::StrongFocus); + + // if we use the following we can get instances + // of accidental insertion of tabs into CodeView + // when simply trying to shift focus + // setFocusPolicy(Qt::StrongFocus); + setFocusPolicy(Qt::ClickFocus); + ConnectSignalsToSlots(); SetAppearance(); }