摘要:
1. 获取窗体位置的函数 x(), y(), pos():获得整个窗体左上角的坐标位置 frameGeometry():获得整个窗体的左上顶点和长、宽值 2. 获取窗体内中央区域位置的函数 geometry():获得窗体内中央区域的左上顶点(相对于父窗体而言的坐标)和长、宽值 width(), he
阅读全文
posted @ 2022-03-07 12:37
不再低调
阅读(73)
推荐(0)
摘要:
1. QToolBox->layout()->setSpacing() 设置QToolBox每个item之间的间距
阅读全文
posted @ 2022-03-03 15:42
不再低调
阅读(151)
推荐(0)
摘要:
QTextEdit由QTextDocument作为载体,光标QTextCursor类提供了对QTextDocument文档的修改接口,所有对文档格式的修改都与光标有关 1. 设置字体 QTextCharFormat textCharFormat; textCharFormat.setFontFami
阅读全文
posted @ 2022-02-25 16:33
不再低调
阅读(691)
推荐(0)
摘要:
1. 设置段落对齐 textEdit->setAlignment(Qt::AlignLeft); //左对齐 textEdit->setAlignment(Qt::AlignRight); //右对齐 textEdit->setAlignment(Qt::AlignCenter); //居中 tex
阅读全文
posted @ 2022-02-25 16:33
不再低调
阅读(2457)
推荐(0)
摘要:
1. 利用QFile和QTextStream读写文本文件 vector<QString> Dialog::ReadFile(const QString &fileName) { vector<QString> contents; QFile file(fileName); if(file.open(
阅读全文
posted @ 2022-02-24 15:26
不再低调
阅读(264)
推荐(0)
摘要:
1. 由于启动画面通常在程序初始化时间较长的情况下出现,所以在主窗口程序中看情况调用Sleep(),使主窗口程序在初始化时休眠几秒 int main(int argc, char *argv[]) { QApplication a(argc, argv); QPixmap pixmap("Qt.pn
阅读全文
posted @ 2022-02-24 12:53
不再低调
阅读(350)
推荐(0)
摘要:
1. setMask():为窗体设置遮罩,实现不规则窗体,参数可为QBitmap对象或QRegion对象。设置遮罩后的窗体尺寸仍是原窗体大小,只是被遮罩的地方不可见 QPixmap pix = QPixmap(); pix.load("16.png", 0, Qt::AvoidDither | Qt
阅读全文
posted @ 2022-02-24 11:37
不再低调
阅读(173)
推荐(0)
摘要:
1. currentTime():获取当前的系统时间 QTime currentTime = QTime::currentTime(); QString currentTimeText = currentTime.toString("hh:mm"); 2. toString():将获取的当前时间转换
阅读全文
posted @ 2022-02-24 10:49
不再低调
阅读(426)
推荐(0)
摘要:
每个窗体或控件都包含一个QPalette对象 1. ColorGroup:三种不同的状态 QPalette::Active:获得焦点的状态 QPalette::Inactive:未获得焦点的状态 QPalette::Disable:不可用状态 在通常情况下,Active状态与Inactive状态颜色
阅读全文
posted @ 2022-02-23 15:00
不再低调
阅读(387)
推荐(0)
摘要:
1. 步进值概念 一旦设置好进度条的最大值和最小值,进度条将会显示完成的步进值占总的步进值的百分比,百分比的计算公式为:百分比 = (value() - minimum()) / (maximum() - minimum()) 2. QProgressBar:横向或纵向显示进度的进度控件 setRa
阅读全文
posted @ 2022-02-23 13:06
不再低调
阅读(1697)
推荐(0)