forked from qt-creator/qt-creator
Adapt find tool bar input fields to searched widget's font
Adapt the font of the search and replace input fields to the font of the widget that is searched. This makes it use the text editor font when searching in the text editor but keeps the "application font" when searching in other widgets. Change-Id: I8bd3b5dd3d14ab0e774f7272be236c35abd12de0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -240,6 +240,11 @@ bool CurrentDocumentFind::eventFilter(QObject *obj, QEvent *event)
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
QWidget *CurrentDocumentFind::currentWidget() const
|
||||
{
|
||||
return m_currentWidget.get();
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::aggregationChanged()
|
||||
{
|
||||
if (m_currentWidget) {
|
||||
|
@@ -45,6 +45,8 @@ public:
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
QWidget *currentWidget() const;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void candidateChanged();
|
||||
|
@@ -490,6 +490,12 @@ void FindToolBar::adaptToCandidate()
|
||||
updateActions();
|
||||
if (findToolBarPlaceHolder() == FindToolBarPlaceHolder::getCurrent()) {
|
||||
m_currentDocumentFind->acceptCandidate();
|
||||
if (QWidget *widget = m_currentDocumentFind->currentWidget()) {
|
||||
QFont f = font();
|
||||
f.setFamily(widget->font().family());
|
||||
m_findEdit->setFont(f);
|
||||
m_replaceEdit->setFont(f);
|
||||
}
|
||||
if (isVisible() && m_currentDocumentFind->isEnabled())
|
||||
m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags());
|
||||
}
|
||||
|
Reference in New Issue
Block a user