Qt學習筆記

2021-10-24 12:16:44 字數 818 閱讀 7549

qt版本:5.9.2

#ifndef mainwidget_h

#define mainwidget_h

#include #include#include"subwidget.h"//子視窗標頭檔案

#include//列印

class mainwidget : public qwidget

;#endif // mainwidget_h

#ifndef subwidget_h

#define subwidget_h

#include #includeclass subwidget : public qwidget

;#endif // subwidget_h

#include "mainwidget.h"

#includemainwidget::mainwidget(qwidget *parent)

: qwidget(parent)

訊號與槽:

connect(&b,&qpushbutton::pressed,this,&mainwidget::close);

//&b:訊號發出者,指標型別

//&qpushbutton::pressed處理的訊號 &傳送者的類名::訊號名字

//this:接收者

//&mainwidget::close槽函式(訊號處理函式)&接收的類名::槽函式名字

//自定義槽:qt5:任意的成員函式,普通全域性變數,靜態函式

//槽函式要和訊號一致(引數,返回值)由於訊號都沒有返回值,

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