QtHPConnect/texteditor.h

39 lines
760 B
C
Raw Normal View History

2019-02-10 14:32:15 +01:00
#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
2019-02-10 14:43:00 +01:00
#include <QTextEdit>
2019-02-10 14:32:15 +01:00
2019-02-10 14:43:00 +01:00
class textEditor : public QTextEdit
2019-02-10 14:32:15 +01:00
{
Q_OBJECT
public:
explicit textEditor(QWidget *parent = 0);
~textEditor();
2019-02-10 14:43:00 +01:00
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();
2019-02-10 14:32:15 +01:00
private:
2019-02-10 14:43:00 +01:00
QWidget * wParent;
bool maybeSave();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
QString curFile;
bool isUntitled;
2019-02-10 14:32:15 +01:00
};
#endif // TEXTEDITOR_H