22 #include <QDialogButtonBox> 
   25 #include <QMessageBox> 
   28 #include "ui_fileview.h" 
   34     , mUI(new 
Ui::Fileview)
 
   39     setWindowTitle(title);
 
   40     connect(
mUI->mButtons, SIGNAL(accepted()), 
this, SLOT(accept()));
 
   53         QString msg(tr(
"Could not find the file: %1"));
 
   54         msg = msg.arg(filename);
 
   56         QMessageBox msgbox(QMessageBox::Critical,
 
   65     file.open(QIODevice::ReadOnly | QIODevice::Text);
 
   66     if (!file.isReadable()) {
 
   67         QString msg(tr(
"Could not read the file: %1"));
 
   68         msg = msg.arg(filename);
 
   70         QMessageBox msgbox(QMessageBox::Critical,
 
   78     QByteArray filedata = file.readAll();
 
   81     edit->setPlainText(filedata);
 
~FileViewDialog() override
 
void loadTextFile(const QString &filename, QTextEdit *edit)
Load text file contents to edit control.
 
FileViewDialog(const QString &file, const QString &title, QWidget *parent=nullptr)