What is the difference between update and repaint?

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ค. 2024
  • Have you ever wondered what the difference is between QWidget::repaint() and QWidget::update()?
    You may even have heard that update events collapsed into just one event in the event loop, which might make you ask the question on whether there are other events merged together.
    Let's debug into the Qt source code to get an answer.
    0:00 Intro
    0:27 Repaint and update and tearing
    3:47 Seeing the call stack for repaint in the debugger
    6:25 Now see the call stack for update
    11:01 Compression of mouseMoveEvent
    13:08 Turn of compression using XCB
    14:40 Compression on windows
    15:15 Move and resize event
    17:07 Hope you did learn something from this episode
    Links:
    * Episode talking about the d-pointer: • Reading the Qt Source ...
    * Event compression of mouse events using xcb: codebrowser.dev/qt6/qtbase/sr...
    * TH-cam series on multithreading with Qt: • Multithreading with Qt
    The example code showcased in this video is available here: github.com/KDABLabs/kdabtv/tr...
    All Qt Widgets and more videos:
    • Qt Widgets and more
    About the host:
    The video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core - Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.
    Every month our newsletter is featuring technical blogs on Qt, C++ and 3D topics: www.kdab.com/development-reso...
    About KDAB:
    KDAB offers experienced software experts to help you deliver functional, high-performing and innovative software across embedded, mobile and desktop platforms for projects using C++, Qt, QML/Qt Quick, OpenGL, Qt 3D and more. www.kdab.com/software-services
    KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrolment courses around the world. We are the market leaders for training in Qt, OpenGL and C++.
    Contact us to find out more at training@kdab.com or visit our website: www.kdab.com/software-service...
    We are over 100 people, located all around the world. Our Head Office is in Sweden and we have other offices in Germany, France, the UK and the USA. www.kdab.com/about/contact/
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 2

  • @gw6000
    @gw6000 หลายเดือนก่อน +1

    Thank you for the video. It reminds me of another subtle difference between size and sizeHint. I wonder how they differ from each other?

    • @blackiedk
      @blackiedk หลายเดือนก่อน +2

      size() is the actual size of the widget (as in number of pixels you actually see on the screen). sizeHint() is the widgets request ("In a perfect world, I'd like to be 500x200 pixels"). It might not get it, but might have to settle with less or it might resized larger. Hope that helps. Much more details can be found in the intro to qt widgets training, more specially episode 24: th-cam.com/video/G1tBD7TDEm8/w-d-xo.html
      Cheers
      Jesper.