In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Qt function names". In daily operation, I believe many people have doubts about how to use Qt function names. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about how to use Qt function names. Next, please follow the editor to study!
Function name / / get saved file static QString getSaveName (const QString & filter, QString defaultDir = QCoreApplication::applicationDirPath ()); / / get selected file static QString getFileName (const QString & filter, QString defaultDir = QCoreApplication::applicationDirPath ()); / / non-blocking save file dialog static QString saveFileName (const QString & filter, const QString & defaultDir = "", const QString & fileName = "") / / get the selected file collection static QStringList getFileNames (const QString & filter, QString defaultDir = QCoreApplication::applicationDirPath ()); / / get the selected directory static QString getFolderName (); / / get the file name with the extension static QString getFileNameWithExtension (const QString & strFilePath); / / get the file static QStringList getFolderFileNames (const QStringList & filter) in the selected folder; / / whether static bool folderIsExist exists in the folder (const QString & strFolder) / / whether the file exists static bool fileIsExist (const QString & strFile); / / copy the file static bool copyFile (const QString & sourceFile, const QString & targetFile); / / Delete all files under the folder static void deleteDirectory (const QString & path); function body QString QUIHelper::getSaveName (const QString & filter, QString defaultDir) {return QFileDialog::getSaveFileName (0, "Select File", defaultDir, filter) } QString QUIHelper::getFileName (const QString & filter, QString defaultDir) {return QFileDialog::getOpenFileName (0, "Select File", defaultDir, filter);} QString QUIHelper::saveFileName (const QString & filter, const QString & defaultDir, const QString & fileName) {QString file; QFileDialog dialog; dialog.setFixedSize (900,600); dialog.setWindowModality (Qt::WindowModal); dialog.setWindowTitle ("Save File"); dialog.setLabelText (QFileDialog::Accept, "Save (& S)") Dialog.setLabelText (QFileDialog::Reject, & cancel (& C)); dialog.selectFile (fileName); dialog.setNameFilter (filter); dialog.setDirectory (defaultDir); if (dialog.exec () = = 1) {file = dialog.selectedFiles (). Value (0); file = QFileInfo (file). Suffix (). IsEmpty ()? ": file;} return file } QStringList QUIHelper::getFileNames (const QString & filter, QString defaultDir) {return QFileDialog::getOpenFileNames (0, "Select File", defaultDir, filter);} QString QUIHelper::getFolderName () {return QFileDialog::getExistingDirectory ();} QString QUIHelper::getFileNameWithExtension (const QString & strFilePath) {QFileInfo fileInfo (strFilePath); return fileInfo.fileName ();} QStringList QUIHelper::getFolderFileNames (const QStringList & filter) {QStringList fileList; QString strFolder = QFileDialog::getExistingDirectory () If (! strFolder.length () = = 0) {QDir myFolder (strFolder); if (myFolder.exists ()) {fileList = myFolder.entryList (filter);}} return fileList;} bool QUIHelper::folderIsExist (const QString & strFolder) {QDir tempFolder (strFolder); return tempFolder.exists ();} bool QUIHelper::fileIsExist (const QString & strFile) {QFile tempFile (strFile); return tempFile.exists () } bool QUIHelper::copyFile (const QString & sourceFile, const QString & targetFile) {bool ok; ok = QFile::copy (sourceFile, targetFile); / / cancel the copied file read-only attribute ok = QFile::setPermissions (targetFile, QFile::WriteOwner); return ok;} void QUIHelper::deleteDirectory (const QString & path) {QDir dir (path); if (! dir.exists ()) {return } dir.setFilter (QDir::AllEntries | QDir::NoDotAndDotDot); QFileInfoList fileList = dir.entryInfoList (); foreach (QFileInfo fi, fileList) {if (fi.isFile ()) {fi.dir (). Remove (fi.fileName ());} else {deleteDirectory (fi.absoluteFilePath ()); dir.rmdir (fi.absoluteFilePath ()) At this point, the study on "how to use Qt function names" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.