使用currentIndex()或者currentText() void Widget::calc() { int first = ui->firstLineEdit->text().toInt(); int second = ui->secondLineEdit->text().toInt(); int result; switch(ui->comboBox->currentIndex()) { case 0: result = first + second; ui-…
/* * Copyright 2017 JessYan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICEN…