hi kosasker,
you are right. but i need to hide the main window only when the condition is true otherwise mainwindow will display.
thanx
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFile>
#include "form1.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
QFile file("E:/workplace/info.txt");
QFile file1
("E:/workplace/account_info.txt");
if(file.exists() & file1.exists())
{
Form1 *frm1 = new Form1;
frm1->setAttribute(Qt::WA_DeleteOnClose);
frm1->setParent(0);
frm1->setVisible(true);
this->setVisible(false);
}
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFile>
#include "form1.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QFile file("E:/workplace/info.txt");
QFile file1("E:/workplace/account_info.txt");
if(file.exists() & file1.exists())
{
Form1 *frm1 = new Form1;
frm1->setAttribute(Qt::WA_DeleteOnClose);
frm1->setParent(0);
frm1->setVisible(true);
this->setVisible(false);
}
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
i am using qt gui. i want to show only second window(form1) when condition work. but in my output both windows is shown (mainwindow and form1)
Bookmarks