ここでいうコントロールとはラジオボタン等のWidgetのことです。
QSpinBox *zoomSpinBox = new QSpinBox; zoomSpinBox->setRange(0, 1000); zoomSpinBox->setSingleStep(10); zoomSpinBox->setSuffix("%"); zoomSpinBox->setSpecialValueText(tr("Automatic")); zoomSpinBox->setValue(100); connect(zoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(hoge()) ) ;
QSlider *mySlider = new QSlider(Horizontal, this); mySlider->setObjectName(tr("Hoge")); mySlider->setMinimum(minValue); mySlider->setMaximum(maxValue); mySlider->setPageStep(pageStep); mySlider->setValue(value); connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(hoge(int)) ) ;
QPushButton* cat = new QPushButton("にゃんこ", this) ; QPixmap pixmap(20, 10) ; QPainter qp(&pixmap) ; QBrush qb(QColor(red, green, blue)) ; qp.fillRect(0, 0, 20, 10, qb) ; cat->setIcon(QIcon(pixmap)) ; connect( cat, SIGNAL(clicked()), this, SLOT(miya()) );
QLineEdit* edit = new QLineEdit(this) ; edit->setGeometry(10, 40, 180, 30) ; edit->setText("Hello") ; connect(edit, SIGNAL(returnPressed()), this, SLOT(accept()) ) ;
QComboBox *team = new QComboBox(this ,"read-only combobox" ); team->addItems(MenuList) ; team->setCurrentIndex(1) ; int index = team->currentIndex() ; connect( team, SIGNAL(activated(int)), this, SLOT(hoge(int)) );
b = new QRadioButton( "watch TV" , this ); connect(b, SIGNAL(clicked()), this, SLOT(hogehoge()) ) ;
QCheckbox* cb = new QCheckBox("music", this ) ; cb->setChecked(true) ; connect( cb, SIGNAL(clicked()), this, SLOT(hogehoge()) ) ; : if (cb->isChecked()) .....