qgroupbox

PyQt5 QScrollArea widget with dynamically created GroupBoxes

时光总嘲笑我的痴心妄想 提交于 2020-12-26 13:58:44
问题 I'm trying to make a toolbox widget that will do various different things. But I'm having trouble with the layout management regarding the QScrollArea. Following the stripped version of the code I have: from PyQt5 import QtWidgets import sys class MyScrollWidget(QtWidgets.QWidget): def __init__(self): super(MyScrollWidget, self).__init__() scrollArea = QtWidgets.QScrollArea(self) top_widget = QtWidgets.QWidget() top_layout = QtWidgets.QVBoxLayout() for i in range(10): group_box = QtWidgets

PyQt5 QScrollArea widget with dynamically created GroupBoxes

送分小仙女□ 提交于 2020-12-26 13:39:23
问题 I'm trying to make a toolbox widget that will do various different things. But I'm having trouble with the layout management regarding the QScrollArea. Following the stripped version of the code I have: from PyQt5 import QtWidgets import sys class MyScrollWidget(QtWidgets.QWidget): def __init__(self): super(MyScrollWidget, self).__init__() scrollArea = QtWidgets.QScrollArea(self) top_widget = QtWidgets.QWidget() top_layout = QtWidgets.QVBoxLayout() for i in range(10): group_box = QtWidgets

QT - How to place widgets in mutually exclusive groups?

拈花ヽ惹草 提交于 2020-06-27 17:37:25
问题 I'm looking to do something like the following: example But with radio buttons instead of checkboxes. In the above picture widgets are placed into groups which can be enabled/disabled, but I want only 1 group to be enabled at a time (in the example both Group A and Group C are enabled). I did the above example using QGroupBox, but it only provides normal checkboxes, not radio buttons as far as I can tell. 回答1: The ckeckbox that appears in the QGroupBox is not a QCheckBox , it is just a

QGroupBox title vertical alignment

本小妞迷上赌 提交于 2020-01-23 18:00:29
问题 I have QGroupBox in my UI. The basic style is 2px width border, border radius and the title being vertically centered. I used the following style to my stylesheet (which is in a .qrc, applied in the main using app->setStylesheet): QGroupBox { border: 1px solid #22a4bc; border-radius: 0px; } QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top; /* position at the top center */ } The problem is, the title is now a few pixel down, and actually over the element IN the groupbox.

Detect if the mouse is clicked outside GroupBox

纵饮孤独 提交于 2019-12-25 09:27:29
问题 I am looking for an event if the mouse is clicked outside of the groupBox in Qt. I tried FocusOutEvent but was not able to get the event: ui.groupBox->installEventFilter(this); void myClass::focusOutEvent(QFocusEvent *event) { ui.groupBox->hide(); } Any kind of help would be greatly appreciated! 回答1: You have the following options: Subclass QGroupBox and override mousePressEvent() Install an event filter on that group box and catch QMouseEvents If you want to catch only right mouse clicks

Change PySide QGroupBox checkbox image

自作多情 提交于 2019-12-13 06:49:59
问题 I would like to change the image (or icon?) displayed with the checkbox for a QGroupBox, i.e.: In particular, I would like to change the image displayed when it is 'checked' to the image 'images/custom_checked.png', and the image displayed when it is hovered over to 'images/custom_hover.png'. I think this can be accomplished using StyleSheets but I have not been able to make anything work. Edit: The following code does change the checkbox image when the checkbox is checked class MyGroupBox