VTK rendering from within a QGLWidget - qt

I have a problem that i am trying to sort out for days already, without much success..
So, basically i want to use VTK from Qt, and i know that there is the nice QVTK module for that.
My problem is that i somehow have to do my rendering from within a QGLWidget (i am using a sort of framework where my views are qglwidgets, more or less, and i cannot really use something else than this)
i found resources such as http://prashanthudupa.livejournal.com/48221.html for rendering vtk within a QGraphicsView, but i still cannot find if or how to render a vtkrenderer from within a qglwidget
thanks for any help

Related

How to use MFC Ribbon in the Qt application?

I am started to implement the microsoft ribbon interface on the qt library but finally understand that it is too complex task for me.
So I decided to use native mfc ribbon inside my application.
But the main question is how to do this?
Qt does not have native "MFC Ribbon", but the closest thing available is QTabWidget. You can use CSS stylesheets to make it look somewhat like MFC Ribbon. If you want exact look of MFC Ribbon, then you need to reimplement paintEvent and draw the widget as you need.
Some CSS Examples to get you started.
1) https://gist.github.com/espdev/4f1565b18497a42d317cdf2531b7ef05
2) http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar
There is a pre-built library called QtitanRibbon, although it's not free take a look into the free trial version.
Also check out this answer

Different look of QSpinBox on MacOs

I developed a simple QT application on Windows using QT creator 5.8 with good result. I used a simple form with QSpinBox.
To fix the color of the QSpinBox I wrote in the related style sheet
color:rgb(255,255,255);
Then I moved the application on MaxOs but the look of QSpinBox changed.
Did you have a similar problem ? How did you fix it ?
Thank you very much for your help and cooperation
regards
This is because the QWidget appearance actually depends on the platform. One (limited) solution is to use the palette, with setForegroundRole
The other is to use stylesheets, like you did, but you very likely will have to redefine more to obtain the desired result, and result will of course depend on the platform. You can actually make the result completely custom using only stylesheet. Just make sure to set the "border" style to avoid problems.
Here is Qt documentation about style sheets: Qt StyleSheets

What happened to QListViewItem in qt4?

I don't do a lot of Qt programming so this may sound like a silly question, but what happened to QListViewItem in qt4?
I have this application I wrote some time ago in qt3. I changed that to qt4 using the aptly name "qt3toqt4" program (all this on a Fedora platform).
Internally it seems to change a lot of classes from QClass to Q3Class (probably to provide some sort of backwards compatibility) and then compile it with qt4. I had some problems with it today (to do with reading stdout from a QProcess, but that aside) and I decided to simply rewrite the application in qt4.
Now for the problem - I use a QListView and to this I add loads of QListViewItems in a tree like structure. Something like this:
But that doesn't seem to be available anymore in qt4. And I can't find any examples that provide this behaviour either. Is there a way to do this in qt4? To maybe make it more complicated - I used my own QListViewItems (derived from QListViewItem) ...
The widget you are looking for in Qt 4 is QListWidget and its item class QListWidgetItem. It pretty much corresponds to the QListView widget in Qt 3 with a classic item-based interface for adding and removing items. You can subclass QListWidgetItem just as you subclassed QListViewItem in Qt 3.
Just to complete this question. It is QTreeWidget and QTreeWidgetItem that implement this behaviour in qt4.

Qt drawing with Qt designer

I have tried to search on the internet and here as well, without success though. I am using Qt 4.8.2 and design my app in the Designer, then I write code in VS2010. I would like to show a chart on the application window, e.g. like http://www.infocaptor.com/user_help/help_img/dashboard_line_chart_screen.png , based on some data that are created by the app.
In the Widget Box of the Designer, I can't find any widget related to drawing. So I tried creating a QTextEdit and drawing on that using QPainter. However, this does not work. I can draw on the whole appwindow, but not just on the text edit. So the question is: what widget can be added onto the app window in the designer and that is going to allow me to draw on it using QPainter?
I'm eluded as the documentation says specifically that QPainter can draw on any QWidget which a QTextEdit is...
Any help is much appreciated,
Daniel
The function of "drawing" is tooo complex/unspecific to be included as a specialized widget. You'll have to create it yourself and implement the desired drawing functions.
Here is an example which you can learn from, the scribblearea class could be pretty much what you are looking for. In that case you can copy it to your project and use in in the Qt-Designer by promoting a widget to this class.

Embedding Qt GUI into existing OpenGL program

I'm currently trying to get Qt working with my existing program.
I'm using SFML for creating my OpenGL rendering context and creating the window. The things I tried out so far however always create a separate window by Qt instead of just rendering into the existing context.
Is there any way I can force Qt to render to an already existing OpenGL context?
I've not looked into the specifics, but this has been done for openage.
I think looking at the documentation for QQuickRenderControl might be a good place to start.
Qt wants full control over the windows and the event loop, so this will not work (unless you put a lot of effort into it). Your best bet is using a QGLWidget and emulate the event management of SFML with that, so that your application effectively runs on Qt. It is very well possible to render Qt widgets into a OpenGL window (Qt has a OpenGL widget backend) but this must be still managed by Qt itself.

Resources