PstdEr
25th October 2013, 13:17
I am trying to create a slot from object to other
frame to log , but both belongs to same class
when trying to access objects placed on log , they are becoming invalid.
how to solve the problem?
QWidget* ApplicationLog::createLogWindow()
{
m_pCmdLogHL = new QHBoxLayout(this);
m_pLogTE = new QTextEdit(this);
m_pCmdLogHL->addWidget(m_pLogTE);
}
QWidget* ApplicationLog::createFrameWindow()
{
m_pButtonsHL = new QHBoxLayout(this);
m_pMinMaxBut = new Button(this,"Minimize");
connect(m_pMinMaxBut,SIGNAL(clicked()),this,SLOT(l ogWindowMinMax()));
m_bIsMaximize = 1;
}
void ApplicationLog::logWindowMinMax()
{
qDebug()<<"slot invoked" ;
if(m_bIsMaximize)
{
m_pLogTE->setVisible(false);
m_pMinMaxBut->setTooltip("Maximize");
m_bIsMaximize = 0;
}
else
{
m_pLogTE->setVisible(true);
m_bIsMaximize = 1;
m_pMinMaxBut->setTooltip("Minimize");
}
}
in the main window i am calling
QWidget* frame = framewindow->createFrameWindow();
QWidget* log = logwindow->createLogWindow();
this particular line is giving problem (segmentation)
m_pLogTE->setVisible(false);
why is it wrong to access that object,how to access the object?
frame to log , but both belongs to same class
when trying to access objects placed on log , they are becoming invalid.
how to solve the problem?
QWidget* ApplicationLog::createLogWindow()
{
m_pCmdLogHL = new QHBoxLayout(this);
m_pLogTE = new QTextEdit(this);
m_pCmdLogHL->addWidget(m_pLogTE);
}
QWidget* ApplicationLog::createFrameWindow()
{
m_pButtonsHL = new QHBoxLayout(this);
m_pMinMaxBut = new Button(this,"Minimize");
connect(m_pMinMaxBut,SIGNAL(clicked()),this,SLOT(l ogWindowMinMax()));
m_bIsMaximize = 1;
}
void ApplicationLog::logWindowMinMax()
{
qDebug()<<"slot invoked" ;
if(m_bIsMaximize)
{
m_pLogTE->setVisible(false);
m_pMinMaxBut->setTooltip("Maximize");
m_bIsMaximize = 0;
}
else
{
m_pLogTE->setVisible(true);
m_bIsMaximize = 1;
m_pMinMaxBut->setTooltip("Minimize");
}
}
in the main window i am calling
QWidget* frame = framewindow->createFrameWindow();
QWidget* log = logwindow->createLogWindow();
this particular line is giving problem (segmentation)
m_pLogTE->setVisible(false);
why is it wrong to access that object,how to access the object?