forked from qt-creator/qt-creator
Fix tab order in find toolbar
Explicitly add the options button to make sure that is at the correct position, and do not use multiple conflicting methods to specify tab order. This adds the various buttons back into the tab order. Fixes: QTCREATORBUG-30791 Change-Id: I5d1fbcd213b57bf4d7af98ba5d21b09e408e84b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -160,15 +160,6 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
|||||||
setProperty(StyleHelper::C_TOP_BORDER, true);
|
setProperty(StyleHelper::C_TOP_BORDER, true);
|
||||||
setSingleRow(false);
|
setSingleRow(false);
|
||||||
|
|
||||||
QWidget::setTabOrder(m_findEdit, m_replaceEdit);
|
|
||||||
QWidget::setTabOrder(m_replaceEdit, m_findPreviousButton);
|
|
||||||
QWidget::setTabOrder(m_findPreviousButton, m_findNextButton);
|
|
||||||
QWidget::setTabOrder(m_findNextButton, m_replaceButton);
|
|
||||||
QWidget::setTabOrder(m_replaceButton, m_replaceNextButton);
|
|
||||||
QWidget::setTabOrder(m_replaceNextButton, m_replaceAllButton);
|
|
||||||
QWidget::setTabOrder(m_replaceAllButton, m_advancedButton);
|
|
||||||
QWidget::setTabOrder(m_advancedButton, m_close);
|
|
||||||
|
|
||||||
connect(m_findEdit, &Utils::FancyLineEdit::editingFinished,
|
connect(m_findEdit, &Utils::FancyLineEdit::editingFinished,
|
||||||
this, &FindToolBar::invokeResetIncrementalSearch);
|
this, &FindToolBar::invokeResetIncrementalSearch);
|
||||||
connect(m_findEdit, &Utils::FancyLineEdit::textChanged,
|
connect(m_findEdit, &Utils::FancyLineEdit::textChanged,
|
||||||
@@ -447,6 +438,17 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
|||||||
connect(&m_findStepTimer, &QTimer::timeout, this, &FindToolBar::invokeFindStep);
|
connect(&m_findStepTimer, &QTimer::timeout, this, &FindToolBar::invokeFindStep);
|
||||||
|
|
||||||
setLightColoredIcon(isLightColored());
|
setLightColoredIcon(isLightColored());
|
||||||
|
|
||||||
|
QWidget::setTabOrder(m_findEdit->button(FancyLineEdit::Left), m_findEdit);
|
||||||
|
QWidget::setTabOrder(m_findEdit, m_replaceEdit);
|
||||||
|
QWidget::setTabOrder(m_replaceEdit, m_findPreviousButton);
|
||||||
|
QWidget::setTabOrder(m_findPreviousButton, m_findNextButton);
|
||||||
|
QWidget::setTabOrder(m_findNextButton, m_selectAllButton);
|
||||||
|
QWidget::setTabOrder(m_selectAllButton, m_replaceButton);
|
||||||
|
QWidget::setTabOrder(m_replaceButton, m_replaceNextButton);
|
||||||
|
QWidget::setTabOrder(m_replaceNextButton, m_replaceAllButton);
|
||||||
|
QWidget::setTabOrder(m_replaceAllButton, m_advancedButton);
|
||||||
|
QWidget::setTabOrder(m_advancedButton, m_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
FindToolBar::~FindToolBar() = default;
|
FindToolBar::~FindToolBar() = default;
|
||||||
@@ -1024,23 +1026,6 @@ void FindToolBar::selectAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindToolBar::focusNextPrevChild(bool next)
|
|
||||||
{
|
|
||||||
QAbstractButton *optionsButton = m_findEdit->button(Utils::FancyLineEdit::Left);
|
|
||||||
// close tab order
|
|
||||||
if (next && m_advancedButton->hasFocus())
|
|
||||||
optionsButton->setFocus(Qt::TabFocusReason);
|
|
||||||
else if (next && optionsButton->hasFocus())
|
|
||||||
m_findEdit->setFocus(Qt::TabFocusReason);
|
|
||||||
else if (!next && optionsButton->hasFocus())
|
|
||||||
m_advancedButton->setFocus(Qt::TabFocusReason);
|
|
||||||
else if (!next && m_findEdit->hasFocus())
|
|
||||||
optionsButton->setFocus(Qt::TabFocusReason);
|
|
||||||
else
|
|
||||||
return Utils::StyledBar::focusNextPrevChild(next);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FindToolBar::resizeEvent(QResizeEvent *event)
|
void FindToolBar::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
@@ -64,7 +64,6 @@ public slots:
|
|||||||
void setBackward(bool backward);
|
void setBackward(bool backward);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool focusNextPrevChild(bool next) override;
|
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user