i wanna make some nice user interface, but still using just classic ui elements from Qt.
For instance i have 2 forms and i wanna make some transition between them. For instance rotate first ui screen and make it disappear. It's possible in some way to use shader? Is any way how to do complex ui animations with classic ui elements?
Qt has a whole animation framework. It works on both the QML widgets and for the classic UI elements that you're using. There's some examples of use here, that should be able to get you started.
The simplest way to do it would be to use the Qt Declarative a.k.a. Qt Quick 1. It's based on QGraphicsScene, with the latter offering a reasonable way of integrating legacy widgets. It'll be likely the simplest way to offer animations with widgets.
You may wish to see an overview of GUI technologies available in Qt 5, to see how Qt Quick 1 fits in.
Related
I am working on an application where I want to embed openGL scenes into a QML item. I want my custom QML items to be driven by C++, and this article gives an overview of how to do so with a QQuickFramebufferObject.
However, I've noticed that very similar things can be done by simply using a QQuickItem, the distinction seeming to be that QQuickItem has different methods (paint()) compared to the QQuickFrameBufferObject (synchronize(), render(), createFramebufferObject()).
So what are the advantages of one over the other? Are these compatible? What is the best way to render a scene with these options? I've heard that the QQuickFrameBufferObject provides more flexibility with using custom openGL, but that means relatively little to me.
I'm planning of developing an application which will run on a Raspberry Pi 2 equipped with a touch-screen, and it should have the look and feel of a smartphone/tablet application.
This means especially that the list views and other scrollable widgets should scroll via touch gestures, and not by clicking on narrow scroll-bars on their side. Also, a simulation of momentum (widget scrolls a little while longer, with gradually lower speed, if I scrolled it fast enough and let go of the screen) should also be applied to all scrollable items.
I would prefer to develop in C++, and as I'm used to Qt, it would be preferable as well.
However, the Qt widgets are designed with a PC in mind, so they don't scroll with hand gestures and they have no simulation of momentum.
Of course, I could derive my own classes from the Qt classes and implement these features myself, but it would be much simpler if such GUI classes already existed.
You can use QML for build GUI if you want to look like mobile. Here and here you have how to integrate QML with C++ objects, so you can implement your logic by C++. In QML you can use TableView which can be scroll via touch the table.
I would like to exercise programming software with non-standard graphical interfaces such as the ones in the following images. I know how to create a GUI using basic widgets, but I have no idea on how to create my own custom widgets. I am familiar with GTK 3.0 and Qt. The GTK tutorial, for instance, has a link on how to do custom drawing. I just don't know if this is the usual and correct way to create custom widgets. There's also things such as: selections, mouse handling, zoom, scrolling, animations and so on that tutorials do not teach.
So here is my question: what kind of documentation, keywords, tutorials and algorithms should I look for? For my first project, I would like to start with something similar to the first and second images below. My current knowledge is C/C++ and Qt and GTK, but I can learn new languages and tools if necessary.
http://hobby-electrons.sourceforge.net/tutorials/gEDA/simple-schematic-in-gschem.png
http://www.cburch.com/logisim/docs/2.7/pt/html/images/screen-shot.png
http://eeweb.poly.edu/labs/nanovlsi/tutorials/soctutorials/figures/ENCFinalDesign.gif
http://www.ccm.ece.vt.edu:8088/etextiles/projects/arch_images/simulation.jpg
http://j-algo.binaervarianz.de/images/avl_avltest.png
The Qt Graphics view Framework is what you should use if you go with Qt. There are several examples covering the basics of creating components.
To be able to mimic those samples, most of the work is going to be on implementing custom graphic view items. Like widgets it means providing a paint method, specialized event handlers and properties.
As a hobby, I've been working on remaking an old video game, and I want to avoid reinventing the wheel where possible. The game is heavily GUI-based, but the GUI needs to be customized in terms of look-and-feel, and also needs to work with 3D OpenGL rendering for a few game screens.
To give you an idea, here's a screenshot from the initial prototype:
There's a lot of animation used, and 3D also, but the GUI widgets behave much the same as in a standard desktop application.
Thus far, I've been using my own GUI library (it's not robust or complete, and I've been running into some problems).
I've been considering migrating to Qt given it's reputation and impressive features, and some of the nice screenshots on the Qt website. But I've never used Qt before, so I don't really have an idea of what it's capable of, or what kind of time investment would be required to learn it. (Note I've used FLTK).
My question is: would it be possible / practical to use Qt in this situation?
UPDATE: After mocking up some game screens in Qt, I've decided not to use it. While it supports many of the features I need out-of-the-box (particularly through Style Sheets), I need to support custom bitmap-based pre-rendered fonts (I can't convert/replace them). And I can't subclass QFont, or reimplement it without it breaking in future Qt releases. That said, I was extremely impressed with Qt (both in its ease of use, and good documentation). I will be borrowing some of its features for my own engine. Thank you to all who provided input.
It's hard to know everything your game needs to do based on a screenshot; however, I will echo the sentiments of other posters here and provide a couple of avenues for you to look at.
One, is that you might want to consider QtQuick over the GraphicsView Framework, but this REALLY depends on what you need to do. I just want to throw it out there as an alternative so you don't miss it. This tutorial uses QtQuick to put together a really slick looking connect four style game. This may be more simplistic than what you want to go for, but then again, maybe it isn't, it depends on what you need to do.
Second, before writing custom paint events for all of your buttons, I would consider using Qt Style Sheets and style your widgets in a CSS like syntax. This will allow you to change the look and feel of your GUI in a very flexible way really quickly. Based on your screenshot, I think you can get what you want out of style sheets much faster than subclassing and rolling your own setup. But once again, it's hard to know based on one screenshot. Here's an example of a dark and orange GUI that was implemented using only Qt Style Sheets. The border-radius property of QPushButton's style sheet would give you the rounded buttons (ref).
The simple answer has been given above but to throw some more thoughts in: yes it's possible, you probably won't need to fight against Qt too much. For the most part the recommended advice for going to heavily customised widgets like that is subclass and implemented the paint event yourself.
You can then use a load of basic drawing primitives to get the basic shapes for the elements and expand from there. There's actually a couple of questions on here with really good resources about how to do it.
I'm making a game with OpenGL render api. Now I need in level editor. It should consist of lots of widgets parents/children etc, so it's hard to write need widgets by hands.
Any ideas about good gui-system which can be easilly connected with opengl? The most important part is gui editing. I really need some editing-tool for it.
Thanks
You should have a look to http://qt.nokia.com/ .
It is very easy to inject the OpenGL rendering into Qt widgets.
To easily edit your GUI, you can use Qt Creator ( http://qt.nokia.com/products/developer-tools ).
You have several options (and this has been answered before, but probably not exactly like this):
SDL: very good abstraction layer for audio, graphics and anything related. It will force you to write your widget stuff by hand.
Qt: has an OpenGL module that makes it easy to set up an OpenGL context. It will make widgets and everything very easy.
wxWidgets: same as Qt, but has slightly worse documentation and tools (if I might be so blunt)
I'd go with number two: it has a beautiful Designer tool to create Widgets with all the fancyness you'll need. OpenGL is also built right in.
If you're running Windows (can't confirm Mono will do it), another option would be to use C# and WinForms to make your life significantly easier.
Check out CEGUI:
http://www.cegui.org.uk/wiki/index.php/Main_Page
It defines its GUIs in XML and has editors for it.