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. [Solved] Update nonactive window in Qt 4.
Forum Updated to NodeBB v4.3 + New Features

[Solved] Update nonactive window in Qt 4.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 4.4k 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.
  • H Offline
    H Offline
    HyperEngineer
    wrote on 1 Nov 2010, 19:21 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marsupial
      wrote on 1 Nov 2010, 21:46 last edited by
      #2

      Have you tried the repaint()-function? I'm not sure, but it might work...

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HyperEngineer
        wrote on 2 Nov 2010, 14:47 last edited by
        #3

        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

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on 4 Nov 2010, 10:44 last edited by
          #4

          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);
          

          @

          1 Reply Last reply
          0
          • H Offline
            H Offline
            HyperEngineer
            wrote on 4 Nov 2010, 20:14 last edited by
            #5

            Thanks for the reply. The program now works.

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on 4 Nov 2010, 20:39 last edited by
              #6

              ah cool, what made it not to work earlier? could you share that info ?

              1 Reply Last reply
              0

              1/6

              1 Nov 2010, 19:21

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved