QT
麒麟桌面操作系统 V10 SP1下Qt应用程序开发环境配置 | 银河麒麟V10sp2桌面系统安装使用qt5
Qt的Signals 和 Slots详解 | QT核心:signal-slot 信号/槽机制
Baidu NetDisk | Pie chart disk space analyzer
vector<> qCopy() qFill() static_cast
运行Qt 5.14.2 (MinGW 7.3.0 64-bit)
cd test
qmake -project
qmake test.pro
#vim test.pro
#增加下行
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
mingw32-make
打包
cd release
windeployqt test.exe
UI生成代码:
uic setup.ui -o ui_setup.h
qrc资源文件生成二进制文件
rcc --binary res.qrc -o skin.rcc
资源文件与代码分离
QResource::registerResource(qApp->applicationDirPath() + "/skin/skin.rcc");
QFile file(":/qss/stylesheet");
if(file.open(QFile::ReadOnly))
{
QString strStyleSheet = file.readAll();
file.close();
qApp->setStyleSheet(strStyleSheet);
}
命令行输出:
qDebug() << "Timer executed!";
提示框:
QMessageBox::information(this, "Title", "Hello");
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Title Here",
"Do you like cats?",
QMessageBox::Yes | QMessageBox::No);
if( reply == QMessageBox::Yes ){
QMessageBox::information(this, "Title Here",
"You love cats!");
}else{
QMessageBox::information(this, "Title Here",
"You don't like cats!");
}
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this,
"Title Here",
"My text here",
QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::NoToAll);
if( reply == QMessageBox::YesToAll ){
QMessageBox::warning(this, "Title Here",
"Be careful");
}