Showing all posts tagged qt5:

Qt 檔案與資料夾處理

QFile, QDir,與QFileInfo是Qt5專門處理檔案的class。 QFile提供檔案讀取與寫入,QDir提供存取資料夾結構與相關內容修改,QFileInfo提供檔案資訊,包含名稱、位置、修改時間、權限等等。 取得檔案大小 #include .... QString filename = "myfile.txt" // argv[1]; //QString filename = argv[1]; 輸入參數 //檢查檔案 if (!QFile(filename).exists(...

Qt Date and time

date & time 物件的初始化 QDate dt1(2015, 4, 12); dt1.toString(); //Sun Apr 12 2015 QDate dt2; dt2.setDate(2015, 3, 3); dt2.toString(); //Tue Mar 3 2015 QTime tm1(17, 30, 12, 55); tm1.toString("hh:mm:ss.zzz"); //17:30:12.055 QTime tm2; tm2.setHMS(13, 52, 4...