C GUI qt4 第五章 學習筆記

2021-08-25 11:22:26 字數 1577 閱讀 7599

1.numticks = int(std::ceil(max / step) - std::floor(min / step));

ceil()  floor() round() 都在math.h中。ceil()為向上取整,floor() 為向下取整,round()為四捨五入。

math.ceil(0.60) -- 1               math.ceil(0.48) -- 1

math.floor(0.60) -- 0               math.floor(0.48) -- 0

math.round(0.60) -- 1             math.round(0.48) -- 0

2.  setfocuspolicy(qt::strongfocus);

此屬性儲存視窗小部件接受鍵盤焦點的方式。接受滑鼠和鍵盤設定焦點。

3.    

if (hasfocus())

qstyleoptionfocusrect類用於描述使用qstyle繪製焦點矩形的引數

4.本章使用的雙緩衝繪圖,

6.使用命令列編譯

.使用vs2013自帶的cmd框使用命令列在windows下編譯執行通過(本人環境windows10(64位) + vs2013 + qt5.7.0) 

1>進入vs安裝目錄找到c:\program files (x86)\microsoft visual studio 12.0\common7\tools\shortcuts。

2>.先進入**所在目錄,然後使用命令編譯。

qmake -project qt+=widgets

qmake ./plotter.pro

nmake

3>看qmake 後是否有錯誤。有就修改,沒有就可以發現在plotter下面release資料夾下有個plotter.exe

雙擊即可。

沒有發現error

《C GUI Qt 4 程式設計》 筆記(六)

工具提示 findbutton settooltip tr find next newaction new qaction tr new this newaction settooltip tr new document 狀態提示 顯示在狀態列上 newaction setstatustip tr ...

學習筆記 C GUI Qt4 第一章

開發環境 windows10 qt5.6.3 ide qt createor vs2013 include include intmain int argc,char ar 這裡未對qlabel進行delete操作,這樣一點記憶體洩漏問題無關大局,這部分內容是可以由作業系統重新 的 qlabel l...

python第五章 Python學習(第五章)

記錄所有的名片字典 card list defshow menu 顯示資訊 print 50 print 歡迎使用 名片管理系統 v1.0 print print 1.新增名片 print 2.顯示全部 print 3.搜尋名片 print print 0.退出系統 print 50 defnew ...