#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QObject>
#include <QFile>
#include <QDataStream>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QWidget>
class MainWindow
: public QWidget { Q_OBJECT
public:
private slots:
void openfile();
void updatefile();
private:
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QObject>
#include <QFile>
#include <QDataStream>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include <QWidget>
class MainWindow : public QWidget {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
private slots:
void openfile();
void updatefile();
private:
QLabel *state;
QLineEdit *filePath;
QTextEdit *fileContent;
QPushButton *open_create;
QPushButton *updateFile;
QFile *file;
QDataStream *ds;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
resize(600,500);
filePath
= new QLineEdit(".\\test.txt",
this);
filePath->setGeometry(10,10,400,20);
open_create->setGeometry(420,10,90,20);
QObject::connect(open_create,
SIGNAL(clicked
()),
this,
SLOT(openfile
()));
updateFile->setGeometry(520,10,70,20);
state
= new QLabel("Ready",
this);
state->setGeometry(10,40,500,50);
state->setWordWrap(true);
state->setAlignment(Qt::AlignTop);
fileContent->setGeometry(10,100,580,390);
}
MainWindow::MainWindow(QWidget *parent) : QWidget(parent) {
resize(600,500);
filePath = new QLineEdit(".\\test.txt",this);
filePath->setGeometry(10,10,400,20);
open_create = new QPushButton("Open/Create",this);
open_create->setGeometry(420,10,90,20);
QObject::connect(open_create,SIGNAL(clicked()),this,SLOT(openfile()));
updateFile = new QPushButton("Update file",this);
updateFile->setGeometry(520,10,70,20);
state = new QLabel("Ready",this);
state->setGeometry(10,40,500,50);
state->setWordWrap(true);
state->setAlignment(Qt::AlignTop);
fileContent = new QTextEdit(this);;
fileContent->setGeometry(10,100,580,390);
}
To copy to clipboard, switch view to plain text mode
Bookmarks