#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->comboBox1->addItem("1");
ui->comboBox1->addItem("2");
ui->comboBox1->addItem("3");
ui->comboBox2->addItem("1");
ui->comboBox2->addItem("2");
ui->comboBox2->addItem("3");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_comboBox1_currentIndexChanged(int index)
{
if (sender() == ui->comboBox1)
{
ui->comboBox2->blockSignals(true);
ui->comboBox2->setCurrentIndex(index);
ui->comboBox2->blockSignals(false);
}
else if (sender() == ui->comboBox2)
{
ui->comboBox1->blockSignals(true);
ui->comboBox1->setCurrentIndex(index);
ui->comboBox1->blockSignals(false);
}
}