I'm with a doubt stupid, but I could not solve 
I have two windows, a QMainWindow, and another QDialog, see:
NSControl
::NSControl(QWidget *parent, Qt
::WFlags flags
){
//SETUP OF UI
ui.setupUi(this);
//SETUP WINDOW(POPUP)
add = new Add(this);
//CONNECTS
connect(ui.actionSair, SIGNAL(triggered()), this, SLOT(close()) );
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(Apply()) );
connect(ui.actionSobre, SIGNAL(triggered()), this, SLOT(About()) );
connect(ui.actionAdicionar_Endere_o, SIGNAL(triggered()), this, SLOT(AddButton()) );
ui.info_tempo->setText("1min");
}
NSControl::~NSControl()
{
}
void NSControl::Apply()
{
QString tempo
= ui.
comboBox->currentText
();
ui.info_tempo->setText(tempo);
}
void NSControl::About()
{
QMessageBox::about( this, tr
("Sobre NSControl"), tr
("Desenvolvido por Mateus Vitali") );
}
void NSControl::AddButton()
{
add->show();
}
NSControl::NSControl(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
//SETUP OF UI
ui.setupUi(this);
//SETUP WINDOW(POPUP)
add = new Add(this);
//CONNECTS
connect(ui.actionSair, SIGNAL(triggered()), this, SLOT(close()) );
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(Apply()) );
connect(ui.actionSobre, SIGNAL(triggered()), this, SLOT(About()) );
connect(ui.actionAdicionar_Endere_o, SIGNAL(triggered()), this, SLOT(AddButton()) );
ui.info_tempo->setText("1min");
}
NSControl::~NSControl()
{
}
void NSControl::Apply()
{
QString tempo = ui.comboBox->currentText();
ui.info_tempo->setText(tempo);
}
void NSControl::About()
{
QMessageBox::about( this, tr("Sobre NSControl"), tr("Desenvolvido por Mateus Vitali") );
}
void NSControl::AddButton()
{
add->show();
}
To copy to clipboard, switch view to plain text mode
Add
::Add(QWidget *parent, Qt
::WFlags flags
){
//SETUP OF UI
ui.setupUi(this);
//CONNECTS
connect(ui.cancelar, SIGNAL(triggered()), this, SLOT(Cancel()) );
connect(ui.salvar, SIGNAL(triggered()), this, SLOT(Save()) );
}
Add::~Add()
{
}
void Add::Save()
{
QMessageBox::about( this, tr
("Sobre NSControl"), tr
("Desenvolvido por Mateus Vitali") );
}
void Add::Cancel()
{
QMessageBox::about( this, tr
("Sobre NSControl"), tr
("Desenvolvido por Mateus Vitali") );
this->hide();
}
Add::Add(QWidget *parent, Qt::WFlags flags)
{
//SETUP OF UI
ui.setupUi(this);
//CONNECTS
connect(ui.cancelar, SIGNAL(triggered()), this, SLOT(Cancel()) );
connect(ui.salvar, SIGNAL(triggered()), this, SLOT(Save()) );
}
Add::~Add()
{
}
void Add::Save()
{
QMessageBox::about( this, tr("Sobre NSControl"), tr("Desenvolvido por Mateus Vitali") );
}
void Add::Cancel()
{
QMessageBox::about( this, tr("Sobre NSControl"), tr("Desenvolvido por Mateus Vitali") );
this->hide();
}
To copy to clipboard, switch view to plain text mode
When I click the Add button, it opens the QDialog (add), but when I try to click on the buttons QDialog (Save and Cancel), nothing happens, and one was to appear as I hadplanned QMessageBox
Why?
Bookmarks