Unreal Engine 4 + Qt Widget - c++

Working on project with UE4. I want to create UI with using Qt Designer and all Qt UI tools. I have already done opening window with some Qt forms (treeview and group of checkboxes) but I failed transmit picture from Unreal Engine window to QWidget.
I read about HWDL window, but i didn't found any information about realization. Found only how to get HWDL from UE4, but didn't found how to set to QWidget or wise versa get HWDL from QWidget and set it for UE4 (I think the second one better).
Maybe someone have done it? Or know approach to do it.

Related

Qt: QVideoWidget doesn't show up and disables all buttons within application OR extremely slows down the application

To make it clear the question is: Why, when I add a QVideoWidget to my application, all buttons become not clickable, the scrollbars don't work, and the comboboxes as well become not clickable? Is QVideoWidget disabling those functionalities? Or is that maybe (like I read in this SO question) QVideoWidget is extremely slowing down my application, just by being added to the application?
Now the details:
I really hope someone can help me with this. I'm trying to place a QvideoWidget into my desktop application with the following code (nothing special, just like in the tutorials):
// ...
// more code above for other things...
// main video-player widget
video_widget = new QVideoWidget;
video_widget->setMaximumHeight(100); // I could set any size here...this is not the point
video_widget->setMinimumHeight(100);
video_widget->setStyleSheet(STYLE_WIDGET_BG); // same background as the other widgets...
video_widget->setMaximumWidth(100);
video_widget->setMinimumWidth(100);
media_player = new QMediaPlayer(0, QMediaPlayer::VideoSurface);
TV_V_LAYOUT_MAIN_2->addWidget(video_widget); // #define TV_V_LAYOUT_MAIN_2 ui.lvl_4_tv2_h_1 --> this a layout inside another layout...
media_player->setVideoOutput(video_widget);
return; // this function is called inside the MainWindow constructor
So there are the situations:
1) Without adding the videowidget, everything works fine...
2) As soon as I add the QVideoWidget with the code above:
app overview
What happens?
The video player doesn't show up in any way. There should be at least the gray background like the other widgets, but nothing. Yet the buttons position lowers, so I guess the player was inserted...The problem is: all buttons (and I mean ALL buttons within my application) are disabled. So are the comboboxes and the scrollbar. By disabled I mean, when you click them, it doesn't normally "animate" like when a button is cliked, and the scrollbar doesn't scroll...
By the way the QVideoWidget is not places into the same layout as the buttons below. You can see the layout hierarchy here: Layouts with Qt Designer
I guess I'm missing something very simple. Anyone got the solution for me?
INFO: I'm programming with Visual Studio 2013 with Qt Add-In; I use only standard libraries; gstreamer is included in the project as well (nothing implemented yet).
OLD EDIT: it may be that the inserting of the video-widget extremely slows down the application, therefore giving the illusion that the scrollbar and the buttons don't work, just because it takes a lot of time for them to process the user interaction. Is this possible? Any solution for that?
Got the solution:
If your QVideoWidgets or QMediaPlayers extremely slow down your application, all you have to do, if you haven't yet, is to move all (or just the nedeed) Qt dll's into your project folder.
That's very basic, I know, yet that was my problem. Now it works like heaven.

Qt5 - Porting a Video Player from 4.8 to 5.1

