I've created an app that contains a Widget . I've put all the ctrls I need into it .
I've created my own Slots by creating a (Header + cpp) files to implement the functionality I want .
Everything ,so far , goes fine .
Now I've created another Widget . when I try to display the 2nd widget it just appears for a second !!
-I've created 2 HeaderFiles +2 .CPP files ; I mean each widget has its .cpp + .h .
My Questions are :
1- I need when the user press a button @ the 1st widget
, the 2nd widget shows .
2- How Could I close a specific Widget ?!!
3 - Do I 've to create @ my app a "Main Window"
4- Finally , Do I 've to create a Header + .cpp file to each Widget I've ?!!
My Main function's Code :
#include <QApplication>
#include <QDialog>
#include"CustomSlot.cpp"
#include "ui_Test.h"
int main(int argc, char *argv[])
{
CustomSlot widget;
widget.show();
return app.exec();
}
#include <QApplication>
#include <QDialog>
#include"CustomSlot.cpp"
#include "ui_Test.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
CustomSlot widget;
widget.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
-------------------------------------------------------------------------------------------
First CustomSlot.cpp 's code :
#include"CustomSlot.h"
#include "ui_Test.h"
#include "ui_Form2.h"
#include"CustomSlot2.cpp"
{
ui.setupUi(this);
}
void CustomSlot:: OpenNxtWindow()
{
CustomSlot2 widget;
widget.show();
}
#include"CustomSlot.h"
#include "ui_Test.h"
#include "ui_Form2.h"
#include"CustomSlot2.cpp"
CustomSlot::CustomSlot(QWidget *parent): QWidget(parent)
{
ui.setupUi(this);
}
void CustomSlot:: OpenNxtWindow()
{
CustomSlot2 widget;
widget.show();
}
To copy to clipboard, switch view to plain text mode
-----------------------------------------------------------------
Second CustomSlot.cpp 's code :
#include"CustomSlot2.h"
#include "ui_Form2.h"
{
formTwo.setupUi(this);
}
#include"CustomSlot2.h"
#include "ui_Form2.h"
CustomSlot2::CustomSlot2(QWidget *parent): QWidget(parent)
{
formTwo.setupUi(this);
}
To copy to clipboard, switch view to plain text mode
Thanks.
Bookmarks