qwidget

Enable own widget for stylesheet

霸气de小男生 提交于 2019-12-25 01:15:36
问题 I want to enable my own widget class for stylesheets, whereat I am not talking about setStyleSheet(qss) , but selectors in a qss stylesheet. It is understood that I have to replace the "::" with "--" in namespaces. Here ( Qt Stylesheet for custom widget ) I have found a similar question, but it is > 4 years old. Based on the answer I have some detailed questions: a) Is the published approach with an overridden paintEvent still valid (Qt5.6/5.7), from https://stackoverflow.com/a/8817908/356726

How to programmatically change/update data in Python PyQt4 TableView?

烈酒焚心 提交于 2019-12-24 21:50:50
问题 I would like to have a table within a QWidget window and update the table each time the user enters a value in the lineEdit field. How do I do this programmatically? status: I am getting the following error to your code: TypeError: QAbstractTableModel.beginInsertRows(QModelIndex, int, int): argument 2 has unexpected type 'str' from PyQt4 import QtGui , QtCore import sys try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class ABCTableModel(QtCore

Qt Implementation of selecting items from list into other list (Dual List, Accumulator, List builder, TwoListSelection …)

一曲冷凌霜 提交于 2019-12-24 14:44:27
问题 I want to select an arbitrary amount of items from a list of arbitrary length. A dropdown (QComboBox) doesn't allow checkable items. A list of checkable items would become clumsy with a lot of items. I found this question in the User Experience SE subsite and this answer seems to be the solution that best suits my needs. It has many names, as a comment in said answer remarks: Dual List, Accumulator, List builder, TwoListSelection ... The version from OpenFaces.org shown in the answer linked

How to fix the size of my Qt window?

时光怂恿深爱的人放手 提交于 2019-12-24 11:34:54
问题 I have a QWidget , the parent class for all my other widgets. In Qt Designer I set width = 600 and height = 400 for the QWidget . My size Policy is [Fixed, Fixed, 0, 0] . But if I start my the application the QWidgets size is at least 2500*400 . How could I fix the size at application start to 600*400 ? 回答1: The size policy on a toplevel layout is meaningless if you don't set the size constraint as well via QLayout::setSizeConstraint . It is the size constraint that links the layout to the

How to draw with QPainter on a specific widget from a group of widgets in QMainWindow?

只谈情不闲聊 提交于 2019-12-24 07:54:45
问题 This is my code: #include "mainwindow.h" #include <QDebug> #include <QCameraInfo> #include <QHBoxLayout> #include <fstream> #include <assert.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_QPushButton_calibration = new QPushButton("Calibrate", this); connect(m_QPushButton_calibration, SIGNAL (released()),this, SLOT (handleButton())); QList<QCameraInfo> l_QListQCameraInfo_available_cameras = QCameraInfo::availableCameras(); m_QWidget_viewfinder_holder = new QWidget; m

find qwidget object text by using pywinauto

故事扮演 提交于 2019-12-24 06:47:25
问题 I work as a test engineer. I have to test an application(softphone) which is done by using QWidget. I'm using python - pywinauto. I can click buttons and make calls. There is a qwidget object named with statusLabel. At the beginning of the test, "Ready" text written on it. When I make a call, this text is changed like "Calling..", "Call Established" and so on. I want to check the text of that widget. Do you have any idea? 回答1: Pywinauto uses standard windows API calls. Unfortunately many UI

Why is the selection border of a QGraphicsWidget not visible in QGraphicsScene?

为君一笑 提交于 2019-12-24 01:29:07
问题 I have added a widget to a graphic scene (QGraphicScene) through a QGraphicsProxyWidget . The problem is that when I select the item it's selected, but the selection border is not visible. Here is the code: QDial *dial= new QDial(); // Widget dial->setGeometry(3,3,100,100);// setting offset for graphicswidget and widget QGraphicsWidget *ParentWidget = new QGraphicsWidget();// created to move and select on scene ParentWidget->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem:

How to play a video on a translucent QWidget?

怎甘沉沦 提交于 2019-12-24 00:45:22
问题 I want to play a movie on a QWidget that has Qt::FramelessWindowHint flag and Qt::WA_TranslucentBackground attirbute using QVideoWidget or QGraphicsVideoItem. But the video is not visible. I hear only sound. What is the problem? Edit: #include "videoplayer.h" #include <QtWidgets/QApplication> #include "qboxlayout.h" #include "qvideowidget.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget *w = new QWidget; w->setWindowFlags(Qt :: Window | Qt::FramelessWindowHint ); w-

QWidget for showing text with small pictures (icons/emoticons)

折月煮酒 提交于 2019-12-23 17:08:39
问题 Does such widget exist? I can write my own widget based on QLabel s and layout similar to http://qt-project.org/doc/qt-5/qtwidgets-layouts-flowlayout-example.html, but then I can't select all text and copy (because this is just a set of labels). 回答1: A QLabel's text property can have rich text in it, and the img tag is supported in rich text in Qt. For example, QLabel myLabel("<img src=\":/foo.png\"> Hello, World!"); 回答2: You can use a QTextEdit in which when you enter some specific text, it

What does size “1em” in Qt qss mean, if there is no font size em?

拥有回忆 提交于 2019-12-23 14:48:15
问题 As of Qt 5 documentation says: The supported units are: px: pixels pt: the size of one point (i.e., 1/72 of an inch) em: the em width of the font (i.e., the width of 'M') ex: the ex width of the font (i.e., the height of 'x') However, Qt is limited to font sizes in pt and px and any other size must be in px, em or ex. When they say 1em is equivalent "M" , which M do they mean? Which font and pt size do they take to calculate that? Based on some other answers I can speculate it is some 12pt