本文整理汇总了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() );
}
}
示例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;
}
示例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);
}
示例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;
}