Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Exception triggered error while going down in Tableview?



  • Hi,
    I use Qt 5.13.2 and PostgreSQL12 on windows platform.
    I get the sql query and send it as model to tableview. When I push down arrow button continiously I get error and program crush?!

    67a882b6-3305-447a-8693-560e45e6f9fb-resim.png

    I run it via debugger and there is nothing detailed about error?!...

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    Please remove the processEvents() stuff - it's not needed at all. Please also show us the backtrace when it still happens.



  • Hi,
    I think I found the problem but I son't know the reason?

    I use hourglass icon while the view process is working

    this->setCursor(Qt::WaitCursor);
    QApplication::processEvents();
    .
    .
    //Process
    .
    .
    this->setCursor(Qt::ArrowCursor);
    QApplication::processEvents();
    
    
    

    When I close these lines than no problem...

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    What happens inside this block and why do you call QCoreApplication::processEvents()?



  • Hi @Christian-Ehrlicher ,
    Some SQL process. I want to show hourglass while retrieving data from PostgreSQL.

    Code is below,

    modelTableAgac->setQuery("SELECT is_emri_detay.sn, is_emri_detay.stok_kod, stok_kart.stok_ad, "
                                 "is_emri_detay.recete_birim, is_emri_detay.recete_miktar, is_emri_detay.aciklama "
                                 "FROM is_emri_detay LEFT JOIN stok_kart ON stok_kart.stok_kod = is_emri_detay.stok_kod "
                                 "WHERE kaynak_sn = " +
                                 index.sibling(index.row(), 0).data().toString() +" ORDER BY is_emri_detay.sn;", baglanti::mdb());
    
        ui->tVurunAgaci->setModel(modelTableAgac);
    
        ui->tVurunAgaci->resizeColumnsToContents();
        ui->tVurunAgaci->horizontalHeader()->setSectionResizeMode(5, QHeaderView::Stretch);
    
    
    
    
        modelTableoperasyon->setQuery("SELECT sn, operasyon_sira_no, tezgah_kod, sure_dk, adam_adet, aciklama "
                                      "FROM is_emri_operasyon WHERE kaynak_sn = " +
                                 index.sibling(index.row(), 0).data().toString() +" ORDER BY operasyon_sira_no, sn;", baglanti::mdb());
    
        ui->tVOperasyon->setModel(modelTableoperasyon);
    
        ui->tVOperasyon->resizeColumnsToContents();
        ui->tVOperasyon->horizontalHeader()->setSectionResizeMode(5, QHeaderView::Stretch);
    

    By the way I ussed it to inform operating system that pointer has changed.
    And now I commented it and tred again. Same error happened...

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    Please remove the processEvents() stuff - it's not needed at all. Please also show us the backtrace when it still happens.



  • Hi @Christian-Ehrlicher ,
    I am so sorry. I have been changing another part of the code. :)

    I removed ProcessEvents() and now it's OK... :)

    Regards,
    Mucip:)



  • @Christian-Ehrlicher ,
    By the way, what is the problem with ProcessEvents()???

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    processEvents spins a new eventloop - this means events in the queue are processed which may interfere with your stuff.


Log in to reply