Qt4 - How to close a window?
Hey!
I have a problem that I can't figure out..any help would be great
I'm a beginner at Qt and I'm trying to figure this out but I'm getting an error
My GUI should function such that on a specific button press a new window pops up and the old one shuts...
I got the new window to pop up and stuff and everything works fine..but i can't figure out how to close the old one... any pointers??
Code:
#include <QtGui>
#include "guistart.h"
//#include "addcluster.h"
// if we include <QtGui> there is no need to include every class used: <QString>, <QFileDialog>,...
{
setupUi(this); // this sets up GUI
// signals/slots mechanism in action
connect( nextButton, SIGNAL( clicked() ), this, SLOT( addClusterWindow() ) );
}
void guiStart::addClusterWindow()
{
addCluster *window = new addCluster();
window->show();
this.close();
}
All my windows are QMainWindow .
The above code gives me this error
Code:
guistart.cpp: In member function ‘void guiStart::addClusterWindow()’:
guistart.cpp:20:7: error: request for member ‘close’ in ‘this’, which is of non-class type ‘guiStart* const’
I know there's a problem with the this.close()
Any help would be great guys!! Thanks!
Re: Qt4 - How to close a window?
this is a pointer, so you need to use this->close();