forked from hanxiaoluo/KeyboardLiuDianWu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmmain.cpp
49 lines (43 loc) · 1.03 KB
/
frmmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "frmmain.h"
#include "ui_frmmain.h"
#include <QFileDialog>
#include <QInputDialog>
#include <QDialog>
#include <QDebug>
frmMain::frmMain(QWidget *parent) :
QWidget(parent),
ui(new Ui::frmMain)
{
ui->setupUi(this);
ui->txt->setProperty("noinput", true);
}
frmMain::~frmMain()
{
delete ui;
}
void frmMain::on_btnDialog_clicked()
{
QDialog *d = new QDialog(this);
QLineEdit *txt = new QLineEdit(d);
txt->setVisible(true);
d->show();
}
void frmMain::on_btnInputDialog_clicked()
{
QInputDialog *d = new QInputDialog(this);
d->show();
}
void frmMain::on_btnFileDialog_clicked()
{
QFileDialog *d = new QFileDialog(this);
connect(d, SIGNAL(fileSelected(QString)), this, SLOT(fileSelected(QString)));
d->show();
}
void frmMain::fileSelected(QString fileName)
{
QFile file(fileName);
file.open(QFile::WriteOnly | QIODevice::Text);
QTextStream out(&file);
out << ui->plainTextEdit->toPlainText();
file.close();
}