Qt qml running too slow - c++

I am using olimex A20Lime2 board with Linux OS. I have created Qt QML desktop application using qt 5.3.2 with QtQuick2. My application needs to update qml gui on every 100 ms but it takes 2-3 secs to update it as well as when button is clicked it takes 4-5 secs to change the color of button or change the image.
I have used C++ as much as possible. And updating qml items such as Text by using signal and slot methods. Overall working of qml UI is too slow. How can make it more fast?

Related

OpenCV putText without a GUI thread, or named window?

I would like to put a UTF8 text using a specific font on my cv::Mat and I don't want to use OpenCV's GUI elements (windows). I compiled OpenCV 3.4.3 against Qt 5.11.1 and it works fine.
I understand that calling cv::addText function crashes duo to lack of GUI thread, in case no window is created by cv::namedWindow or cv::window. So I want to know if there is a way to somehow hide a previously created window, or even start GUI thread without actually having a window?

QT: Set FPS for an Application

I am new in QT. I want to create an application, In which i can set the FPS on basis of user input.
Is there any way to achieve this.
Currently i am loading my URL using QWebView. current FPS is constant and i cant change it. So is there any way in QT to change the FPS on QWebView or in other classes.

OpenGL in Qt Quick cross platform application

I'm trying to develop a cross platform (or at least desktop + embedded hardware) application. I would like to use Qt Quick to create a touch friendly GUI. I have been implemented a classical application with a QGLWidget displaying data. It is important that only a part of the window is in OpenGL. Because of this there are problems with EGLFS and LinuxFB. Only X11 (or maybe Wayland) can display the application properly (others generates a couple of errors about missing setParent function and the whole screen is black). Now I'm trying to achieve the same thing in QML. I want to use this OpenGL renderer as part of my QML application and some Qt Quick widgets around it. I found a couple of people asking about the same thing and the answer is always to subclass QDeclarativeItem and call the painter's beginNativePainting() (the others says to export it through QDeclarativeItem, but I cannot figure out how to do this). The problem is that on desktop, Qt 5.11 the native painter is not OpenGL. And in QT5 there is no way to force OpenGL graphics system. So when I try to get the OpenGL context (QGLContext::currentContext()) I always get NULL. Another problem: If I export my widget with qmlRegisterType("Test", 1, 0, "Test"); it becomes only visible when I use QDeclarativeView, but then it doesn't sees Qt Quick. If I use QQuickView it says module "Test" is not installed. How can I implement this properly?
QDeclarativeItem is from Qt Quick 1 and Qt4. With Qt 5 and Qt Quick 2 you should use QQuickItem.
There is at least 1 example of this provided with qt docs, which you can find in Qt Creator in the Welcome tab in the Examples section.

Resize size of Main Window depending on Hardware in Qt?

I have developed my Application with most of the Widgets in Qt Creator's Designer module.
I have hard coded the sizes of my widgets depending on how they appeared on my laptop. Yesterday when I ran the application on my Desktop (lower screen resolution than laptop) some of the Main Window widgets were not visible & on startup there was horizontal scrollbar & I had to scroll to see those widgets; which is not the case on my laptop.
I have 2 problems:
Is it possible to resize all of my widgets (even those which are added run time by code) by using some resize factor? Maybe at startup I will get the screen resolution of Hardware in which application is running & then create a ratio of that with resolution of my laptop. Is it possible to multiply this factor to all widgets without adding code for each widget?
How do I get the resolution of the Screen in which my Application is running?
PS: I would like to know the defacto method of solving this problem...
Thank You.
You could try a function like this:
resize(theDesktop->screenGeometry().width()*PERCENTAGE_OF_MONITOR_WIDTH_FOR_SCREEN, theDesktop->screenGeometry().height()*PERCENTAGE_OF_MONITOR_HEIGHT_FOR_SCREEN);
Resize is a member function of the QWidget class and the PERCENTAGE_OF_MONITOR variables would be whatever percentage of the monitor you want your application to take up.
theDesktop is of the type QDesktopWidget.
You should use Layouts to manage the size policy of your widgets.
Qt layouts automatically position and resize widgets when the amount of space
available for them changes, ensuring that they are consistently
arranged and that the user interface as a whole remains usable."
You could also check this question for more information regarding layout machanisms in Qt.
Qt website has got excelent documentation on the subject. You can start here for more information on working with layouts in Qt Designer.

Qt QML/C++ translucent window has glitches and performance problems on Mac OS X

I've developed a Qt/QML application which I display with a translucent QDeclarativeView in a translucent frameless QMainWindow (see this). The application is fairly complex with a a few ListViews inside and some threads that poll a remote server for data and feed the views. The program runs flawlessly and at full speed without glitches on Windows 7. But when I compile and run it on Snow Leopard I've got the following problems;
GUI rendering is slow in general
When I scroll the ListView with the mouse wheel, the wheel actions affect the underlying window and my GUI flickers as if it can't render fast enough. Also often when I click something on my GUI, the mouse click just passes through my window onto the underlying window and brings it in front.
Mouse actions feel awkward. There is a significant delay.
These problems are present on both the Release and Debug builds with/without gdb attached.
The problems sound related to me but I'm confused. Why would an application running perfectly on Win7 perform badly on Snow Leopard ? Am I missing some specific configuration ?