[Solved] Update nonactive window in Qt 4.
-
I have a nonactive window that is visible. I have an active window that sends data to the nonactive window that uses it to update controls in the window. If I use update() the nonactive window does not update until it is activated. Is there a function that updates the visible part of a nonactive window?
-
I have tried repaint() as well. The same results. The nonactive window only updates when it becomes active. I tried to use QApplication::processEvents(0), but I get an error when I build it. The error is:
MainForm.cpp:933: error: incomplete type 'QApplication' used in nested name specifier
-
I was able to call repaint() of the inactive window and it worked fine.
can you post some sample code where it is failing to repaint?
@
void ChildWindow::paintEvent(QPaintEvent *pe)
{
qDebug() << "My window name is" << wName() << " " << flag;
if (flag)
{
qDebug() << "inside paint of childwindow: " << wName();
MainWindow::clik1(); //this method changes button names
}
MainWindow::paintEvent(pe);
}void ChildWindow::setFlag()
{
flag = true;
repaint();
}void ChildWindow::updateWin(ChildWindow *w)
{
qDebug() << "firing single shot now from active window";
QTimer::singleShot(5000, w, SLOT(setFlag()));
}
@this is how I called the 2 child windows ...
@
ChildWindow c;
c.setWName(new QString("c"));
c.setGeometry(10,10,400,400);
c.show();ChildWindow c1; c1.setWName(new QString("c1")); c1.setGeometry(510,510,400,400); c1.show(); c1.setFocus(); c1.updateWin(&c);
@
-
Thanks for the reply. The program now works.