Results 1 to 14 of 14

Thread: QLineEdit can't update inside QStackedWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QLineEdit can't update inside QStackedWidget

    if I have initialized widgets in a wrong way , how can it work just fine when adding 3 or 4 widgets?


    Added after 16 minutes:


    This a slice of my code

    Qt Code:
    1. QStackedWidget *TraceConfigDialog::buildStackedWidget()
    2. {
    3. QStackedWidget *stackedWidget = new QStackedWidget();
    4. stackedWidget->addWidget(linearGroupBox());
    5.  
    6. stackedWidget->addWidget(fillingGroupBox());
    7. #if 1 // here if I put this "#if 1" on the 5th line , qlineedit can't update , actually all widgets inside the stacedwidget can't update.
    8. stackedWidget->addWidget(imageGroupBox());
    9. stackedWidget->addWidget(textGroupBox());
    10. stackedWidget->addWidget(logGroupBox());
    11. stackedWidget->addWidget(waveGroupBox());
    12. stackedWidget->addWidget(depthGroupBox());
    13. stackedWidget->addWidget(timeGroupBox());
    14. stackedWidget->addWidget(tadpoleGroupBox());
    15. #endif
    16. return stackedWidget;
    17. }
    18.  
    19. void inti()
    20. {
    21. vlayout=new QVBoxLayout();
    22. vlayout->addWidget(listWidget);
    23. vlayout->addWidget(curveStyleLabel);
    24. vlayout->addWidget(curveStyle);
    25.  
    26.  
    27. layout=new QHBoxLayout();
    28. layout->addLayout(vlayout);
    29.  
    30. stackedWidget = buildStackedWidget(); // <----
    31. m_rightLayout = new QVBoxLayout();
    32. m_rightLayout->addWidget(stackedWidget,10);
    33.  
    34. layout->addLayout(m_rightLayout);
    35. layout->addStretch();
    36.  
    37. widget->setLayout(layout);
    38. }
    39.  
    40. QPushButton *recommendButton = new QPushButton(tr("Recommend Value"));
    41. connect(recommendButton,SIGNAL(clicked()),this,SLOT(handleRecommendValue()));
    42.  
    43. void TraceConfigDialog::handleRecommendValue()
    44. {
    45.  
    46. m_linearLeftValue->setText("testest); // <--- m_linearLeftValue is a QLineEdit
    47. m_linearLeftValue->update();
    48. stackedWidget->update();
    49. }
    To copy to clipboard, switch view to plain text mode 

    The QLineEdit is inside linearGroupBox() , which return a QGroupBox. And there is a QPushButton inside the linearGroupBox()
    Last edited by anda_skoa; 22nd March 2014 at 10:53. Reason: changed[quote] into [code] tags

Similar Threads

  1. QTabWidget inside QStackedWidget
    By zgulser in forum Qt Programming
    Replies: 2
    Last Post: 21st May 2012, 09:38
  2. QLineEdit update before external method
    By Ishtar in forum Newbie
    Replies: 4
    Last Post: 19th August 2011, 19:52
  3. QLineEdit Delegate value update
    By yazwas in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2011, 23:02
  4. Replies: 3
    Last Post: 25th July 2010, 19:15
  5. Access objects inside QStackedWidget widgets.
    By Trader in forum Qt Programming
    Replies: 0
    Last Post: 25th July 2010, 17:10

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.