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] QTimer /QtabWidget update function not works

[Solved] QTimer /QtabWidget update function not works

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.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.
  • Z Offline
    Z Offline
    zolidznake
    wrote on last edited by
    #1

    Hi guys,

    Since a couple of days I am struggling to find a way to fix the next problem.

    i have a widget that i want to add it to a qTabwidget (this works.)

    In the widget that I want to add it to multiple tabs i have a timer that triggers every 2 second a function and is updating some charts.

    the problem is next:

    i create 2 widget objects from the same class and i add them to 2 tabs. In first tab the graph are working, in the second tab it's not working.

    as reference i atach the following code:
    @
    monitoringWidget = new StandardWidget();
    QScrollArea *area = new QScrollArea();
    StandardWidget *widget = new StandardWidget;
    area->setWidget(widget);

    QScrollArea *area2 = new QScrollArea();
    area2->setWidget(monitoringWidget);
    
    
    QTabWidget *tt = new QTabWidget();
    tt->addTab(area, "Tab1");
    tt->addTab(area2, "Tab2");
    

    @

    Any sugestion will be very appreciated.

    Kind regards,
    Sil

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kqt-mr-nv6
      wrote on last edited by
      #2

      are the widgets (StandardWidget) getting added in both the tabs ?

      bq.
      i create 2 widget objects from the same class and i add them to 2 tabs. In first tab the graph are working, in the second tab it’s not working.

      is it the graph, that it is not working in the second tab ?
      or addition itself is failing

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        no errors in the code you've posted.
        So there is probably a mistake in the code of your StandardWidget implementation?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          zolidznake
          wrote on last edited by
          #4

          Hey,

          Yes the widgets, are both in tab1, respectively tab2 but only in the first tab the graphs are being updated.

          in StandardWidget i use this to update the graphs.

          @ connect(&dataTimer,SIGNAL(timeout()),this , SLOT(setupRealtimeCpuUserUsagePlot()));
          dataTimer.start(2500);@

          Kind Regards,
          Sil

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kqt-mr-nv6
            wrote on last edited by
            #5

            update is fine
            there must be some mistake in 'setupRealtimeCpuUserUsagePlot'
            slot

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zolidznake
              wrote on last edited by
              #6

              Hi,

              the idea is very basic and normaly it works, but when i create a couple objects of that type only 1 graph is working and this is my problem.

              !http://s17.postimg.org/54r0op4tr/app1.png(example)!

              i can't figure out where i did wrong...i have tryied using threads but with no luck

              Regards,
              Sil

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kqt-mr-nv6
                wrote on last edited by
                #7

                if multiple objects are not behaving similarly
                you might have used static variables in the function
                that is the only possible way for the behaviour

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  zolidznake
                  wrote on last edited by
                  #8

                  Hi,

                  I have found a couple of static variables, i modified them and now it is working correctly.

                  Thank you ,

                  Sil

                  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