Results 1 to 5 of 5

Thread: About mainwindows layout problem(segmentation fault)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    35
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Windows

    Default About mainwindows layout problem(segmentation fault)

    i want to implement below function:

    mainwindow have two widget(A is stackwidget and B is QFrame).

    1. at first A is showed.
    2. when click QAction action_B, A is hided, B is showed.
    3. when click QAction action_A, A is showed, B is hided.

    when debugger.
    At first click action_A, can show A and hide B, but segmentation fault when i cllick action_B.

    i delete this->setCentralWidget(A) or this->setCentralWidget(B) , no fault was happened.

    if i want to implement function above what i said. how to program? please give me any advice. thank your for your help!


    codes see as below:

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7. ...............
    8. this->setCentralWidget(A);
    9. }
    10.  
    11. void MainWindow::init();
    12. {
    13. ui->action_A->setEnabled(true);
    14. ui->action_B->setEnabled(false);
    15.  
    16. a->hide();
    17. ..........
    18. this->setCentralWidget(B);
    19. b->show();
    20. }
    21.  
    22. void MainWindow::on_action_A_triggered()
    23. {
    24. b->hide();
    25. a->show();
    26. ui->action_A->setEnabled(false);
    27. ui->action_B->setEnabled(true);
    28. ......
    29. }
    30.  
    31. void MainWindow::on_action_B_triggered()
    32. {
    33. init();
    34. }
    To copy to clipboard, switch view to plain text mode 


    TKS.

    ken
    Last edited by wysota; 8th December 2012 at 16:50. Reason: missing [code] tags

Similar Threads

  1. Replies: 2
    Last Post: 9th August 2011, 13:28
  2. debugging problem : segmentation fault
    By qureshi in forum Newbie
    Replies: 16
    Last Post: 8th June 2011, 11:21
  3. segmentation fault
    By navid in forum Qt Programming
    Replies: 3
    Last Post: 20th December 2009, 11:40
  4. Segmentation Fault?!
    By r07f1 in forum Newbie
    Replies: 2
    Last Post: 11th April 2008, 15:10
  5. Replies: 2
    Last Post: 19th May 2007, 18:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.