【发布时间】:2019-07-11 11:00:58
【问题描述】:
我使用 for(int i=0; i
像这样:
i=0 1.Runner distance ,percentage = %80 Place = ComboBoxValue
i=1 1.Runner distance ,percentage = %60 Place = ComboBoxValue
当我更改组合框或百分比值时。最后,我想取百分比和组合框的值。 像这样:
QString Runner1= QString(_Numberlabel->text() + label->text() + lineEdit->text() + comboBox->currentText()); QString Runner2= QString(_Numberlabel->text() + label->text() + lineEdit->text() + comboBox->currentText());
enter code here
for(int i=0; i < runnerList.size() ;i++)
{
Layout = new QHBoxLayout();
Layout->setSpacing(6);
_Numberlabel= new QLabel();
_Numberlabel->setObjectName(QString::fromUtf8("_Numberlabel"));
_Numberlabel->setText(QString("First Runner").arg(i+1).arg(runnerList[i][0]).arg(runnerList[i][1]));
QFont font;
font.setFamily(QString::fromUtf8("Calibri"));
font.setPointSize(10);
font.setBold(true);
font.setWeight(75);
_Numberlabel->setFont(font);
Layout->addWidget(_Numberlabel);
label = new QLabel();
label->setObjectName(QString::fromUtf8("label"));
label->setMaximumSize(QSize(60, 16777215));
label->setFont(font);
label->setText("Percantage:");
Layout->addWidget(label);
lineEdit = new QLineEdit();
lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
lineEdit->setMaximumSize(QSize(50, 16777215));
lineEdit->setText("%");
Layout->addWidget(lineEdit);
comboBox = new QComboBox();
comboBox->setObjectName(QString::fromUtf8("comboBox"));
comboBox->setMinimumSize(QSize(0, 25));
comboBox->setMaximumSize(QSize(90, 16777215));
comboBox->addItem("1");
comboBox->addItem("2");
comboBox->addItem("3");
comboBox->addItem("4");
Layout->addWidget(comboBox);
this->ui.verticalLayout->addLayout(Layout);
}
【问题讨论】:
-
您好,欢迎您!
QtModules是什么? -
乍一看,我看不到您从 QLineEdit 和 QComboBox 获取数据的位置。请粘贴minimal reproducible example。
-
我在问题中添加了一张新图片。我想获取像 QString 这样的数据 last = QString(_Numberlabel->text() + label->text() + lineEdit->text() + comboBox->currentText());