[Qt-interest] qResizeEvent problem

Bijay Panda bijay at analytica-india.com
Thu Mar 26 06:11:08 CET 2009


Hi All,
In my project,I have a resizeEvent(QResizeEvent *e) method to resize the
GUI.
It should be excuted when ever user resizes the GUi, But control directly
goes to
above method instead of executing other methods where i have created the GUI
first.
And inside resizeEvent()  i am resizing the widget without allocating
memory.So i am
 getting segmentation fault.No where i called this method.
Here is my code bellow..

void OMCSConsole::createMenuControls()
{

      cout<<"Inside MenuControl::" <<endl;

      cout<<"originalMainWindowWidth  :"<<originalMainWindowWidth<<endl;
      cout<<"originalMainWindowHeight :"<<originalMainWindowHeight<<endl;

     _MenuBarGroupBox = new QGroupBox(this);
     _MenuBarGroupBox->setGeometry(0,0,this->width()-5,32);
     _MenuBarGroupBox->show();

     _menuBarArea     = new QScrollArea(_MenuBarGroupBox);
     _menuBarArea->setGeometry(0,1,_MenuBarGroupBox->width()-1,31);
     _menuBarArea->setFrameStyle(QFrame::NoFrame);

     _MenuBar = new MenuBar(_MenuBarGroupBox);
     _MenuBar->setGeometry(0,0,_MenuBarGroupBox->width()-1,31);
     _menuBarArea->setWidget(_MenuBar);
     _menuBarArea->show();
     _MenuBar->createMenuBar(this->width(),_MenuBarGroupBox->height());
//this->width()//
    }

void OMCSConsole::resizeEvent(QResizeEvent *event)
{

      cout<<"Inside Resize Event :"<<endl;

      resizedMainWindowWidth  = this->width();
      resizedMainWindowHeight = this->height();
      cout<<"resizedMainWindowWidth :"<<resizedMainWindowWidth<<endl;
      cout<<"resizedMainWindowHeight :"<<resizedMainWindowHeight<<endl;
      this->resize(resizedMainWindowWidth,resizedMainWindowHeight);

      cout<<"Resizing menuBarGrpBox."<<endl;
      //_MenuBarGroupBox->resize(1000,32);
     // cout<<"Crash after menuBarGrpBox."<<endl;


_MenuBarGroupBox->setGeometry(0,0,this->width()-5,32);//this->width()//menuBar

     _menuBarArea->setGeometry(0,1,_MenuBarGroupBox->width()-1,31);


     _MenuBar->setGeometry(0,0,_MenuBarGroupBox->width()-1,31);

}

Here it's showing crash immediately executing  this statement
 cout<<"Resizing menuBarGrpBox."<<endl;
I got stuck here.

Plz Plz any one help me out.

-- 
Thanks & Regards

Bijay .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090326/b1b08fb7/attachment.html 


More information about the Qt-interest-old mailing list