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

What is the equivalent of QUpdateLaterEvent in Qt 5.13



  • Hi,
    I have simple camera program written in Qt 4.8 and now I want to use it to 5.13 but I have errors.

    In the code it used like below

    void CWidgetPaint::DisplayImageFromAnotherThread(LvStream* pStream, LvBuffer* pBuffer)
    {
        m_pStream = pStream;
        m_pBuffer = pBuffer;
        QRect Rect;
        Rect.setHeight(m_iSrcHeight);
        Rect.setWidth(m_iSrcWidth);
        QApplication::postEvent(this, new QUpdateLaterEvent(Rect));
        
    }
    
    
    

    And the bottom pf the page ther eis below code:

    
    //-----------------------------------------------------------------------------
    // This is needed to satisfy the linker,
    // copied from QEvent.cpp, to be checked with new QT version!
    
    
    QUpdateLaterEvent::QUpdateLaterEvent(const QRegion& paintRegion)
        : QEvent(UpdateLater), m_region(paintRegion)
    {
    }
    
    QUpdateLaterEvent::~QUpdateLaterEvent()
    {
    }
    

    Well, what is the equivalent use of this in Qt 5.13?

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    QUpdateLaterEvent was even a private class in Qt4 which could only be used on Linux because all symbols were exported by default there, did not work on Windows.
    What do you want to achieve with this type of event? Why not simply call QWidget::update()?



  • Hi @Christian-Ehrlicher ,
    Very good question. I don't know why? The code is sample and comes from GigEPro industrial camera software.

    How can I change it as you advice?...

    By the way I use Debian Linux also...

    Regards,
    Mucip:)


  • Lifetime Qt Champion

    Hi,

    This is an educated guess: from the looks of it, that application received image data from a different thread, maybe through a callback. Hence when the image reached the GUI, it couldn't be painted directly because of said thread. Thus sending that event would trigger an update of the GUI through the next loop iteration.

    What you can do (and what could already have been done then) is to use QMetaObject::invokeMethod with a queued connection type to call update on the widget.


Log in to reply