I used QWebEngineView to call html, and now I've shown success. however QWebEngineView is shown in the upper left corner, I want to show QWebEngineView in the white area below. First, I don't know how to do this step.Second, I don't know what kind of Qt should be used in the white area shown.Or you can provide me with a good tutorial to solve my current problem.
This is my interface:
The bar chart is the HTML file I want to display
This is the part of my code:
pEngView = new QWebEngineView(this);
pEngView->setContextMenuPolicy(Qt::NoContextMenu);
pEngView->load(QUrl("file:///html/barx.html"));
pEngView->show();
Use Qt Designer and place a QWidget at the area you wanted. Then promote the QWidget to QWebEngineView and use the ui pointer to get pointer of the webengine widget. If you are new to Qt/QtDesigner follow the tutorials.
http://doc.qt.io/qt-5/designer-layouts.html
http://doc.qt.io/qt-5/designer-using-custom-widgets.html
Related
I want to embed some widgets into anothe Qt widget (into docking widget, for example). But I want to let user minimize or close them (just like the widgets on the right half of the picture)
Can you tell me, how can it be done?
You can implement it by using the QMdiArea
Read this blog How to tile widgets in a MDI application
here is Qt example code
I am looking for some example code that I can use to save an image of my Qt application. The application is a QMainWindow that contains a QGLWidget. I want to be able to screen capture all the GUIs (including the QGLWidget rendering) but have not been able to find any example code for this.
What I've tried:
QPixmap pixmap = QPixMap::grabWidget(QApplication::activeWindow);
pixmap.save(QString("test.png"));
This only save the GUIs but leaves a black background around the QGLWidget.
Anyone know of a technique for doing this in Qt 4.8.4?
Thanks,
Anyone have any idea how I can implement this? I'd like to have a function basically exactly like impoly in matlab or the "polygon sections" tool in imageJ, where you click to form a polygonal section and then each node can be adjusted, etc. I'd also like to have access to this function from Qt since I'm trying to make a gui for a small program I wrote.
Also, I'd like to avoid making calls to the matlab function because it's part of the image processing toolbox which isnt free. Thanks.
I think the best way to implement this is using the Qt Graphics View framework. Create a scene with an Item displaying your image in the back and add draggable Items on top representing the corners of your polygon.
Your selection tool should probably be a subclass of QGraphicsObject hosting the polygon corners as child items and a QGraphicsPolygonItem below the corners being updated whenever the user readjusts the selection. As QGraphicsObject inherits QObject, you can emit signals with a QPolygonF or QPolygon argument whenever the selection changes, informing other parts of your application
This demo should be a good example of the corner-adjust functionality you need.
Qt Pathstroke Demo
(uh well, the example implements the drawing and dragging of the control points from scratch.. I'm sure you can do it by using QGraphicsEllipseItem instead and react on their position changes)
I think you would need to code this yourself. There is an excellent example in the C++ GUI Programming with Qt 4 book (there's a PDF copy floating around online; I think it's legal) where they show you how to create a diagram with nodes and links. The chapter is called "Item-based rendering with Graphics View".
The basic idea is that you have some draggable nodes, which are QGraphicsItems with the ItemIsMovable flag set to true, and then some links that connect them, which are QGraphicsLineItems. All of these would go into a composite QGraphicsItem representing the ROI, and all of those would go into a QGraphicsScene, which would be displayed by a QGraphicsView.
Bottom line: there isn't a built-in copy of the MATLAB function, but all the tools are there for you.
In Qt 4.8 I want to create a window that looks like the following.
please note that my main concern is the tab-like behaviour of left-side icon+text combination.
The question is what would you recommend me to achieve that look? A QListWidget or a customized QTabWidget?
thanks
Qt Creator - which is written in Qt - has a settings page which might just be what you want:
I would look into the source code of that at http://qt.gitorious.org/qt-creator/qt-creator/trees/master
[Edit]
Found the relevant class here:
https://github.com/qt-creator/qt-creator/tree/master/src/plugins/coreplugin/dialogs
It is the class SettingsDialog. The GUI is setup in createGUI, they are not using an UI file actually.
This class is using a QListView on the left-hand side and a QStackedLayout with several QTabWidgets inside it on the right-hand side
I'd go with a QListWidget on the left connected to a QStackedWidget on the right.
Items in a QListWidget(View) can have icons on their left, selection can be exclusive (single selection) and when clicked emit signals which can change the current widget shown in the QStackedWidget.
I am attempting to reclaim some screen real estate in my application. I've got a search bar that is a basic QLineEdit and takes up space. In my menu bar, I easily have enough room to fit this search box, but I can't figure out how to get the LineEdit into the menubar.
Can someone assist me in getting this added to a menubar?
I am using Qt 4.7.
Here is an image of what I am attempting to accomplish. It's fairly basic image, but I'm looking to use the right half of the menubar as a search box.
Use QWidgetAction. QWidgetAction is for inserting custom widgets into action based containers, such as toolbars.
here is an example to add a progressbar to menu bar :
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(new QProgressBar(this));
menubar.addAction(widgetAction);
You could use
void QMenuBar::setCornerWidget ( QWidget * widget, Qt::Corner corner = Qt::TopRightCorner )
to add your widget in the menu.