Skip to content

Commit

Permalink
Update naming and use signal variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Silarn committed Nov 5, 2023
1 parent c0ba89d commit fc1cef4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/textviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TextViewer::TextViewer(const QString& title, QWidget* parent)
setWindowTitle(title);
m_EditorTabs = findChild<QTabWidget*>("editorTabs");
connect(ui->showWhitespace, SIGNAL(stateChanged(int)), this,
SLOT(showWhitespace_changed(int)));
SLOT(showWhitespaceChanged(int)));
}

TextViewer::~TextViewer()
Expand Down Expand Up @@ -122,15 +122,15 @@ void TextViewer::findNext()
}
}

void TextViewer::showWhitespace_changed(int state)
void TextViewer::showWhitespaceChanged(int state)
{
for (int i = 0; i < m_EditorTabs->count(); ++i) {
QTextEdit* editor = m_EditorTabs->widget(i)->findChild<QTextEdit*>();
if (editor != nullptr) {
auto document = editor->document();
auto textOption = document->defaultTextOption();
auto flags = textOption.flags();
if (!ui->showWhitespace->isChecked())
if (state == Qt::Unchecked)
flags = flags & (~QTextOption::ShowTabsAndSpaces);
else
flags = flags | QTextOption::ShowTabsAndSpaces;
Expand Down
2 changes: 1 addition & 1 deletion src/textviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private slots:
void modified();
void patternChanged(QString newPattern);
void findNext();
void showWhitespace_changed(int state);
void showWhitespaceChanged(int state);

private:
void saveFile(const QTextEdit* editor);
Expand Down

0 comments on commit fc1cef4

Please sign in to comment.