Qt學習筆記

2021-09-19 17:29:54 字數 439 閱讀 5337

獲取textedit中的文字資訊:toplaintext、tohtml

設定圖示seticon。設定圖示大小:seticonsize

向選單中新增按鈕:addaction

toolbutton設定選單:setmenu

鏈結槽函式:connect

判斷checkbox和radiobutton是否選中:ischecked

獲取傳送者的資訊:在槽函式中強轉this->sender();

隨機數:

qtime currenttime = qtime::currenttime();   //獲取當前時間

qsrand(currenttime.second()); //用當前時間的秒數作為隨機數種子

int randnum = qrand()%100; //取隨機數

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...