1. Directory
-
- Using ODBC Excel files (xls) from input data
- Gui entry-level design
- Qfile usage in QT
- Solve Chinese garbled characters in QT
2. Use ODBC Excel files (xls) from input data
-
- Main website reference: http://blog.csdn.net/u010780613/article/details/51151448
- Main Code:
Qstring STR; STR = qstring: fromlocal8bit ("select an Excel file"); qstring filepath = qfiledialog: getopenfilename (this, STR ,"", TR ("Exel file (*. (xls) "); // read from the Excel file path // load the database driver qsqldatabase DB = qsqldatabase: adddatabase (" qodbc "," excelexport "); // DSN set qstring DSN = "driver = {Microsoft Excel Driver (*. XLS)}; "" DSN = ''; firstrowhasnames = 1; readonly = false; create_db ="; dB. setdatabasename (DSN); // database query qsqlquery query (db); qdebug () <qstring: fromlocal8bit (""); qstring tablename = "sheet1 $ "; // Sheet Name, $ is a required qstring SQL = "select * from [" + tablename + "]" Explain query.exe C (SQL); // read data while (query. next () {qstring id = query. value (0 ). tostring (); qstring name = query. value (1 ). tostring ();}
DB. Close ();
3. Entry-level GUI Design
4. Usage of qfile in QT
-
- Main reference: http://blog.csdn.net/xgbing/article/details/7772953
Qstring filename = qfiledialog: getsavefilename (this, STR, "savefile.txt", TR ("*. TXT "); // select the path qfile F (filename); STR = qstring: fromlocal8bit (" export file... "); qtextstream txtoutput (& F); txtoutput <STR <" \ n ";
5. Solve Chinese garbled characters in QT
Implementation of GUI development on QT