1.显示中文
#include <QTextCodec>
main函数中加
2.获得部件相对屏幕的绝对地址
部件->mapToGlobal(QPoint(0,0));
3.隐去窗口边框
构造函数中加Qt::FramelessWindowHint;如:
Dialog::Dialog(QWidget *parent) :
4.刷新界面
QCoreApplication::processEvents();
5.让窗口居中显示
在main函数w.show后加
6.以16进制显示某数
例如:label.setText(QString::number(c , 16 ));
7.以密文显示
例如 :ui->pwdLineEdit->setEchoMode(QLineEdit::Password);
8.关于qDebug():
qDebug("%x",n);无法输出16进制,会是错误的数字。
要这样用
qDebug()<<hex<<253<<endl;
9.获取事件前后时间差
QDateTime now = QDateTime::currentDateTime();
事件...
QDateTime
int i = now.secsTo(then);
10.超时控制
}
10.设置字体
setStyleSheet("color: rgb(255, 0, 255);font-size : 30px;");
11
void QT_vDisplay(int iLine, const char *pcFormat, ...)
{
}
12在程序中调用另一个程序的方法
uchar execProcess(char* pucLoad)
{
}