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.
Related
I'm trying to adapt the C++ non QML camera example in QT 5.11 so that it can intercept and add a visual time stamp to the video frames before they are written to the video file.
I want to achieve this without the use of QML.
There is a way to intercept the frames with QVideoprobe but the frame is passed in by const ref and so can't be modified.
Any suggestions except to use qml would be appreciated
Update - the typical way of doing this is to use QAbstractVideoFilter but all the examples I've found only show the filter being applied with QML so I'm initially looking to see how the filter can be applied to the QCamera pipeline in C++.
I'm using QLabel and QPixmap to show image in my program. I would like to use something like snipping tool in Windows to let user to select part of image that will be processed further.
For example, I load image, user select part of it (rectangle), and it shows it is selected and I can read coordinates that are selected, so I can proceed with processing only part of image.
I don't think this is possible with Qt without a fair amount of coding.
Maybe a third-party Qt widget, such as https://github.com/dimkanovikov/ImageCropper, is what you're looking for?
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?
I'm looking to make a sprite animation editor. I have the loading of my custom animation file done but now need to get the actual ui started. I'm really just stuck on what widgets I would use to actually play my animation. I need to be able to go to certain frame, play, pause, loop, etc. Once I'm done with the viewing portion I plan on adding in the editing.
I've seen AnimatedSprite in qt docs but that seems to only allow playback of sprites in the same file. In my situation sprites can be from multiple image files and sometimes doesn't follow a grid like sprite cutter.
First of all, you should decide whether you want to use QML or Widgets. AnimatedSprite is QML related class. All widget-related classes starts with "Q" letter.
If you decide to use Qt Widgets, I would recommend to take a look at Qt Animation Framework in combination with Qt Graphics View Framework. Most likely it will not let you do everything you want out of box, but it should provide you with a rich set of useful tools.
If you need here are some examples.
Hope it helps.
Have a look at QMovie. This class may provide all the methods you need, as long as you only want to use it for viewing. The QMovie can be passed to a QLabel to show the animation.
QMovie however supports only gif out of the box (and there is a third party plugin for apng files). You would probably have to create your own image handle plugin to support your format.
If thats not applicable or to complicated, you will most likely have to create your own custom widget. Have a look at the painter example. Playing an animation is not that hard if you have all the frames. A simple QTimer to change the image to be drawn in a constant rate should work.
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.