37 #include <QTextStream> 38 #if(QT_VERSION >= 0x050000) 39 #include <QStandardPaths> 41 #include <QDesktopServices> 45 const QString &fileName)
49 setTextInteractionFlags(Qt::TextSelectableByMouse |
50 Qt::TextSelectableByKeyboard);
51 setLineWrapMode(QPlainTextEdit::NoWrap);
55 if (tempName.isEmpty())
58 #if(QT_VERSION >= 0x050000) 60 QStandardPaths::writableLocation(QStandardPaths::DataLocation);
63 QDesktopServices::storageLocation(QDesktopServices::DataLocation);
65 tempName = userDataDir +
"/log/TerraLib.log";
69 tempName.toUtf8().data(),
74 m_file.setFileName(tempName);
75 QTextStream ifile(&
m_file);
77 m_file.open(QFile::ReadOnly);
79 setPlainText(ifile.readAll());
96 QTextStream ifile(&
m_file);
102 while (!ifile.atEnd())
104 insertPlainText(ifile.readLine());
105 insertPlainText(
"\n");
118 QList<QTextEdit::ExtraSelection> matches;
122 auto bgColor = QColor(Qt::gray).lighter(135);
126 QTextEdit::ExtraSelection extra;
128 extra.format.setBackground(bgColor);
130 extra.cursor = textCursor();
132 matches.append(extra);
135 setExtraSelections(matches);
std::unique_ptr< te::core::FileWatcher > m_watcher
void findAll(const QString &str)
LogTextEdit(QWidget *parent=0, const QString &fileName="")