Qt5 Double range slider - qt

There are many postings online about trying to make a double range slider
The most common answer I found is to use libqxt. However, going to the website it clearly states it is not maintained due to internal api changes with newer versions of Qt.
Does Qt5 provide any new functionality for this, or is there a longer lasting Qt implementation that provides this functionality without requiring large external libraries?

If Qt Quick is an option, Qt Quick Controls 2 has a RangeSlider (in three different styles). The module has tech preview status in Qt 5.6, but is a proper module in 5.7.
Here's the Default style RangeSlider:

From what I have read there are only two ways to go about getting a double range slider.
Use Qt4
You can use Qt4 and download libqxt. Libqxt already has that feature implemented so it shouldn't be too hard if you know how to use Qt4.
Two sliders on top of one another
http://qt-project.org/doc/qt-4.8/widgets-codeeditor.html
^That doesn't explain how to use double sliders, but it may help you figure out ho to draw two sliders on top of each other.
You can also use that same technique to draw the colors in between the two values.

Related

Drawing with EGL in Qt

I'm trying to get Qt and EGL to work together. I'm working on a program that uses EGL to draw, and I have to use Qt to create a GUI overlay.
The current solution was to turn a QWidget into a native window, and pass it's window handle to EGL. This works, but it's difficult to work with. Qt isn't aware that the widget is being drawn in by something else. So when another widget is overlaid, even if it's transparent, the image drawn by EGL is erased. The only way to get them to work is if I jigsaw the buttons and other GUI elements in a way that they don't overlap the parts of the native window I want to show. However this means that I can't use layouts or QML or any of the tools that would make creating different GUIs easy.
So my question is, how can I draw with EGL into Qt in a more usable way.
I'm working with Qt 5.4.2 by the way. If absolutely necessary, I might be able to upgrade to 5.5, but newer versions won't work.
I was looking into QOpenGLContext, and ways to make it use the context created by EGL, but I can't seem to find any good examples on how to actually go about doing this.

Qt Automotive Embedded Cluster (ICP)

I am new to Qt and was curious if we can develop HMI for a Cluster(Instrument Cluster Panel) using Qt.
Can someone share a demo?
I might be in a wrong place to post this question, please don't flag.
I am looking for Examples/Demo in QT 5. (5.3.1)
Look at this widgets on Qt Apps website:
http://qt-apps.org/content/show.php/AnalogWidgets?content=87780
As you can see there are many beautiful widgets. For example:
There is also Qwt: well documented tool with a lot of different technical widgets.
http://qwt.sourceforge.net/index.html
From here
A good example is a dial-type control which combines Image elements with Rotation transforms and SpringAnimation behaviors to produce an interactive speedometer-type dial. You can find the example in the installed Qt directory in Examples/Qt-5.3/quick/customitems/dialcontrol.

Is there any plan to add Qxt features to Qt?

Qxt is an extension library for Qt providing a suite of cross-platform utility classes to add functionality not readily available in Qt. Qxt consists of several modules, each of which lives in a separate library. It has many nice features like:
QSlider with two buttons
Rotating & richtext buttons and labels
LineEdit with sample text
managing many screen settings
String SpinBox
Check ComboBox
Global Shortcut (hot keys)
Schedule View
Tooltip with arbitrary widget on it
RPC(connecting signals and slots through network)
XML-RPC
QxtSQLPackage (Sending SQL query result through network or to a file)
QxtSlotMapper (Map a signal to slots based on parameter value)
Qt comes with lots of new features in each release. I wonder why these useful and nice features are not included in new versions of Qt. Does anybody know if there is any plan to add these features to Qt in the future?
While I do totally understand not just sending Qxt code up stream, because it can be very kludgy, some of the things mentioned are a bit silly as to why they're not included already. The global shortcuts is the number one thing that comes to mind. Having sample text in a line edit would be another cool feature.
For a while now, in my spare time, I've been working on a note taking app, and I've specifically went with QT because of the ease of having it work cross platform compared to GTK or other GUI frameworks. One of the major concepts was having a global hotkey to make the application appear and disappear, but because QT doesn't do this on its own, I had to deal with Qxt for this one function, and it made it a giant mess to get going. I dealt with tons of bugs that prevented me from building versions for Windows. If I could, I'd gladly ditch Qxt in favor of something already baked in to QT.
Qxt grew out of a need for features that QT wouldn't include for one reason or another, and I frankly just don't understand why.

