void CmdSrvDlg::showOptionsDlg() { QDialog dlg; dlg.setWindowFlags( dlg.windowFlags() & (~Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint) ); cmdUI = new Ui::CmdSrvDialog; cmdUI->setupUi( &dlg ); cmdUI->ipLE->setText( p.iface ); cmdUI->portSB->setValue( p.port ); cmdUI->toSB->setValue( p.timeout_ms ); cmdUI->enabledGB->setChecked( p.enabled ); ConnectUI( cmdUI->ipBut, SIGNAL(clicked()), this, SLOT(ipBut()) ); ConnectUI( cmdUI->buttonBox, SIGNAL(accepted()), this, SLOT(okBut()) ); if( QDialog::Accepted != dlg.exec() && !cmdServer ) { // If failed to set new listener...restore former. startServer(); } cmdUI->buttonBox->disconnect(); delete cmdUI; }
bool DirtyListDescriber::showChanges(QWidget* aParent) { QDialog* dlg = new QDialog(aParent); Ui.setupUi(dlg); dlg->setWindowFlags(dlg->windowFlags() & ~Qt::WindowContextHelpButtonHint); theListWidget = Ui.ChangesList; runVisit(); CoordBox bbox = theDocument->getDirtyOrOriginLayer()->boundingBox(); QString bboxComment = QString("BBOX:%1,%2,%3,%4") .arg(QString::number(bbox.bottomLeft().x(), 'f', 2)) .arg(QString::number(bbox.bottomLeft().y(), 'f', 2)) .arg(QString::number(bbox.topRight().x(), 'f', 2)) .arg(QString::number(bbox.topRight().y(), 'f', 2)); QString statComment = QString("ADD:%1 UPD:%2 DEL:%3").arg(glbAdded).arg(glbUpdated).arg(glbDeleted); glbChangeSetComment = bboxComment + " " + statComment; Ui.edChangesetComment->setText(glbChangeSetComment); Ui.edChangesetComment->selectAll(); bool ok = (dlg->exec() == QDialog::Accepted); if (!Ui.edChangesetComment->text().isEmpty()) glbChangeSetComment = Ui.edChangesetComment->text(); else glbChangeSetComment = "-"; Task = Ui.ChangesList->count(); SAFE_DELETE(dlg) return ok; }
DirectoryWebView* DirectoryWebView::createWindow(QWebEnginePage::WebWindowType type) { Q_UNUSED(type) QDialog *popup = new QDialog(this); QVBoxLayout *layout = new QVBoxLayout; DirectoryWebView *webview = new DirectoryWebView(this); layout->addWidget(webview); popup->setLayout(layout); popup->setWindowTitle(tr("ZIMA-CAD-Parts Technical Specifications")); popup->setWindowFlags(popup->windowFlags() | Qt::WindowMinMaxButtonsHint); popup->show(); return webview; }
QDialog *PluginManager::createAboutPluginDialog(QWidget *parent) { QDialog *rc = new QDialog(parent); rc->setWindowFlags(rc->windowFlags() & ~Qt::WindowContextHelpButtonHint & Qt::Sheet); rc->setWindowTitle(QCoreApplication::translate("QmlDesigner::PluginManager", "About Plugins")); QTreeView *treeView = new QTreeView; treeView->setModel(createModel(treeView)); treeView->expandAll(); QVBoxLayout *layout = new QVBoxLayout(rc); layout->addWidget(treeView); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close); layout->addWidget(bb); QObject::connect(bb, SIGNAL(rejected()), rc, SLOT(reject())); return rc; }
void App::makeDialogWithString(const QString s) { QDialog *dialog = new QDialog(this); QLabel *label = new QLabel(this); QScrollArea *scroll = new QScrollArea(this); QVBoxLayout *layout = new QVBoxLayout(); dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint); label->setText(s); scroll->setWidget(label); scroll->setWidgetResizable(true); layout->addWidget(scroll); dialog->setLayout(layout); dialog->exec(); delete dialog; }
void FileViewManager::PreviewStandalone(const QString& filePathName, QWidget* dialogParent) { QDialog* fpdialog = new QDialog(dialogParent); fpdialog->setWindowTitle(QString("Preview '%1'").arg(QFileInfo(filePathName).fileName())); fpdialog->setContentsMargins(0, 0, 0, 0); fpdialog->resize(640, 480); //Maximize button would be more useful than a Help button on this dialog, e.g to view big pictures. Qt::WindowFlags flags = fpdialog->windowFlags(); flags &= ~Qt::WindowContextHelpButtonHint; flags |= Qt::WindowMaximizeButtonHint; fpdialog->setWindowFlags(flags); QHBoxLayout* hlay = new QHBoxLayout(fpdialog); hlay->setContentsMargins(0, 0, 0, 0); fpdialog->setLayout(hlay); FilePreviewerWidget* fpw = new FilePreviewerWidget(fpdialog); hlay->addWidget(fpw, 1); Preview(filePathName, fpw); fpdialog->exec(); }
QString AddImagesDialog::getDirectory(const QStringList &fileNames, const QString &defaultDirectory) { QDialog *dialog = new QDialog(Core::ICore::dialogParent()); dialog->setMinimumWidth(480); QString result; QString directory = defaultDirectory; dialog->setModal(true); dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint); dialog->setWindowTitle(QCoreApplication::translate("AddImageToResources","Add Resources")); QTableWidget *table = createFilesTable(fileNames); table->setParent(dialog); QGridLayout *mainLayout = new QGridLayout(dialog); mainLayout->addWidget(table, 0, 0, 1, 4); QComboBox *directoryComboBox = createDirectoryComboBox(defaultDirectory); auto setDirectoryForComboBox = [directoryComboBox, &directory](const QString &newDir) { if (directoryComboBox->findText(newDir) < 0) directoryComboBox->addItem(newDir); directoryComboBox->setCurrentText(newDir); directory = newDir; }; QObject::connect(directoryComboBox, &QComboBox::currentTextChanged, dialog, [&directory](const QString &text){ directory = text; }); QPushButton *browseButton = new QPushButton(QCoreApplication::translate("AddImageToResources", "&Browse..."), dialog); QObject::connect(browseButton, &QPushButton::clicked, dialog, [setDirectoryForComboBox, &directory]() { const QString newDir = QFileDialog::getExistingDirectory(Core::ICore::dialogParent(), QCoreApplication::translate("AddImageToResources", "Target Directory"), directory); if (!newDir.isEmpty()) setDirectoryForComboBox(newDir); }); mainLayout->addWidget(new QLabel(QCoreApplication::translate("AddImageToResources", "In directory:")), 1, 0); mainLayout->addWidget(directoryComboBox, 1, 0, 1, 3); mainLayout->addWidget(browseButton, 1, 3, 1 , 1); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); mainLayout->addWidget(buttonBox, 3, 2, 1, 2); QObject::connect(buttonBox, &QDialogButtonBox::accepted, dialog, [dialog](){ dialog->accept(); dialog->deleteLater(); }); QObject::connect(buttonBox, &QDialogButtonBox::rejected, dialog, [dialog, &directory](){ dialog->reject(); dialog->deleteLater(); directory = QString(); }); QObject::connect(dialog, &QDialog::accepted, [&directory, &result](){ result = directory; }); dialog->exec(); return result; }