c++ - QApplication::processEvents not working in Windows -


i working on project presents live data acquired in real-time using qcustomplot plug-in qt. display has black background color, , multiple channels of data colored differently. when taking screenshot, make printer-friendly, background white , data black. thinking of solution this:

  1. change colors way want manipulating pointers graphical objects
  2. grab screenshot using qwidget::grab() qpixmap
  3. change colors normal

this did not work @ first, because system not change colors in time screenshot taken. used qapplication::processevents(), , worked on mac.

however, not work on windows 7 (which required). ideas do?

code:

qsting filelocation = "..."; togglecolors(false); //function toggle colors qapplication::processevents(); qpixmap shot = grab(); togglecolors(true); shot.save(filelocation, "png"); 

again. works on mac, not windows.

update 1. content of togglecolors include:

  if(enable)     ui->plot->setbackground(qbrush(qt::black));   else     ui->plot->setbackground(qbrush(qt::white));   ui->plot->repaint(); 

i tried ui->plot->update() instead.

i not sure problem on windows specifically, recommend calling qwidget::update() on given widget. forces next update re-render itself.

on other hand, i'm not sure why togglecolors() didn't somehow cause happen.

also, ensure qwidget::setupdatesenabled(bool) wasn't set "false."


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -