Context menu by QToolButton

This commit is contained in:
atse 2023-07-19 11:38:04 +08:00
parent 1d192f50c8
commit 463ee4105c
3 changed files with 18 additions and 0 deletions

View File

@ -73,6 +73,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.setupUi(self)
menu = QtWidgets.QMenu(self)
self.thermostat_settings.setMenu(menu)
self.fan_power_slider.valueChanged.connect(self.fan_set)
self.fan_auto_box.stateChanged.connect(self.fan_auto_set)

View File

@ -294,6 +294,16 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="thermostat_settings">
<property name="text">
<string notr="true">⚙</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_0">
<property name="sizePolicy">

View File

@ -136,6 +136,11 @@ class Ui_MainWindow(object):
self.status_lbl.setBaseSize(QtCore.QSize(120, 50))
self.status_lbl.setObjectName("status_lbl")
self.settings_layout.addWidget(self.status_lbl)
self.thermostat_settings = QtWidgets.QToolButton(parent=self.bottom_settings_group)
self.thermostat_settings.setText("")
self.thermostat_settings.setPopupMode(QtWidgets.QToolButton.ToolButtonPopupMode.InstantPopup)
self.thermostat_settings.setObjectName("thermostat_settings")
self.settings_layout.addWidget(self.thermostat_settings)
self.line_0 = QtWidgets.QFrame(parent=self.bottom_settings_group)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
sizePolicy.setHorizontalStretch(0)