Advertisement

获取文件名

阅读量:
复制代码
 void TxtEditMainWindow::openFileSlot()

    
 {
    
  
    
     QString fileName = QFileDialog::getOpenFileName(this, "open file", QDir::currentPath());
    
  
    
     /*** 如果是空文件 */
    
     if(fileName.isEmpty())
    
     {
    
     QMessageBox::information(this,"Warning Message!","Please select a file");
    
     return;
    
     }
    
  
    
     /*** 新建一个文件 */
    
     QFile *file = new QFile;
    
     file->setFileName(fileName);
    
  
    
     /*** 设置该Windows的窗口的名字和文件的名字一样 */
    
  
    
     <span style="color:#ff0000;">/*** 获取这个文件的所有信息 */
    
     QFileInfo fil

全部评论 (0)

还没有任何评论哟~