Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Member access problem, from same class,
Qt 6.11 is out! See what's new in the release blog

Member access problem, from same class,

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dcqt
    wrote on last edited by
    #1

    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(logWindowMinMax()));
    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?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved