本文整理汇总了C++中QFileDialog::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileDialog::setAttribute方法的具体用法?C++ QFileDialog::setAttribute怎么用?C++ QFileDialog::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileDialog
的用法示例。
在下文中一共展示了QFileDialog::setAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pickFilePath
static void pickFilePath(QWidget *parent, QLineEdit *target)
{
QFileDialog *dlg = new QFileDialog(parent, QString(), QDir(target->text()).absolutePath());
dlg->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(dlg, &QFileDialog::fileSelected, target, &QLineEdit::setText);
dlg->show();
}
示例2: ChooseFolder
void GPlainTextLogger::ChooseFolder(QString folderPath /*= ""*/)
{
if(folderPath.isEmpty()) {
QFileDialog* pDialog = new QFileDialog(0, "Select folder", m_FolderPath);
pDialog->setFileMode(QFileDialog::Directory);
pDialog->setOption(QFileDialog::ShowDirsOnly);
pDialog->show();
pDialog->setAttribute(Qt::WA_DeleteOnClose);
connect(pDialog, SIGNAL(fileSelected(QString)), this, SLOT(ChooseFolder(QString)));
return;
}
QDir theFolder(folderPath);
// if the folder doesn't exists, offer to create it
if(!theFolder.exists()) {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
QString strMess("The folder %1 doesn't exist.");
strMess = strMess.arg(folderPath);
msgBox.setText(strMess);
msgBox.setInformativeText("Do you want to create it?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
if(ret == QMessageBox::Yes) {
theFolder.mkpath(folderPath);
}
}
if(folderPath != m_FolderPath)
if(theFolder.exists())
m_FolderPath = folderPath;
}
示例3: askForFile
void askForFile() {
QFileDialog * dialog = new QFileDialog(aView());
connect(dialog, SIGNAL(fileSelected(QString)), SLOT(loadFile(QString)));
dialog->setAcceptMode(QFileDialog::AcceptOpen);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
示例4: exportData
void ListEditor::exportData()
{
QFileDialog* dialog = new QFileDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->open();
connect(dialog, SIGNAL(accepted()), this, SLOT(exportFileSelected()));
}
示例5: ChooseFolder
void GImageSaver::ChooseFolder()
{
QFileDialog* pDialog = new QFileDialog(0, "Select folder", m_Folder);
pDialog->setFileMode(QFileDialog::Directory);
pDialog->setOption(QFileDialog::ShowDirsOnly);
pDialog->show();
pDialog->setAttribute(Qt::WA_DeleteOnClose);
connect(pDialog, SIGNAL(fileSelected(QString)), this, SLOT(SetFolder(QString)));
}
示例6: showDirDialog
void CategoryDialog::showDirDialog()
{
QFileDialog *dlg = new QFileDialog(this);
dlg->setDirectory(ui->catpath->text());
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setFileMode(QFileDialog::DirectoryOnly);
dlg->setWindowTitle(tr("Выбор директории"));
dlg->setOption(QFileDialog::DontUseNativeDialog);
dlg->setModal(true);
connect(dlg,SIGNAL(fileSelected(QString)),this,SLOT(setCategoryDir(QString)));
dlg->show();
}
示例7: chooseMenuFile
void LXQtMainMenuConfiguration::chooseMenuFile()
{
QFileDialog *d = new QFileDialog(this,
tr("Choose menu file"),
QLatin1String("/etc/xdg/menus"),
tr("Menu files (*.menu)"));
d->setWindowModality(Qt::WindowModal);
d->setAttribute(Qt::WA_DeleteOnClose);
connect(d, &QFileDialog::fileSelected, [&] (const QString &file) {
ui->menuFilePathLE->setText(file);
});
d->show();
}
示例8: loadTTeamDialog
void loadTTeamDialog(Team &team, QObject *receiver, const char *slot)
{
QSettings s;
QString defaultPath = s.value("Teams/Folder").toString();
QFileDialog *f = new QFileDialog(NULL, QObject::tr("Loading the Team"),defaultPath);
//f->setWindowFlags(Qt::Window); //maybe the reason for crashes
f->setAttribute(Qt::WA_DeleteOnClose);
f->setAcceptMode(QFileDialog::AcceptOpen);
f->setFileMode(QFileDialog::ExistingFile);
f->show();
TeamSaver *t = new TeamSaver(&team);
t->setParent(f);
QObject::connect(f, SIGNAL(fileSelected(QString)), t, SLOT(fileNameReceivedL(QString)));
if (receiver)
QObject::connect(f, SIGNAL(fileSelected(QString)), receiver, slot);
}
示例9: saveTTeamDialog
void saveTTeamDialog(const Team &team, QObject *receiver, const char *slot)
{
QSettings s;
QString defaultPath = s.value("Teams/Folder").toString();
QFileDialog *f = new QFileDialog(NULL, QObject::tr("Saving the Team"),defaultPath, QObject::tr("Team(*.tp)"));
//f->setWindowFlags(Qt::Window); //maybe the reason for crashes for some people
f->setAttribute(Qt::WA_DeleteOnClose);
f->setAcceptMode(QFileDialog::AcceptSave);
#if defined(Q_OS_MAC)
f->setOption(QFileDialog::DontUseNativeDialog);
#endif
f->show();
TeamSaver *t = new TeamSaver(const_cast<Team*>(&team));
t->setParent(f);
QObject::connect(f, SIGNAL(fileSelected(QString)), t, SLOT(fileNameReceived(QString)));
if (receiver)
QObject::connect(f, SIGNAL(fileSelected(QString)), receiver, slot);
}