当前位置:网站首页>Qtoolbutton available signal
Qtoolbutton available signal
2022-07-03 22:41:00 【。 Seventy two.】
1、 Except those inherited from the parent class , And its own independent signals .

Rewrote triggered() Method , There are also differences in call parameters ; When you click on a action This signal will be triggered , And will acion Objects are passed .
Act on your own signals and tb Like signals sent from the outside ( Type of parameter sent QAciton).
2、 You can bind some data to a given behavior :setData(), Different behaviors bind different data , Access method usage action.data() Method . Than calling directly clicked.connect() Simple method .
import sys
from PyQt5.Qt import *
# Make it into an activity module , Easy to modify
# 1、 Create application , You can pass parameters to app, Enter parameters from the command line
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle("QToolButton Use ")
window.resize(500, 500)
tb = QToolButton(window)
tb.setText(" Button ")
tb.setArrowType(Qt.LeftArrow)
tb.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
tb.setAutoRaise(True)
menu = QMenu(tb)
menu.setTitle(" menu ")
# Put submenus and actions in the menu
sub_menu = QMenu(menu)
sub_menu.setTitle(" Sub menu ")
# Put in meun In parent object
action = QAction(" Behavior ", menu)
action.setData([1,2,3])
# monitor action Signal in
#action.triggered.connect(lambda : print(" Clicked behavior "))
menu.addMenu(sub_menu)
menu.addSeparator()
menu.addAction(action)
tb.clicked.connect(lambda: print(" The tool button is clicked "))
tb.setMenu(menu)
# Relevant action object
def do_action(action):
print(" Clicked behavior 2", action.data())
tb.triggered.connect(do_action)
# Modify the popup method of the menu
tb.setPopupMode(QToolButton.InstantPopup)
window.show()
sys.exit(app.exec_())
边栏推荐
- STM32 multi serial port implementation of printf -- Based on cubemx
- Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
- Subset enumeration method
- Pat grade A - 1164 good in C (20 points)
- 6.0 kernel driver character driver
- How can enterprises and developers take advantage of the explosion of cloud native landing?
- [untitled]
- The overseas listing of Shangmei group received feedback, and brands such as Han Shu and Yiye have been notified for many times and received attention
- How the computer flushes the local DNS cache
- The difference between SRAM and DRAM
猜你喜欢
![Buuctf, web:[geek challenge 2019] buyflag](/img/02/d3add04f8145621bff35d46b82ba53.jpg)
Buuctf, web:[geek challenge 2019] buyflag

Buuctf, misc: sniffed traffic

Take you to master the formatter of visual studio code
![[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)](/img/b8/e2a59772d009b6ee262fb4807f2cd2.jpg)
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)

In VS_ In 2019, scanf and other functions are used to prompt the error of unsafe functions

Summary of basic knowledge of exception handling
![[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)](/img/6c/2d48d441fee1981a271319fd9f6c23.jpg)
[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)

Quick one click batch adding video text watermark and modifying video size simple tutorial

Harbor integrated LDAP authentication

Hcip day 14 notes
随机推荐
6.2 normalization 6.2.5 third normal form (3NF)
Correlation
Redis single thread and multi thread
[dynamic programming] Ji Suan Ke: Suan tou Jun breaks through the barrier (variant of the longest increasing subsequence)
Preliminary analysis of smart microwave radar module
Take you to master the formatter of visual studio code
Shell script three swordsman awk
How to switch between dual graphics cards of notebook computer
Conditional statements of shell programming
The latest analysis of crane driver (limited to bridge crane) in 2022 and the test questions and analysis of crane driver (limited to bridge crane)
C3p0 connection MySQL 8.0.11 configuration problem
Shiftvit uses the precision of swing transformer to outperform the speed of RESNET, and discusses that the success of Vit does not lie in attention!
Codeforces Round #768 (Div. 1)(A-C)
How to solve the problem of requiring a password when accessing your network neighborhood on your computer
How to obtain opensea data through opensea JS
Buuctf, misc: sniffed traffic
Format cluster and start cluster
This time, thoroughly understand bidirectional data binding 01
Programming language (1)
Niuke winter vacation training camp 4 g (enumeration optimization, Euler power reduction)