qlayout

PyQt5 layout with frames

风流意气都作罢 提交于 2020-08-24 03:40:20
问题 Hi fellow programmers. Currently working on a graphical user interface. I am trying to make the layout out of 3 QFrames. As seen in the screenshot below, the yellow frame is on the right side. I would like that frame to be on top of the right frame . (On top of the numpad, taking the whole horizontal space) Also, for the numpad buttons on the right frame. I would like them to be as close to each other as they can be, like a numpad on a keyboard. How would I adjust the grid to do that? Thanks

QT5.4 remove and delete widget in a layout

喜你入骨 提交于 2020-01-17 01:17:50
问题 I have a QStackedLayout which contains few QWidget on it. The widgets layout is QVBoxLayout which have also few QPushButton . What I wanted to do is to remove all the widgets inside the QStackedLayout and then delete the widgets and layouts BUT I want all the buttons not to be deleted 'cause I will put them to another widget later. Here's my code: while (QLayoutItem *item = m_stacked_layout->takeAt(0)) { QWidget *w = item->widget(); for (int i = 0; i < w->layout()->count(); i++) { QPushButton

Set Vertical Alignment of QFormLayout QLabel

折月煮酒 提交于 2020-01-14 02:09:11
问题 I'm using PySide/PyQt, but this is a general Qt question. Is there a way to set up a QFormLayout so that labels are centered vertically without having to explicitly create the QLabel's and set their vertical size policy to expanding first? When the widget in column 2 is taller than my label, I want my label to be centered vertically with the widget, rather than aligned with it's top... Here's an example script that demonstrates the problem. I've colored the labels red to better demonstrate

QGridLayout different column width

為{幸葍}努か 提交于 2020-01-12 10:42:53
问题 I am trying to create a layout looking like this: _________ | | | |1 | 2 | |__|______| | 3 | 4 | |____|____| Basically, I want cell number 1 the first row to be thinner that cell 2, but cells number 3 and 4 on the second row should have equal widths. Is it even possible to create a layout like this using QGridLayout in PyQt4? 回答1: The task of QGridLayout is to create that type of structure, for this you must use the function: void QGridLayout::addWidget(QWidget * widget, int fromRow, int

Does deleting layout deletes its sublayouts?

家住魔仙堡 提交于 2020-01-06 07:09:52
问题 I am working on Qt application. There I am creating layout and adding sublayout. I have seen that calling addLayout() sets as parent the container layout. Does that implies than when I delete superlayout its descendants will get deleted too? QWidget* centralWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget); QFormLayout *formLayout = new QFormLayout; mainLayout->addLayout(formLayout); Will deleting centralWidget delete formLayout? Thanks and regards 回答1:

QLayout Additem - prevent transfer of ownership

做~自己de王妃 提交于 2019-12-25 14:44:31
问题 I am having problems with the object references when using the QLayout to arrange my widgets in on bigger window next to each other. I have the following situation class MyClass(QObject): widgetCollection = [] def spawn(self): widget = MyQWidget() #containing a QLineWidget called "nameEdit" self.widgetCollection.append(widget) self._window = QtGui.QWidget() layout = QtGui.QHBoxLayout() listView = QtGui.QListWidget() for equation in self.wigdetCollection: equationName = equation.nameEdit.text(

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

Why are my labels stacking on top of each other inside my QHBoxLayout?

落爺英雄遲暮 提交于 2019-12-24 03:53:31
问题 Simply enough, I want to add two labels inside an horizontal box layout using Python's PYQT5. When I execute this code, the two labels appear on top of each other, even though adding them to a QHBoxLayout should position them from left to right. How can I fix this? Compiler : Python 3.7.4 32 bit IDE : Visual Studio Code OS : Windows 10 my code: import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import * from PyQt5.QtGui import * class Interface(QMainWindow): def __init__(self): super

Set content margins from stylesheet

非 Y 不嫁゛ 提交于 2019-12-12 11:07:40
问题 I'm struggling to set content margins to zero from QLayout objects in Qt with a stylesheet. I can remove them with QLayout::setContentsMargins(0, 0, 0, 0) but I would prefer to do it from stylesheet. 回答1: As of now this cannot be achieved. Use QLayout::setContentsMargins(0, 0, 0, 0) and QLayout::setSpacing(0) if you also want to eliminate the space between widgets. See also this bug report Stylesheet controls for QLayout objects which is unresolved so far. 回答2: It is not possible to set a

Making widgets partly overlap in a Qt layout

天大地大妈咪最大 提交于 2019-12-12 08:58:56
问题 I am trying to make widgets overlap partly in a Qt layout. My current layout is the following, achieved with a QVBoxLayout containing four QHBoxLayout children: I'm trying to regroup cards of the same suit, in order to achieve something like this (note that there is horizontal and vertical overlapping): Unfortunately, all the Qt documentation and all the Stack Overflow posts I have read try to avoid widgets overlapping rather than to seek it. Maybe there's a way to set negative spacing