1717 */
1818
1919
20+ #include " ApplicationSettings.h"
21+ #include " NotepadNextApplication.h"
2022#include " SearchResultHighlighterDelegate.h"
2123#include " SearchResultData.h"
2224#include " SearchResultsDock.h"
@@ -36,12 +38,6 @@ SearchResultsDock::SearchResultsDock(QWidget *parent) :
3638{
3739 ui->setupUi (this );
3840
39- #ifdef Q_OS_MACOS
40- // Set a slightly larger font on MacOS
41- QFont font (" Courier New" , 14 );
42- ui->treeWidget ->setFont (font);
43- #endif
44-
4541 // Close the results when escape is pressed
4642 new QShortcut (QKeySequence::Cancel, this , this , &SearchResultsDock::close, Qt::WidgetWithChildrenShortcut);
4743
@@ -69,6 +65,16 @@ SearchResultsDock::SearchResultsDock(QWidget *parent) :
6965 });
7066
7167 ui->treeWidget ->setItemDelegate (new SearchResultHighlighterDelegate (ui->treeWidget ));
68+
69+ ApplicationSettings *settings = qobject_cast<NotepadNextApplication*>(qApp)->getSettings ();
70+ auto updateTreeWidgetFont = [=]() {
71+ QFont f (settings->fontName (), settings->fontSize ());
72+ ui->treeWidget ->setFont (f);
73+ ui->treeWidget ->resizeColumnToContents (0 );
74+ };
75+ connect (settings, &ApplicationSettings::fontNameChanged, this , updateTreeWidgetFont);
76+ connect (settings, &ApplicationSettings::fontSizeChanged, this , updateTreeWidgetFont);
77+ updateTreeWidgetFont ();
7278}
7379
7480SearchResultsDock::~SearchResultsDock ()
0 commit comments