which Qt project type we should use?

New to Qt. In the official Qt tutorial, it says:
To set up a project, you first have to decide what kind of an application you want to develop: do you want a user interface based on Qt Quick or HTML5 or Qt widgets.
We plan to use Qt to do medical image display, and also use Qt to build a GUI application to control a medical device. They will be two different projects.
Which Qt project type we should use for them?
Docs say:
QWidgets are a better choice if your UI is comprised of a small number of complex and static elements, and QML is a better choice if your UI is comprised of a large number of simple and dynamic elements.
I say:
If you're going for desktop applications I'd suggest Qt Widgets, you don't have to ship the final app with libs for QML and the whole source will be written in C++ (faster, simplier so easier to debug).
QML would be a nice alternative if you want to create phone/tablet (touch experience in general).
I would argue that between Qt Quick and Qt Widgets there is no objectively right answer. In theory, one should be able to replicate any UI using either method - because at the end of the day, they are both using QtGui behind the scenes. So functionality is probably not an issue.
One thing to note is that Qt Quick (i.e., QML) is designed explicitly to make UI programming require much less code, and much less C++ knowledge. I would say it achieves this goal very well.
However, at the end of the day, I think it mostly comes down to what language your developers are already familiar with. If you have a team of C++ pro's, then I would go with Qt Widgets - if only because it's going to be very easy for them to pick up, and it's something they're already familiar with. (I'm guessing this is the case because you're already writing C++ code for your project).
If, on the other hand, your developers are already very good at QML (or, more generally, JavaScript - which QML is heavily influenced by), then I would go with Qt Quick for the same reasons.
I know of two types of Qt UI: Qt Quick and widgets.
Widgets behave like most other UI toolkits out there, you have a GUI editor and a tree of UI objects. They are pretty mature and look like most standard UIs.
Qt Quick is the newer Qt UI toolkit. It uses a domain specific declarative language (QML) to specify the user interface and JavaScript for interactions. There are also plans to offer Qt widgets inside the Qt Quick framework, but I'm not sure how far that project has gotten. Qt Quick is meant to deliver more dynamic / custom user interfaces.
As far as I know Qt will continue to support both approaches in the foreseeable future so which one you pick depends on your use-case.

Qt+OpenGl+SimpleGl

I have enabled qt+OpenGl+SimpleGl on one of the ARM platform and was able to run opengl example programs.
I also has a qt+Webkit, which is working with a graphic plugin.
I wanted to use simpleGl context for every thing, instead of using the normal graphic screen. So, when I try to run Qt+Webkit with simpleGl, I just get a blank screen.
Does QT support this? If so how can we make it?
Yes, this is correct. OpenGL draws directly to the framebuffer. The simplegl driver doesn't handle what is drawn using the raster paint engine of the QWS, so you may see only black.
Using simplegl for "everything" means you want everything to be drawn using OpenGL in your EGL full-screen window? This is possible under some assumptions. You have to write all your applications to be rendered using the Qt OpenGL paint engine (using the opengl graphics system is not supported under Qt/E). This is possible also for QtWebKit, I'm doing it now. Note that this does not mean that everything is rendered using hardware acceleration. You'll have to write your applications "the right way" to get all actually hardware accelerated. Consider that you'll have to handle the mouse pointer some other way in this case.
The other way is to just modify the simplegl driver to allow for the use of Qt applications using the raster paint engine. This is possible as well with some limitations. Qt can use blit to place its own windows over OpenGL. Look for the framebuffer driver inside the Qt source tree to know how to do this. You can then have common Qt applications and OpenGL Qt applications some way. I'm doing this as well. Not everything can be done anyway.
EDIT: I'm sure you already did, but in case, give this http://doc.qt.io/qt-4.8/qt-embeddedlinux-opengl.html much attention.
Unfortunately I don't know anything about SimpleGL, but I do know that there is a way to render a standard Qt widget in a QGLWidget. Maybe have a look at this Qt Quarterly which I think is somewhat related to your question:
http://doc.qt.nokia.com/qq/qq26-openglcanvas.html

Resources