QtHPConnect/texteditor.h
2019-02-10 15:43:00 +02:00

38 lines
760 B
C++

#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
#include <QTextEdit>
class textEditor : public QTextEdit
{
Q_OBJECT
public:
explicit textEditor(QWidget *parent = 0);
~textEditor();
void newFile();
bool loadFile(const QString &fileName);
bool save();
bool saveAs();
bool saveFile(const QString &fileName);
QString userFriendlyCurrentFile();
QString currentFile() { return curFile; }
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void documentWasModified();
private:
QWidget * wParent;
bool maybeSave();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
QString curFile;
bool isUntitled;
};
#endif // TEXTEDITOR_H