Qt學習筆記

2021-07-29 07:11:36 字數 854 閱讀 8599

.pro檔案中:

qt+=widgets//新增widgets模組,所有的視窗部件都繼承自qwidget

.cpp檔案中:

int main(int argc,char *argv)//main()函式有兩個引數,用來接收命令列引數

return a.exec();//物件進入事件迴圈可以接收單機和按下鍵盤等事件

視窗部件(widget)簡稱部件。視窗就是沒有嵌入其他部件的部件,沒有父部件的部件。

#include

int main(int argc,char *argv)

explicit qwidget(qwidget*

parent

=0, qt::windowflags f =

0);//explicit關鍵字,引數型別不能隱式轉換使用

//qwidget* parent =0,沒有父視窗

//qt::windowflags f可以是多個視窗型別的列舉值進行位或操作;qt::framelesswindowhint產生乙個沒有邊框的視窗;qt::windowstaysontophint用來停留在所有其他視窗上面

qlabel *label =

new qlabel(0,qt::splashscreen

|qt::windowstaysontophint);

qwidget *widget =

new qwidget(0,qt::dialog

|qt::framelesswindowhint);

qdebug(),用來將除錯資訊輸出控制台,標頭檔案,用法同printf或cout。

Qt學習筆記

1.參考資料 1 2 3 4 5 6 2.faq 2.1.qt creator 2.1.1.xp下用qt creator編譯自帶例子mdi sdi 當不勾選projects build settings build environment的 clear system environment 時,編譯...

QT學習筆記

1.在windows下配置好qt的環境變數以後,用cmd開始編譯,qmake project qmake hello.pro mingw32 make 結果出現錯誤 include 問題已經解決了,主要是 故而只需在.pro檔案中加入 greaterthan qt major version,4 q...

Qt 學習筆記

常用控制項對應類 窗體 qwidget 水平布局 qhboxlayout 豎直布局 qvboxlayout 網格布局 qgridlayout 按鈕 qpushbutton 標籤 靜態文字框 qlabel qlineedit label new qlabel tr find what lineedit...