PyQt5中的按钮3-QCommandLinkButton

PyQt5中的按钮3-QCommandLinkButton

QCommandLinkButton介绍

  • CommandLinkButton 外观像是一个被设置了扁平化的 QPushButton,并且自带了一个向右的图标,以及可进行双行文本显示,这个图标只是默认的,可以通过API来改变。表示按下该控件将打开另一个窗口或者页面。
  • 图标和Text的设置和QPushButton相同。
  • “副标题”为该按钮的描述部分,所以可以通过setDescription()来设置。
    在这里插入图片描述

QCommandLinkButton举例

  • setText
  • setDescription
import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QCommandLinkButton)


class DemoCommandLinkButton(QWidget):
    def __init__(self):
        super().__init__()

        self.setWindowTitle('QCommandLinkButton Demo')
        self.resize(400, 240)

        clbtn = QCommandLinkButton(self)
        clbtn.setText('退出')
        clbtn.setDescription('点击本按钮,退出应用')
        clbtn.clicked.connect(self.slot_close)

    def slot_close(self):
        self.close()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = DemoCommandLinkButton()
    window.resize(300, 200)
    window.show()
    sys.exit(app.exec())
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值