Alternative To ChartView in QML - qt

I'm Trying to create an AreaChart Using ChartView over a QApplication on Raspberry Pi But no matter how small or big the chart is, QApplication Increase Start Time of my App to Over 20 sec and after that about 5-10 sec to show chart.
is there any alternaive to ChartView to use on QML that use faster QT based Object(QGuiApplication,etc) ??
or is there any method to increase run time of QApplication (Beside what they said in This)
QT Version = 5.11.3
any help would appreciated.

Related

Delay painting in Qt

I'm building a real-time system in Qt. Every 20 ms I need to paint 5 points in a QFrame to make the painting of a signal looks like real time. When I only paint the signal in the QFrame, the call to paintEvent() is done with the desired frequency, 20 ms. But when I focus on another QWidget or when I show another window (in other words, when I perform another painting action that isn’t very simple) the call to paintEvent() starts to slow down and the samples of the signal are accumulated.
The call to the function paintEvent() is made from the call to the function update() of the QFrame every 20 ms. In Qt you cannot separate the painted gui into threads. Therefore, the call to paintEvent() runs in the same thread as the call to the functions responsible for the other actions of painting in the gui. This causes that when focusing another QWidget, when the processing associated with painting a box in the QWidget is delayed, the event of painting the signal is delayed.
The question is whether there is any way to make the event to paint signal priority, so that paintEvent() is called with the same frequency, no matter what it is done in the gui. I use repaint instead of update, because in the help of Qt it says that repaint makes the direct call to paintEvent(), but the result was disastrous.
Any other idea will be of great help.

No closeEvent received by QMainWindows in the QApplication of a subprocess

I have a main QApplication (with a single QMainWindow) which starts a sub-process running another QApplication with several QMainWindows.
These QMainWindows save their position and size when closed, as I defined in the closeEvent() method.
The problem: When I quit the main QApplication by closing its QMainWindow, the QMainWindows in the subprocess are closed without receiving a closeEvent, and consequently do not store their position and size.
The question: What is the solution ?
Thanks

How to create a custom multi-progress bar in Qt

I am working on a multi -segment download manager. I want to display the segmentation procedure. QGraphicsScene works fine but , unfortunately it slows the download. Is there any better option, other than using QProgressBars.
I am using QNetworkAccessManager to download files. If I connect the downloadProgress signal of QNetworkManager object to a slot of Main Gui Thread which draws on QGraphicsView, the download speed decreases even upto 10 times in some cases
// a custom progress bar
void Download::showGProgress(int num, float prgrss) //slot
{
prgrss=prgrss/100;
x_coord=(ui->graphicsView_2->width()-3)*prgrss;
for(float b=0;b<=x_coord;b=b+0.5)
{
progress.addRect(0,0,x_coord,y_coord);
}
}
QNetworkAccessManager is not threaded. It is asynchronous, using the current threads eventloop. It is the HTTP requests which it create that are the threaded aspect.
This would explain why anything you do in your main thread could theoretically slow down the operations of the download. Though not necessarily the underlying threaded download itself, but rather the signaling response time that would allow you to have fast feedback about it.
What you should probably do is create your own QThread subclass, and create the QNetworkAccessManager in the run() method. And then create a QEventLoop in the thread and call exec()
In a nutshell, you need to create your own Threaded QNetworkAccessManager.
create your own widget to do what you would like
this is easier than it sounds.
Make a class that subclasses from a QWidget. And in this widget make a Horizontal Sizer that contains 100 Qlabels (store the QLabels in a vector). Give it slots to 'update' the current progress by setting the background color of each QLabel to a different color. This should be fairly easy to do progressively, meaning you store the current 'percentage' as a member variable and then only adjust the fields that are necessary to get to the percentage that you're looking for (This will eliminate some flickering if you were to do it from scratch every time).
Add functions that will switch the sizer to a vertical one instead of a horizontal one to make it even more customizable.
This allows you to get creative in the what you can do for the progress bar as each element could be a different picture, or a different color, or whatever you would like.
Did you try QProgressBar? Maybe you can write a subclass of it to handle your own properties.

Open GL performance on QT

I am using the QT 4.8 with Open GL ES 2.0 (created my set of shaders etc...)
Running the entire application from within QGraphicsView that owns a QGraphicsScene, I get relatively low fps although I am rendering a simple model (around 30 fps).
The scene render itself is triggered by a timer that fires at 50Hz (that can be changed).
What would be the most time consuming sections to attend in order to improve the frame rate?
Also, I noticed (using gDebugger) that the functions and states associated with the GL_STENCIL_TEST and GL_SCISSOR_TEST are killer consumers here (over 30% of the time goes on that). Is there anyway to bypass that?
Thanks.

Adobe Flex Timer Event

I just have a one quick question on Timer and TimerEvent (flash.events.TimerEvent & flash.utils.Timer) of Adobe Flex.
I am currently working on a project wherein I need to occasionally change speed, stop and play an swf animation (loaded to a loader and instantiated as a ByteArray).
Example, I have a moving car (swf animation) running at 40kph. Then I have a button which will change the speed by increments of 40kph. SO basically, whenever I hit the button, the playing car should change speed by the increment. The difficult part is, I already had this working in Adobe Flex but it doesn't change the speed yet. I mean, it only moves by the keyframe interval I set when I created the swf file on flash (which is, to say, 30 frame interval per keyframe).
So in short, I just need to make the speed change depending on how many increments I asked it to change. A colleague told me to use Timer and TimeEvent of Flex but I can't seem to quite get the hang of it since I'm still new to the ActionScript world.
I hope someone can help me. Thanks :)
You need to animate the car from the code. The following code speeds up wheels until 120 km/h:
private var car:MovieClip;
private var speed:Number; // from 0 to 120
private function enterFrameHandler(event:Event):void
{
if (speed < 120)
speed++;
car.wheel1.rotation += speed;
car.wheel2.rotation += speed;
}
The idea is to calculate animation parameters for every new frame "on the fly".

Resources