Skip to content

Commit

Permalink
Github Issue #39: Added signal slot connection to update the syntax c…
Browse files Browse the repository at this point in the history
…olors for the preview text
  • Loading branch information
AngryFender committed Oct 2, 2023
1 parent 85cc618 commit ea0e9c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ void SettingsDialog::executeFolderDialog()
ui->edit_vaultRootPath->setText(selectedDir);
}
}

void SettingsDialog::syntaxColorUpdateHandler(HighlightColor &colors)
{
this->previewColors = colors;
}
4 changes: 3 additions & 1 deletion settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QDialog>
#include <QFileDialog>
#include "mktextdocument.h"
#include "mkedit.h"
#include "highlighter.h"

const QString previewText = QStringLiteral("\Multithreading Technologies in Qt"
Expand All @@ -28,8 +27,11 @@ class SettingsDialog : public QDialog

private slots:
void executeFolderDialog();
public slots:
void syntaxColorUpdateHandler(HighlightColor &colors);
private:
Ui::SettingsDialog *ui;
HighlightColor previewColors;
MkTextDocument previewDocument;
Highlighter previewHighligher;
};
Expand Down
3 changes: 3 additions & 0 deletions views_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ void ViewsHandler::initConnection()
QObject::connect(viewText,&MkEdit::syntaxColorUpdate,
&highlighter,&Highlighter::syntaxColorUpdateHandler);

QObject::connect(viewText,&MkEdit::syntaxColorUpdate,
settingsDialog,&SettingsDialog::syntaxColorUpdateHandler);

QObject::connect(viewTree, &NavigationView::pressed,
this, &ViewsHandler::fileDisplay);

Expand Down

0 comments on commit ea0e9c9

Please sign in to comment.