#include<QtCore>
#include<QtGui>
#include"ui_dialog1.h"
#include <stdio.h>
class synopsys
: public QDialog,
public Ui
::dialog1{
Q_OBJECT
public:
synopsys()
{
setupUi(this);
connect(pushButton1, SIGNAL(clicked()), this , SLOT(save()));
connect(pushButton2, SIGNAL(clicked()), this , SLOT(close()));
}
public slots:
void save()
{
Qt::CheckState state1,state2,state3,state4;
state1 = checkBox1->checkState();
state2 = checkBox2->checkState();
state3 = checkBox3->checkState();
state4 = checkBox4->checkState();
if(state1 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
const char *ch = str.toLatin1();
file.write(ch, qstrlen(ch));
file.close();
}
if(state2 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
const char *ch = str.toLatin1();
file.write(ch, qstrlen(ch));
file.close();
}
if(state3 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
const char *ch = str.toLatin1();
file.write(ch, qstrlen(ch));
file.close();
}
if(state4 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
const char *ch = str.toLatin1();
file.write(ch, qstrlen(ch));
file.close();
}
}
private:
};
int main(int argc, char *argv[])
{
synopsys *startup = new synopsys;
startup->show();
return app.exec();
}
#include "main.moc"
#include<QtCore>
#include<QtGui>
#include"ui_dialog1.h"
#include <stdio.h>
class synopsys : public QDialog,public Ui::dialog1
{
Q_OBJECT
public:
synopsys()
{
setupUi(this);
connect(pushButton1, SIGNAL(clicked()), this , SLOT(save()));
connect(pushButton2, SIGNAL(clicked()), this , SLOT(close()));
}
public slots:
void save()
{
Qt::CheckState state1,state2,state3,state4;
state1 = checkBox1->checkState();
state2 = checkBox2->checkState();
state3 = checkBox3->checkState();
state4 = checkBox4->checkState();
if(state1 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
QFile file(fileName);
QString str = lineEdit1->text();
const char *ch = str.toLatin1();
file.open(QIODevice::WriteOnly);
file.write(ch, qstrlen(ch));
file.close();
}
if(state2 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
QFile file(fileName);
QString str = lineEdit2->text();
const char *ch = str.toLatin1();
file.open(QIODevice::WriteOnly);
file.write(ch, qstrlen(ch));
file.close();
}
if(state3 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
QFile file(fileName);
QString str = lineEdit3->text();
const char *ch = str.toLatin1();
file.open(QIODevice::WriteOnly);
file.write(ch, qstrlen(ch));
file.close();
}
if(state4 == Qt::Checked)
{
fileName = "/home/window1/synopsys_startup.txt";
QFile file(fileName);
QString str = lineEdit4->text();
const char *ch = str.toLatin1();
file.open(QIODevice::WriteOnly);
file.write(ch, qstrlen(ch));
file.close();
}
}
private:
QString fileName;
};
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
synopsys *startup = new synopsys;
startup->show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks