Connecting QDataWidgetMapper::cuurentIndexChanged(int) to a Slot
-
Hi All
I have simple form that declares
QSqlQueryModel *modKomponent;
QDataWidgetMapper *dwmKomponent;at .h file
and under private slots section I have
void dwmKomponent_currentIndexChanged(int index);At cpp file
void MainWindow::dwmKomponent_currentIndexChanged(int index) { qDebug()<< index; }at construction
modKomponent->setQuery("select t_komponent.*,t_calibrations.* from t_calibrations inner join t_komponent on t_calibrations.komponent_id = t_komponent.komponent_id order by t_calibrations.komponent_id",db); // modKomponent->setQuery("select t_komponent.* from t_komponent ",db); ui->tblKomponent->setModel(modKomponent); dwmKomponent = new QDataWidgetMapper; dwmKomponent->setModel(modKomponent); ui->tblKomponent->resizeColumnsToContents(); dwmKomponent->addMapping(ui->lineEdit,0); dwmKomponent->addMapping(ui->lineEdit_2,1); dwmKomponent->addMapping(ui->lineEdit_3,2); dwmKomponent->toFirst(); connect(dwmKomponent, SIGNAL(dwmKomponent->currentIndexChanged(int index)),this, SLOT(dwmKomponent_currentIndexChanged(int index)));I tried many connection models but I always have
qt.core.qobject.connect: QObject::connect: No such signal QDataWidgetMapper::dwmKomponent->currentIndexChanged(int index) in ..\dwmDENE\mainwindow.cpp:33
qt.core.qobject.connect: QObject::connect: (receiver name: 'MainWindow')I always have No Such Signal
How can I connect this ? -
Hi All
I have simple form that declares
QSqlQueryModel *modKomponent;
QDataWidgetMapper *dwmKomponent;at .h file
and under private slots section I have
void dwmKomponent_currentIndexChanged(int index);At cpp file
void MainWindow::dwmKomponent_currentIndexChanged(int index) { qDebug()<< index; }at construction
modKomponent->setQuery("select t_komponent.*,t_calibrations.* from t_calibrations inner join t_komponent on t_calibrations.komponent_id = t_komponent.komponent_id order by t_calibrations.komponent_id",db); // modKomponent->setQuery("select t_komponent.* from t_komponent ",db); ui->tblKomponent->setModel(modKomponent); dwmKomponent = new QDataWidgetMapper; dwmKomponent->setModel(modKomponent); ui->tblKomponent->resizeColumnsToContents(); dwmKomponent->addMapping(ui->lineEdit,0); dwmKomponent->addMapping(ui->lineEdit_2,1); dwmKomponent->addMapping(ui->lineEdit_3,2); dwmKomponent->toFirst(); connect(dwmKomponent, SIGNAL(dwmKomponent->currentIndexChanged(int index)),this, SLOT(dwmKomponent_currentIndexChanged(int index)));I tried many connection models but I always have
qt.core.qobject.connect: QObject::connect: No such signal QDataWidgetMapper::dwmKomponent->currentIndexChanged(int index) in ..\dwmDENE\mainwindow.cpp:33
qt.core.qobject.connect: QObject::connect: (receiver name: 'MainWindow')I always have No Such Signal
How can I connect this ?@zeroptr said in Connecting QDataWidgetMapper::cuurentIndexChanged(int) to a Slot:
SIGNAL(dwmKomponent->currentIndexChanged(int index))You can't write
dwmKomponent->...here.New style signal/slot connects (https://wiki.qt.io/New_Signal_Slot_Syntax, https://doc.qt.io/qt-6/signalsandslots.html) have been available for more than a decade! I give up on how many people have not changed over, it's a shame. If you used them you would understand much better.
connect(dwmKomponent, &QDataWidgetMapper::currentIndexChanged, this, &MainWindow::dwmKomponent_currentIndexChanged); -
Z zeroptr has marked this topic as solved on
-
@zeroptr said in Connecting QDataWidgetMapper::cuurentIndexChanged(int) to a Slot:
SIGNAL(dwmKomponent->currentIndexChanged(int index))You can't write
dwmKomponent->...here.New style signal/slot connects (https://wiki.qt.io/New_Signal_Slot_Syntax, https://doc.qt.io/qt-6/signalsandslots.html) have been available for more than a decade! I give up on how many people have not changed over, it's a shame. If you used them you would understand much better.
connect(dwmKomponent, &QDataWidgetMapper::currentIndexChanged, this, &MainWindow::dwmKomponent_currentIndexChanged);