From 10f9fd041cefb14659f07c2163ef27796fae7e3e Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Mon, 17 Jun 2019 04:04:03 -0400 Subject: disable editor without selection --- src/modinfodialogtextfiles.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/modinfodialogtextfiles.cpp') diff --git a/src/modinfodialogtextfiles.cpp b/src/modinfodialogtextfiles.cpp index 98da8c4a..50174ec5 100644 --- a/src/modinfodialogtextfiles.cpp +++ b/src/modinfodialogtextfiles.cpp @@ -38,6 +38,7 @@ TextFilesTab::TextFilesTab(Ui::ModInfoDialog* ui) void TextFilesTab::clear() { ui->textFileList->clear(); + select(nullptr); } bool TextFilesTab::feedFile(const QString& rootPath, const QString& fullPath) @@ -87,5 +88,15 @@ void TextFilesTab::onSelection( return; } - ui->textFileView->load(item->fullPath()); + select(item); +} + +void TextFilesTab::select(TextFileItem* item) +{ + if (item) { + ui->textFileView->setEnabled(true); + ui->textFileView->load(item->fullPath()); + } else { + ui->textFileView->setEnabled(false); + } } -- cgit v1.3.1