Member access problem, from same class,

  • 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);

    @QWidget* ApplicationLog::createFrameWindow()
    m_pButtonsHL = new QHBoxLayout(this);
    m_pMinMaxBut = new Button(this,"Minimize");
    m_bIsMaximize = 1;

    @void ApplicationLog::logWindowMinMax()
    qDebug()<<"slot invoked" ;
    m_bIsMaximize = 0;
    m_bIsMaximize = 1;

    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?

  • Moderators

    when you do it this way you must ensure that you call the methods in the right order to ensure that all dependent methods are accessing initialized members.

    But i believe you've stripped out some code right? Thus it's hard to spot the error. The code more or less looks good, despite you're not setting the layout and not returning a widget in your methods while they are declared so, etc.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.