qwidget

Is it possible to have a QWidget as a child to a QObject?

无人久伴 提交于 2020-01-04 04:25:13
问题 My main application object is a QObject , that juggles a QSystemTrayIcon , a QDialog , a QWindow and a few other components. The app mostly sits in the tray, with some options dialogs etc etc. Now, I'd like to use QMetaObject::connectSlotsByName() to connect signals from these objects to slots in the main object. It's 10-15 of them, so writing them by hand doesn't seem efficient, right, professional, modern, etc etc. However, I can't use my QObject as parent to the QWidget based objects, nor

Select & moving Qwidget in the screen

旧巷老猫 提交于 2019-12-31 18:04:06
问题 I'm using QTCreator and I created a QWidget, then I have hidden the title bar with setWindowFlags(Qt::CustomizeWindowHint); . But I can't select or move my widget. How can I use the mouseEvent to solve that? 回答1: If you want to be able to move your window around on your screen by just clicking and dragging (while maintaining the mouse button pressed), here's an easy way to do that: #include <QtGui> class W: public QWidget { Q_OBJECT public: explicit W(QWidget *parent=0) : QWidget(parent) { }

Select & moving Qwidget in the screen

。_饼干妹妹 提交于 2019-12-31 18:01:17
问题 I'm using QTCreator and I created a QWidget, then I have hidden the title bar with setWindowFlags(Qt::CustomizeWindowHint); . But I can't select or move my widget. How can I use the mouseEvent to solve that? 回答1: If you want to be able to move your window around on your screen by just clicking and dragging (while maintaining the mouse button pressed), here's an easy way to do that: #include <QtGui> class W: public QWidget { Q_OBJECT public: explicit W(QWidget *parent=0) : QWidget(parent) { }

How to add a hover transition to QPushButton?

假装没事ソ 提交于 2019-12-31 04:01:09
问题 I try to make a custom QPushButton with a stylesheet. I want to custom color of button when we mouse over it. It works, but I want to put a transition duration. But in Qt this option is not available. Here is my custom button: #include "bouton.h" Bouton::Bouton(QString title, QWidget *parent) : QPushButton() { setGeometry(50,50,120,40); setText(title); setMinimumHeight(30); setParent(parent); setStyleSheet(" QPushButton {" "border-radius: 5px; " "border: 1.5px solid rgb(91,231,255); "

How to get widget background QColor

牧云@^-^@ 提交于 2019-12-30 17:24:13
问题 I am trying to find out the background color of a QWidget or QGLWidget so that I can use it with qglClearColor() to make the OpenGL part appear natively within the widget (without for example a black background). I figured I could fetch backgroundRole() of my widget but I am having problems converting it to a QColor . There is QPalette::color(QColorRole) but it isn't static and I have no idea how I would have to create an instance of QPalette to do the transformation. 回答1: Use QWidget:

Drawing points on QPixmap on QWidget (pyqt5)

自古美人都是妖i 提交于 2019-12-30 11:08:28
问题 I have a QWidget with a QLayout on which there is a QLabel. I set a QPixmap on the label. Wherever the user clicks on the image, I want to draw a point. I defined mouseReleaseEvent (which works) and paintEvent (but no points are drawn). I've read all similar questions and none of the solutions worked for me. Any help? My relevant code: class ImageScroller(QtWidgets.QWidget): def __init__(self, img): QtWidgets.QWidget.__init__(self) main_layout = QtWidgets.QVBoxLayout() self._image_label =

Show Qt3D stuff inside QWidget in Qt5

不羁的心 提交于 2019-12-30 11:01:35
问题 So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5 soon and that parts of it is already available for testing as a tech preview. I set out with a simple plan, I would have Qt3D working inside a widget in my existing C++/widgets based application. However the only example I could find that shows how to use Qt3D from C++ is called basicshapes-cpp, and it shows some shapes rendered in a separate OpenGL/Qt3D prepared window

Show Qt3D stuff inside QWidget in Qt5

时光总嘲笑我的痴心妄想 提交于 2019-12-30 11:01:09
问题 So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5 soon and that parts of it is already available for testing as a tech preview. I set out with a simple plan, I would have Qt3D working inside a widget in my existing C++/widgets based application. However the only example I could find that shows how to use Qt3D from C++ is called basicshapes-cpp, and it shows some shapes rendered in a separate OpenGL/Qt3D prepared window

QT How to embed an application into QT widget

我与影子孤独终老i 提交于 2019-12-29 04:22:05
问题 In our project we have three independent applications, and we have to develop a QT control application that controls these three applications. The main window will be seperated to three sub windows - each one display another one application. I thought to use QX11EmbedWidget and QX11EmbedContainer widgets, but two problems with that: The QX11Embed* is based on X11 protocol and I dont know if it's supported on non-x11 systems like Windows OS. Since QT 5 these classes are not existing, and the

Is is possible to edit an individual Widget in the QtDesginer?

左心房为你撑大大i 提交于 2019-12-25 01:36:46
问题 I got a external library, which includes a derived class from QGLWidget, very similar to that one here. In that library I have a class: class PictureGLWidget : public QGLWidget { //.. } This extends Qt's native QGLWidget and personalizes it. But it was not written by me, I just got it, via a *.dll. So then, I bind that Widget manually in my code to a layout like: QGridLayout* layout = new QGridLayout; layout->addWidget(myPictureGLWidget, 0, 1); ui->verticalLayout_5->addLayout(layout); since I