Qt 結構體 正則表達 居中顯示 頁面置頂 頁面全域性化 標題命名 標題最大化等按鈕失效 去標題欄令視窗不可移動
阿新 • • 發佈:2018-11-14
結構體使用前,需要初始化
.h檔案
struct T_TABLE{
int a;
};
struct T_TABLE T_table;
在.cpp檔案
T_table = & T_TABLE;
QRegExp regx_bottleCapacity("[0-9]+$");//"[a-zA-Z0-9]+$" 長度7純數字輸入3.3格式
QValidator *validator_bottleCapacity = new QRegExpValidator(regx_bottleCapacity,ui->lineEdit_does);
居中 #include <QDesktopWidget>
// move((QApplication::desktop()->width()-this->width())/2,(QApplication::desktop()->height()-this->height())/2);//居中
置頂
setWindowFlags(Qt::WindowStaysOnTopHint);
取消置頂setWindowFlags(Qt::Widget);
全域性化
this->showFullScreen();//主螢幕最大化
設定標題
/* setWindowTitle(QString("執行中"));//標題
去標題欄(可以令視窗不可移動)
this->setWindowFlags(Qt::FramelessWindowHint);//去掉標題欄
//令最大化、最小化、關閉按鈕失效*/
setWindowFlags(windowFlags()&~(Qt::WindowMinimizeButtonHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint));
//令最大化、最小化、關閉按鈕失效*/