what error are you getting? btw above code you presented wont compile.
what error are you getting? btw above code you presented wont compile.
Hi
I am not getting an error, the code is running only that when I click the cancel button the application is not exiting as I expect.
Hi,
Please check your above code :
This is code for your button signal&slot :
Qt Code:
connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));To copy to clipboard, switch view to plain text mode
And this is code in your button design :
Qt Code:
To copy to clipboard, switch view to plain text mode
You have different object name for your "CANCEL BUTTON"
Best regards,
myta212
Two buttons. If you built a dialog with the wizards in Qt Creator then the default OK and Cancel buttons are already connected for you, which is what my earlier comment was about. It appears that you have built the widget yourself so that does not apply.Originally Posted by Enoctaffie
There is only one button in your pasted code and the code you posted will not compile. Therefore the code you are actually running is different to what you have described and shown us.I am not getting an error,
There is nothing in the code that would guarantee the application will quit. QWidget::close() hides the widget if the event is accepted (the default). That will only quit the application if the widget concerned is the last top level widget in the program and you have not disabled this by fiddling with the Qt::WA_QuitOnClose attribute of the widget or the QApplication quitOnLastWindowClosed property. We don't know if it is the the last window or not; but the behaviour you describe would imply that it is not.the code is running only that when I click the cancel button the application is not exiting as I expect.
Enoctaffie (19th April 2012)
Bookmarks