当前位置: 首页>>代码示例>>C++>>正文


C++ QFileDialog::setCaption方法代码示例

本文整理汇总了C++中QFileDialog::setCaption方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileDialog::setCaption方法的具体用法?C++ QFileDialog::setCaption怎么用?C++ QFileDialog::setCaption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QFileDialog的用法示例。


在下文中一共展示了QFileDialog::setCaption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setFile

void SettingsDialog::setFile( QLineEdit *le, const QString &caption )
{
    QFileDialog *fd = new QFileDialog( this );
    fd->setCaption( caption );
    fd->setMode( QFileDialog::AnyFile );
    fd->setDir( QDir::homeDirPath() );

    if ( fd->exec() == QDialog::Accepted ) {
	if ( !fd->selectedFile().isEmpty() )
	   le->setText( fd->selectedFile() );
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:12,代码来源:settingsdialogimpl.cpp

示例2: getOpenFileName

QString View::getOpenFileName()
{
    static QString workingDirectory = QDir::currentDirPath();

    QFileDialog *dlg = new QFileDialog( workingDirectory,
	    QString::null, 0, 0, TRUE );
    dlg->setCaption( QFileDialog::tr( "Open" ) );
    dlg->setMode( QFileDialog::ExistingFile );
    QString result;
    if ( dlg->exec() == QDialog::Accepted ) {
	result = dlg->selectedFile();
	workingDirectory = dlg->url();
    }
    delete dlg;
    return result;
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:16,代码来源:view.cpp

示例3: execExportFileDialog

void FLJasperEngine::execExportFileDialog(const QString &defaultFileName,
                                          const QString &defaultFormat)
{
  bool multiLang = aqApp->multiLangEnabled();
  aqApp->setMultiLang(false);

  QFileDialog *fd = new QFileDialog(0, "aq_execExportFileDialog", true);

  fd->setMode(QFileDialog::AnyFile);
  fd->setFilters(QStringList()
                 << "Pdf"
                 << "Csv"
                 << "Docx"
                 << "EmbeddedImagesXml"
                 << "Html"
                 << "MultipleSheetsXls"
                 << "Odt"
                 << "Rtf"
                 << "SingleSheetXls"
                 << "Xml");
  setDefaultExportFormat(defaultFormat);
  fd->setSelectedFilter(d->defaultExportFormat());
  fd->setSelection(defaultFileName);
  fd->setCaption(tr("Exportar Informe a..."));

  connect(fd, SIGNAL(filterSelected(const QString &)),
          this, SLOT(setDefaultExportFormat(const QString &)));

  if (fd->exec() == QDialog::Accepted) {
    QString outFile(fd->selectedFile());
    if (!outFile.isEmpty())
      exportReportToFile(outFile, d->defaultExportFormat());
  }

  delete fd;
  aqApp->setMultiLang(multiLang);
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:37,代码来源:FLJasperEngine.cpp

示例4: educe

void ZhscWidget::educe()
{
  if ( !bConStatus ) 
  {
    return;
  }

  uint len = 0;
  uint index = 0;
  int n = 0;

  QString tmp;

  QChar c( 0x2028 );

  tePoem->setTextFormat( Qt::PlainText );
  teMemo->setTextFormat( Qt::PlainText );
  tePoet->setTextFormat( Qt::PlainText );

  tmp = tePoem->text() + "\n" + teMemo->text() + "\n" + tePoet->text();

  tePoem->setTextFormat( Qt::AutoText );
  teMemo->setTextFormat( Qt::AutoText );
  tePoet->setTextFormat( Qt::AutoText );

  len = tmp.length();
  
  while ( 1 )
  {
    n = tmp.find( c, index );
    if ( n < 0 )
      break;
    tmp.replace( n, 1, "\n" );
    index = n;
  }

  QString sFileName;

  QFileDialog *fd = new QFileDialog( this );

  fd->setMode( QFileDialog::AnyFile );
  fd->setFilter( Unicode( "所有文件 (*.*)" ) );
  fd->setViewMode( QFileDialog::Detail );
  fd->setCaption( Unicode( "中华诗词 Qt版" ) );

  if ( fd->exec() == QDialog::Accepted )
  {
    sFileName = fd->selectedFile(); 
    if ( QFile::exists( sFileName ) )
    {
      if ( QMessageBox::warning( NULL, Unicode( "中华诗词 Qt版" ),
          Unicode( "这个文件已经存在,覆盖它?" ),
          Unicode( "确定" ),
          Unicode( "取消" ), 0, 0, 1 ) == 1)
      {
        delete fd;
        return;
      }
    }
    delete fd;
  }

  if ( sFileName != "" )
  {
    QFile f( sFileName );
    if ( f.open( IO_WriteOnly | IO_Truncate ) ) 
    {
      QTextCodec *codec = new QGb18030Codec();
      QTextStream ts( &f );
      ts.setCodec( codec );
      ts << tmp;
      f.close();
    }
  }
  
  return;
}
开发者ID:liangqi,项目名称:zhsc-qt,代码行数:77,代码来源:zhscwidget.cpp


注:本文中的QFileDialog::setCaption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。