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. repaint() on macOS
Forum Updated to NodeBB v4.3 + New Features

repaint() on macOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 123 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote last edited by Perdrix
    #1

    I've got some long running code that needs to notify the user that it is going to take a while.

    Here's what I do:

    			if (zgFWHM.empty())
    			{
    				ZTRACE_RUNTIME("FWHM interpolation");
    				message->setText(tr("Interpolating FWHM data.  Please be patient."));
    				message->repaint();
    
    				GridData::interpolate(xValues, yValues, fwhmValues, xg, yg, zgFWHM, GridData::InterpolationType::GRID_NNIDW, 10.f);
    
    				message->setText("");
    				message->repaint();
    				ZTRACE_RUNTIME("FWHM interpolation complete");
    			}
    

    This works nicely on Windows and Linux, but on macOS, the message isn't repainted (it's a QLabel).

    Is this what I should expect? If not what can I do to ensure the text of the label is updated? Or is it a bug?

    Changing the lines that read message->repaint(); to read just repaint(); made no difference.

    Oops - forgot to mention: This is Qt 6.10.0

    UPDATE:

    I did manage to "hack" round the problem by adding:

    #if defined(Q_OS_MAC)
    				QCoreApplication::processEvents();
    #endif
    

    after the first message->repaint();, but I'm pretty sure I shouldn't need to do that!

    David

    1 Reply Last reply
    0
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote last edited by
      #2

      bump ... anyone have ideas about this - is it a bug - if so I will report it.

      1 Reply Last reply
      0
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote last edited by
        #3

        Simply don't block the eventloop...

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher referenced this topic
        • PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote last edited by
          #4

          After a lengthy tussle with QtConcurrent::run() (which is why the delay in responding), I managed to move the long running interpolation code off to another thread.

          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