C++ (Qt) Form1 frmOne; frmOne.showfrmTwo(); frmOne.setVisible(false);
C++ (Qt) frmTwo = new Form2(0); frmTwo->setVisible(true); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(showbtnfrm2())); timer->setSingleShot(true); timer->start(3000);
C++ (Qt) frmTwo ->btnGoON();
C++ (Qt) ui.btn->setEnabled(true);
C++ (Qt) connect(ui.btn, SIGNAL(clicked()), this, SLOT(hideMe()));
C++ (Qt) frm1->hideTwo();
C++ (Qt) this->setVisible(true); delete frmTwo;
C++ (Qt)#include "itman.h"#include <QtGui>#include <QApplication> int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); iTMan frmMainWindows; frmMainWindows.showStartBaner(); return app.exec(); }
C++ (Qt)#include "itman.h"#include "startbaner.h" #include <QTimer> QTimer *timer;startBaner *frmSB; iTMan::iTMan(QWidget *parent): QMainWindow(parent) { uiIT.setupUi(this); } // показываем стартовый банерvoid iTMan::showStartBaner() { frmSB = new startBaner(0); frmSB->setVisible(true); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(showSBbtnGo())); timer->setSingleShot(true); timer->start(intTimeOfSB); } //прячем стартовый банерvoid iTMan::hideStartBaner() { this->setVisible(true); /////////////////////////// Вот здесь что написать?????????????????????????????????????????????????? delete frmSB; } void iTMan::showSBbtnGo() { frmSB->btnGoON(); }
C++ (Qt)#include "startbaner.h"#include "itman.h" iTMan *frmIT; startBaner::startBaner(QWidget *parent): QWidget(parent) { uiSB.setupUi(this); connect(uiSB.btnGo, SIGNAL(clicked()), this, SLOT(hideMe())); uiSB.btnGo->setEnabled(false); } void startBaner::btnGoON() { uiSB.btnGo->setEnabled(true); } void startBaner::hideMe() { frmIT->hideStartBaner(); }
C++ (Qt)void startBaner::hideMe() { frmIT->hideStartBaner(); }
C++ (Qt)void iTMan::hideStartBaner() { this->setVisible(true); /////////////////////////// Вот здесь что написать?????????????????????????????????????????????????? delete frmSB; }
C++ (Qt)QT += gui coreSOURCES += \ core.cpp HEADERS += \ banner_form.hpp \ main_form.hpp
C++ (Qt)#ifndef BANNER_FORM_HPP#define BANNER_FORM_HPP #include <QWidget>#include <QPushButton> class banner_form: public QWidget{ Q_OBJECT public: QPushButton *go_button; explicit banner_form(QWidget *parent = 0): QWidget(parent) { go_button = new QPushButton("<<GO>>", this); go_button->setEnabled(false); connect(go_button, SIGNAL(clicked()), this, SLOT(close())); move(100, 100); resize(300,300); } public slots: void enable_go_button() { go_button->setEnabled(true); }};#endif // BANNER_FORM_HPP
C++ (Qt)#ifndef MAIN_FORM_HPP#define MAIN_FORM_HPP #include <QWidget>#include <QTimer>#include "banner_form.hpp" class main_form: public QWidget{ Q_OBJECT QTimer *main_timer; banner_form *banner; public: explicit main_form(QWidget *parent = 0, banner_form *banner_ = 0): QWidget(parent), banner(banner_) { main_timer = new QTimer(this); main_timer->setSingleShot(true); connect(main_timer, SIGNAL(timeout()), banner, SLOT(enable_go_button())); connect(banner->go_button, SIGNAL(clicked()), this, SLOT(show())); move(0, 0); resize(500, 500); setVisible(false); } void start_timer() { main_timer->start(3000); }};#endif // MAIN_FORM_HPP
C++ (Qt)#include <QApplication>#include <QtGui> #include "banner_form.hpp"#include "main_form.hpp" int main(int args_number, char *args[]){ QApplication main_app(args_number, args); banner_form *simple_banner_form = new banner_form(); main_form *just_another_main_form = new main_form(0, simple_banner_form); just_another_main_form->activateWindow(); simple_banner_form->show(); just_another_main_form->start_timer(); return main_app.exec();}