Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Connecting QDataWidgetMapper::cuurentIndexChanged(int) to a Slot
Forum Updated to NodeBB v4.3 + New Features

Connecting QDataWidgetMapper::cuurentIndexChanged(int) to a Slot

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 212 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zeroptr
    wrote on last edited by
    #1

    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 ?

    Linux Mint 20.04 64 Bit QT6.0.1

    JonBJ 1 Reply Last reply
    0
    • Z zeroptr

      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 ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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 1 Reply Last reply
      3
      • Z zeroptr has marked this topic as solved on
      • JonBJ JonB

        @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 Offline
        Z Offline
        zeroptr
        wrote on last edited by
        #3

        @JonB thanks a lot I'm still at old days sorry..

        Linux Mint 20.04 64 Bit QT6.0.1

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved