Hi All,
I am updating some existing code and need to close a qDialog that is opened with show(). But when I try to connect to slots, close(), hide() finished(), etc. I get the error
error C2039: 'closeEvent' : is not a member of 'QObject'
Is it possible to close a dialog box without subclassing? Everything is already working and I don't want to re-write the code.
I have a ui QDialog file created with designer holding multiple widgets. When I press my button it opens a modeless dialog window. All I want to add is that when I press another button it will close the dialog, or hide I don't really care. I can close it using the X button, but want to be able to close it when the user does something in the code that renders the dialog no longer valid,
The actual code is large, but here is what I am trying to do. Hope it helps.
in MyApp.h
#include ui_fullSizeImage.h"
#include "ui_myapp.h"
...
Ui::MyApp m_ui;
Ui::FullSizeDialog m_fullSizeDialog
m_ui.setupUi(this);
m_fullSizeDialog.
setupUi(new QDialog(this, Qt
::WindowMaximizeButtonHint));
// show dialog
connect(m_ui.m_fullScreenButton,
SIGNAL(clicked()),
m_fullSizeDialog.m_dialogWidget->parent(),
SLOT(show()));
in MyApp.h
#include ui_fullSizeImage.h"
#include "ui_myapp.h"
...
Ui::MyApp m_ui;
Ui::FullSizeDialog m_fullSizeDialog
in MyApp.cpp which is a QMainWindow class
m_ui.setupUi(this);
m_fullSizeDialog.setupUi(new QDialog(this, Qt::WindowMaximizeButtonHint));
// show dialog
connect(m_ui.m_fullScreenButton,
SIGNAL(clicked()),
m_fullSizeDialog.m_dialogWidget->parent(),
SLOT(show()));
To copy to clipboard, switch view to plain text mode
And I want to add
// close dialog, wont compile.
connect(m_ui.m_fullScreenCloseButton,
SIGNAL(clicked()),
m_fullSizeDialog.m_dialogWidget->parent(),
SLOT(close()));
// close dialog, wont compile.
connect(m_ui.m_fullScreenCloseButton,
SIGNAL(clicked()),
m_fullSizeDialog.m_dialogWidget->parent(),
SLOT(close()));
To copy to clipboard, switch view to plain text mode
Thanks for your help
Bookmarks