上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
摘要: 下面的例子主要是使用滑动窗口来控制字体的大小, 字体大小的设置通过QLabel().setFont(QFont('Arial', size)) QSliderDemo.py """ 滑块控件(QSlider) """ import sys from PyQt5.QtCore import * fro 阅读全文
posted @ 2022-01-27 00:56 c语言我的最爱 阅读(1659) 评论(0) 推荐(0) 编辑
摘要: 使用QSpinBox()构造计数器, 使用QSpinBox().valueChanged.connect() 来构造数值变化后的操作 QSpinBox.py """ 计数器控件(QSpinBox) """ import sys from PyQt5.QtCore import * from PyQt 阅读全文
posted @ 2022-01-26 23:29 c语言我的最爱 阅读(733) 评论(0) 推荐(0) 编辑
摘要: 使用currentIndeChanged来绑定选择变化后的函数, 使用QComboBox().currentText()来获得当前被选中框的文本 QComBoBoxDemo.py """ 下拉列表控件 (QComboBox) 1.如果将列表项添加到QComboBox控件中 2.如何获取选中的列表项 阅读全文
posted @ 2022-01-26 00:48 c语言我的最爱 阅读(1694) 评论(0) 推荐(0) 编辑
摘要: 复选框的状态主要有3种, 1.选中,2.未选中,3.半选中,使用QcheckBox().checkState()进行状态的查看QCheckBoxDemo.py """ 复选框控件(QCheckBox) 3种状态 未远中:0 半选中: 1 选中: 2 """ import sys from PyQt5 阅读全文
posted @ 2022-01-26 00:25 c语言我的最爱 阅读(2029) 评论(0) 推荐(0) 编辑
摘要: 使用QRadioButton().toggled.connect连接需要变化的函数,在函数中通过判断单选框状态()来self.sender().isChecked()进行变化 QRadioButtonDemo.py """ 单选按钮控件(QRadioButton) """ import sys fr 阅读全文
posted @ 2022-01-25 00:40 c语言我的最爱 阅读(1132) 评论(0) 推荐(0) 编辑
摘要: 在调用函数的时候,可能需要传入参数,因此使用lambda来构造函数进行传入 self.button4.clicked.connect(lambda: self.whichButton(self.button4)) QPushButtonDemo.py """ 按钮控件 (QPushButton) Q 阅读全文
posted @ 2022-01-25 00:24 c语言我的最爱 阅读(1010) 评论(0) 推荐(0) 编辑
摘要: 使用QTextEdit()实例化一个文本框的类, 通过这个类来调用设置和获取的函数,从而对文本框的内容进行获取或者设置 QTextEditDemo.py """ QTextEdit控件 """ from PyQt5.QtWidgets import * import sys class QTextE 阅读全文
posted @ 2022-01-24 22:12 c语言我的最爱 阅读(3533) 评论(0) 推荐(0) 编辑
摘要: 使用const Complex operator + (const Complex &c ) const {} 重新定义类的+操作 #include<iostream> using namespace std; class Complex{ public: Complex(int r, int i) 阅读全文
posted @ 2020-05-15 23:44 c语言我的最爱 阅读(1554) 评论(0) 推荐(0) 编辑
摘要: 使用void(Student::*pwho) void = & Student::who // 构造函数指针 使用string Student::*p_name = & Student::m_name //构造变量指针 #include <iostream> #include <cstdio> us 阅读全文
posted @ 2020-05-15 23:30 c语言我的最爱 阅读(595) 评论(0) 推荐(0) 编辑
摘要: 饿汉式声明, 一开始的时候对单例进行声明 #include <iostream> using namespace std; class Singleton{ public: static Singleton& getInstance(void){ return s_instance; } void 阅读全文
posted @ 2020-05-10 23:50 c语言我的最爱 阅读(247) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页