[Solved] QTimer /QtabWidget update function not works
-
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 -
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 -
no errors in the code you've posted.
So there is probably a mistake in the code of your StandardWidget implementation? -
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 -
update is fine
there must be some mistake in 'setupRealtimeCpuUserUsagePlot'
slot -
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 -
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 -
Hi,
I have found a couple of static variables, i modified them and now it is working correctly.
Thank you ,
Sil