I'm working on migrating my code from Qt 4.8.4 to Qt 5.1.1 and seemed to have run into a peculiar problem. Previously I was using the Phonon library's video widget to allow users to interact with the video. Since Phonon is no longer supported I was looking for a way to replace my Phonon widget via the Qt Designer but I found no replacement widget available. Does anyone know how we're supposed to go about porting this functionality?
If anyone has any insight, it is appreciated as always!
All the other answers provide very useful information, but since I was looking for a specific and functional implementation, I'm guessing people that stumble on this may be looking for one as well, so I'll post my code along with my thought process and a bit of background info of my setup.
videoWidget = new QVideoWidget;
player = new QMediaPlayer;
verticalLayout->addWidget(videoWidget);
player->setVideoOutput(videoWidget);
player->setMedia(QUrl::fromLocalFile("Resources\\videos\\example.m4v"));
videoWidget->show();
player->play();
So to go through this, basically in my project I have a widget that is a part of a stackwidget structure on which I have some QWidgets like playback control buttons, labels, etc, and I previously had my Phonon video player. I really really didn't want to generate it all programatically so I managed to find a solution.
The above code was located in this container widgets constructor. In the designer I have made a simple, empty verticalLayout, positioned and sized it to my liking. This allowed me to embed the QVideoWidget despite not having a interactive QWidget in the Designer. videoWidget, and player are declared as private in the container widget's header file.
You've already noted there's no more Phonon
Now what you've got is QtMultimedia and the QtMultimediaWidgets. If you want them available to your project and you're using Qmake, then change your QT line in your .pro file from something like:
QT += widgets
to:
QT += widgets multimediawidgets
That won't do anything about the designer interaction, though. I think it's probably a matter of no one having done the work to make a custom widget extension for QVideoWidget.
If that's correct, then if you want to place a QVideoWidget into your form via Qt designer you will have to use "Widget Promotion". Just put an ordinary QWidget into your layout, and then right click on it in the form and pick Promote to ...
As for the specifics of porting Phonon abilities to the new widgets, I dunno what's covered and what isn't. No answers here yet, either:
How to port Qt4.6 Phonon based media-application to Qt 5.1?
It seems that although Qt itself no longer includes Phonon, there is a Qt5 port available as an external library:
http://community.kde.org/Phonon/Releases/Core/4.7.0
Alternatively, you can switch to the new QtMultimedia APIs:
https://qt-project.org/doc/qt-5.1/qtmultimedia/videooverview.html

Embedding another Window as a QWidget

I'm currently working on a project that uses Allegro for rendering, input, etc. However I would like to add a GUI to my project using something like Qt. The problem is that Allegro does not support using a Window not created by allegro for rendering/input, it needs to create the window itself. I was thinking of using Qt to make the UI, and then creating a window normally using allegro, and then somehow embedding the allegro window into the Qt application.
Allegro provides the HWND handle to the window its using. Is there anyway to embed the allegro window into a Qt ui using its HWND handle?
You need the QWinHost class from the Qt/MFC Migration Framework. The code is 3-clause BSD licensed. You only need two files: qwinhost.h and qwinhost.cpp, available here.
It does exactly what you need, and works on both Qt 4 and 5.

User interface for an OpenGL project?

I am working on an OpenGL project for a solar system using Visual C++. I am done with quite a bit of the coding, but I need to implement it as a user learning module, which includes an overview button, a stop button and an info button. I want to make it like a form, with a panel containing the buttons and the a panel for viewing the animation. I tried using GLUI but it's not very useful for my implementation. Is it possible to create a form in Visual Studio, and import this code in the panel function?
Have you considered using QT for the GUI portions of your project ? You can create a panel for QT buttons and GUIs. You could use the QGLWidget for your panel to view the animation.
A good tutorial for using Qt Creator with Opengl (http://www.youtube.com/watch?v=1nzHSkY4K18).
There are also many good examples of the OpenGL + QT + Visual studio in the "C:\QtInstallPath\examples\opengl" directory.
If you wanted didn't want to use QT you could use C++\CLI to assist with the GUI portions of the code. The following link shows how to create an OpenGL view on a windows form in managed C++. http://www.codeproject.com/Articles/16051/Creating-an-OpenGL-view-on-a-Windows-Form.

QT4 C++ GUI Design - Tabbed interface alternative

Designing an interface with QT4 I have been advised that using multiple "Tabs" at the top of an interface to navigate different pages is not the most elegant design. Instead I would like to do something similar to the Options dialog in QT Creator 4.8.
Does anyone know the name of a widget that resembles that in the Options Dialog of QT Creator.
ex. Click Tools->Options... In QT Creator.
Notice the layout on the left hand side of the screen, which to me seems nicer than only tabs across the top of the screen.
Thanks for your help!
It's QLiveView/QListWidget with delegate that draw icon and string.
Here is link to documentation for QListView, If you are not happy with default list view delegate then you can create your own QItemDelegate to handle custom drawing. Here is sample code to create custom QItemDelegate
I just stumbled upon this implementation of a ribbon interface this morning. Maybe this is helpful to you?
http://qt-project.org/forums/viewthread/4214