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


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

本文整理汇总了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();
}
开发者ID:tokyogeometry,项目名称:Drawpile,代码行数:7,代码来源:serversummarypage.cpp

示例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;
}
开发者ID:GaelReinaudi,项目名称:LabExe-UserPlugins,代码行数:33,代码来源:GPlainTextLogger.cpp

示例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();
 }
开发者ID:KubaO,项目名称:stackoverflown,代码行数:7,代码来源:main.cpp

示例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()));
}
开发者ID:adaptee,项目名称:fcitx,代码行数:8,代码来源:editor.cpp

示例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)));
}
开发者ID:GaelReinaudi,项目名称:LabExe-UserPlugins,代码行数:10,代码来源:GImageSaver.cpp

示例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();
}
开发者ID:bywyu,项目名称:rexloader,代码行数:12,代码来源:categorydialog.cpp

示例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();
}
开发者ID:NeoTheFox,项目名称:lxqt-panel,代码行数:13,代码来源:lxqtmainmenuconfiguration.cpp

示例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);
}
开发者ID:Komari,项目名称:pokemon-online,代码行数:18,代码来源:pokemonstructs.cpp

示例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);
}
开发者ID:Komari,项目名称:pokemon-online,代码行数:20,代码来源:pokemonstructs.cpp


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