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
{
stackedWidget->addWidget(linearGroupBox());
stackedWidget->addWidget(fillingGroupBox());
#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.
stackedWidget->addWidget(imageGroupBox());
stackedWidget->addWidget(textGroupBox());
stackedWidget->addWidget(logGroupBox());
stackedWidget->addWidget(waveGroupBox());
stackedWidget->addWidget(depthGroupBox());
stackedWidget->addWidget(timeGroupBox());
stackedWidget->addWidget(tadpoleGroupBox());
#endif
return stackedWidget;
}
void inti()
{
vlayout->addWidget(listWidget);
vlayout->addWidget(curveStyleLabel);
vlayout->addWidget(curveStyle);
layout->addLayout(vlayout);
stackedWidget = buildStackedWidget(); // <----
m_rightLayout->addWidget(stackedWidget,10);
layout->addLayout(m_rightLayout);
layout->addStretch();
widget->setLayout(layout);
}
connect(recommendButton,SIGNAL(clicked()),this,SLOT(handleRecommendValue()));
void TraceConfigDialog::handleRecommendValue()
{
m_linearLeftValue->setText("testest); // <--- m_linearLeftValue is a QLineEdit
m_linearLeftValue->update();
stackedWidget->update();
}
QStackedWidget *TraceConfigDialog::buildStackedWidget()
{
QStackedWidget *stackedWidget = new QStackedWidget();
stackedWidget->addWidget(linearGroupBox());
stackedWidget->addWidget(fillingGroupBox());
#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.
stackedWidget->addWidget(imageGroupBox());
stackedWidget->addWidget(textGroupBox());
stackedWidget->addWidget(logGroupBox());
stackedWidget->addWidget(waveGroupBox());
stackedWidget->addWidget(depthGroupBox());
stackedWidget->addWidget(timeGroupBox());
stackedWidget->addWidget(tadpoleGroupBox());
#endif
return stackedWidget;
}
void inti()
{
vlayout=new QVBoxLayout();
vlayout->addWidget(listWidget);
vlayout->addWidget(curveStyleLabel);
vlayout->addWidget(curveStyle);
layout=new QHBoxLayout();
layout->addLayout(vlayout);
stackedWidget = buildStackedWidget(); // <----
m_rightLayout = new QVBoxLayout();
m_rightLayout->addWidget(stackedWidget,10);
layout->addLayout(m_rightLayout);
layout->addStretch();
widget->setLayout(layout);
}
QPushButton *recommendButton = new QPushButton(tr("Recommend Value"));
connect(recommendButton,SIGNAL(clicked()),this,SLOT(handleRecommendValue()));
void TraceConfigDialog::handleRecommendValue()
{
m_linearLeftValue->setText("testest); // <--- m_linearLeftValue is a QLineEdit
m_linearLeftValue->update();
stackedWidget->update();
}
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()
Bookmarks