qcomboboxをqwtsliderに接続しようとしていますが、comboxにはmmとpixelの2つのオプションがあります。そのオプションを選択したときに、スケールをピクセルまたはmmに変更したいと思います。スロットとして機能する関数をいくつか作成しました。それらは次のとおりです。
void planevolume::mm()
{
ui->Slider->setRange(xmin, xmax/(256/3), 1.0/(256/3));
ui->Slider->setScale(xmin, (xmax+1)/(256/3), ((xmax+1)/16)/(256/3));
connect(ui->Slider, SIGNAL(valueChanged(double)), ui->lcdNumber, SLOT(display(double)));
}
void planevolume::pixel()
{
ui->Slider->setRange(xmin, xmax, 1.0);
ui->Slider->setScale(xmin, xmax+1, (xmax+1)/16);
connect(ui->Slider, SIGNAL(valueChanged(double)), ui->lcdNumber, SLOT(display(double)));
}
接続ボックスからの信号を使って接続できると思いました。私の接続ボックスはこれです:
ui->comboBox->insertItem( 1, QString("pixel"));
ui->comboBox->insertItem( 2, QString("mm"));
そして、彼らは選択するスロットを作成します:
void planevolume::currentIndexPixel()
{
ui->comboBox->currentIndex(1);
}
void planevolume::currentIndexMM()
{
ui->comboBox->currentIndex(2);
}
彼らはそれをこのように接続します:
connect(this, SIGNAL(currentIndexPixel()),ui->Slider, SLOT(pixel()));
connect(this, SIGNAL(currentIndexMM()),ui->Slider, SLOT(mm()));
しかし、私はこのようなエラーが発生し、何が間違っているのかわかりません:
error: no matching function for call to ‘QComboBox::currentIndex(int)’
/usr/include/qt4/QtGui/qcombobox.h:184: note: candidates are: int QComboBox::currentIndex() const