本文整理汇总了C++中QDialog::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::layout方法的具体用法?C++ QDialog::layout怎么用?C++ QDialog::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::layout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectToClangDiagnosticConfigsDialog
void ClangDiagnosticConfigsSelectionWidget::connectToClangDiagnosticConfigsDialog(QPushButton *button)
{
connect(button, &QPushButton::clicked, [this]() {
ClangDiagnosticConfigsWidget *widget = new ClangDiagnosticConfigsWidget(currentConfigId());
widget->layout()->setMargin(0);
QDialog dialog;
dialog.setWindowTitle(ClangDiagnosticConfigsWidget::tr("Diagnostic Configurations"));
dialog.setLayout(new QVBoxLayout);
dialog.layout()->addWidget(widget);
auto *buttonsBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.layout()->addWidget(buttonsBox);
connect(buttonsBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttonsBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
const bool previousEnableLowerClazyLevels = codeModelSettings()->enableLowerClazyLevels();
connect(&dialog, &QDialog::accepted, [widget, previousEnableLowerClazyLevels]() {
QSharedPointer<CppCodeModelSettings> settings = codeModelSettings();
const ClangDiagnosticConfigs oldDiagnosticConfigs
= settings->clangCustomDiagnosticConfigs();
const ClangDiagnosticConfigs currentDiagnosticConfigs = widget->customConfigs();
if (oldDiagnosticConfigs != currentDiagnosticConfigs
|| previousEnableLowerClazyLevels != codeModelSettings()->enableLowerClazyLevels()) {
const ClangDiagnosticConfigsModel configsModel(currentDiagnosticConfigs);
if (!configsModel.hasConfigWithId(settings->clangDiagnosticConfigId()))
settings->resetClangDiagnosticConfigId();
settings->setClangCustomDiagnosticConfigs(currentDiagnosticConfigs);
settings->toSettings(Core::ICore::settings());
}
});
dialog.exec();
});
}
示例2: on_Paste__released
void UserFilters::on_Paste__released ()
{
auto edit = new QPlainTextEdit ();
QDialog dia (this);
dia.setWindowTitle (tr ("Paste rules"));
dia.resize (600, 400);
dia.setLayout (new QVBoxLayout ());
dia.layout ()->addWidget (new QLabel (tr ("Paste your custom rules here:")));
dia.layout ()->addWidget (edit);
auto box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dia.layout ()->addWidget (box);
connect (box,
SIGNAL (accepted ()),
&dia,
SLOT (accept ()));
connect (box,
SIGNAL (rejected ()),
&dia,
SLOT (reject ()));
if (dia.exec () != QDialog::Accepted)
return;
AddMulti (Model_, edit->toPlainText ());
}
示例3: OpenSettingsDialog
void OpenSettingsDialog (Util::XmlSettingsDialog *xsd, const QString& name)
{
QDialog dia;
dia.setWindowTitle (name);
dia.setLayout (new QVBoxLayout ());
dia.layout ()->addWidget (xsd);
auto box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QObject::connect (box,
SIGNAL (accepted ()),
&dia,
SLOT (accept ()));
QObject::connect (box,
SIGNAL (rejected ()),
&dia,
SLOT (reject ()));
QObject::connect (box,
SIGNAL (accepted ()),
xsd,
SLOT (accept ()));
QObject::connect (box,
SIGNAL (rejected ()),
xsd,
SLOT (reject ()));
dia.layout ()->addWidget (box);
dia.exec ();
xsd->setParent (0);
}
示例4: showAssistant
void QgsPropertyOverrideButton::showAssistant()
{
//first step - try to convert any existing expression to a transformer if one doesn't
//already exist
if ( !mProperty.transformer() )
{
( void )mProperty.convertToTransformer();
}
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
QgsPropertyAssistantWidget *widget = new QgsPropertyAssistantWidget( panel, mDefinition, mProperty, mVectorLayer );
widget->registerExpressionContextGenerator( mExpressionContextGenerator );
widget->setSymbol( mSymbol ); // we only show legend preview in dialog version
if ( panel && panel->dockMode() )
{
connect( widget, &QgsPropertyAssistantWidget::widgetChanged, this, [this, widget]
{
widget->updateProperty( this->mProperty );
mExpressionString = this->mProperty.asExpression();
mFieldName = this->mProperty.field();
updateSiblingWidgets( isActive() );
this->emit changed();
} );
connect( widget, &QgsPropertyAssistantWidget::panelAccepted, this, [ = ] { updateGui(); } );
panel->openPanel( widget );
return;
}
else
{
// Show the dialog version if not in a panel
QDialog *dlg = new QDialog( this );
QString key = QStringLiteral( "/UI/paneldialog/%1" ).arg( widget->panelTitle() );
QgsSettings settings;
dlg->restoreGeometry( settings.value( key ).toByteArray() );
dlg->setWindowTitle( widget->panelTitle() );
dlg->setLayout( new QVBoxLayout() );
dlg->layout()->addWidget( widget );
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsPropertyOverrideButton::showHelp );
dlg->layout()->addWidget( buttonBox );
if ( dlg->exec() == QDialog::Accepted )
{
widget->updateProperty( mProperty );
mExpressionString = mProperty.asExpression();
mFieldName = mProperty.field();
widget->acceptPanel();
updateSiblingWidgets( isActive() );
updateGui();
emit changed();
}
settings.setValue( key, dlg->saveGeometry() );
}
}
示例5: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDialog *dia = new QDialog;
dia->setLayout(new QBoxLayout(QBoxLayout::TopToBottom, dia));
dia->layout()->addWidget(new iLineEdit("First Name", dia));
dia->layout()->addWidget(new iLineEdit("Last Name", dia));
dia->layout()->addWidget(new QPushButton("Profit!", dia));
dia->show();
return app.exec();
}
示例6: showCheckMessages
void QgsGeometryCheckerResultTab::showCheckMessages()
{
if ( !mChecker->getMessages().isEmpty() )
{
QDialog dialog;
dialog.setLayout( new QVBoxLayout() );
dialog.layout()->addWidget( new QLabel( tr( "The following checks reported errors:" ) ) );
dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( "\n" ) ) );
QDialogButtonBox* bbox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal );
dialog.layout()->addWidget( bbox );
connect( bbox, SIGNAL( accepted() ), &dialog, SLOT( accept() ) );
connect( bbox, SIGNAL( rejected() ), &dialog, SLOT( reject() ) );
dialog.setWindowTitle( tr( "Check errors occurred" ) );
dialog.exec();
}
}
示例7: addView
void addView()
{
// the new View we want to add:
osgViewer::View* view = new osgViewer::View();
// a widget to hold our view:
QWidget* viewWidget = new osgEarth::QtGui::ViewWidget(view);
// a dialog to hold the view widget:
QDialog* win = new QDialog(this);
win->setModal( false );
win->setLayout( new QHBoxLayout() );
win->layout()->addWidget( viewWidget );
int x = osgEarth::Random().next( 1024 );
int y = osgEarth::Random().next( 768 );
win->setGeometry( x, y, 640, 480 );
win->show();
// set up the view
view->setCameraManipulator( new osgEarth::Util::EarthManipulator );
view->setSceneData( _scene.get() );
view->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
// add it to the composite viewer.
_viewer.addView( view );
}
示例8: finalize
void QgsGeometryCheckerResultTab::finalize()
{
ui.tableWidgetErrors->setSortingEnabled( true );
if ( !mChecker->getMessages().isEmpty() )
{
QDialog dialog;
dialog.setLayout( new QVBoxLayout() );
dialog.layout()->addWidget( new QLabel( tr( "The following checks reported errors:" ) ) );
dialog.layout()->addWidget( new QPlainTextEdit( mChecker->getMessages().join( QStringLiteral( "\n" ) ) ) );
QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal );
dialog.layout()->addWidget( bbox );
connect( bbox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept );
connect( bbox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject );
dialog.setWindowTitle( tr( "Check Errors Occurred" ) );
dialog.exec();
}
}
示例9: largeLogo
void AboutDialog::largeLogo(){
QDialog * d = new QDialog(0);
d->setAttribute(Qt::WA_DeleteOnClose);
d->setLayout(new QHBoxLayout(d));
QLabel *l = new QLabel(d);
l->setPixmap(QPixmap(":/images/splash_large.png"));
d->layout()->addWidget(l);
d->setWindowTitle("TeXstudio");
d->exec();
}
示例10: SetFrameWindow
void UtmpWebView::SetFrameWindow(int flag)
{
switch(flag)
{
case 0:
this->close();
break;
case 1:
this->showMinimized();
break;
case 2:
{
//全局也就只能有一个
QDialog* d = new QDialog(this,(Qt::WindowMinimizeButtonHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint));
d->setAttribute(Qt::WA_DeleteOnClose, true);
QWebInspector* wi = new QWebInspector(d);
wi->setPage(this->page());
d->setLayout(new QVBoxLayout());
d->layout()->setMargin(0);
d->layout()->addWidget(wi);
d->show();
d->resize(600,350);
break;
}
case 3:
{
QMessageBox::StandardButton rb = QMessageBox::information(NULL, "from QT", "这是网页让QT弹出的对话框", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if(rb == QMessageBox::Yes)
{
//这样直接调用,执行速度异常慢
//this->page()->mainFrame()->evaluateJavaScript("Ext.Msg.alert('from ext','这是QT让网页弹出的对话框');");
this->page()->mainFrame()->evaluateJavaScript("testFun();");
}
break;
}
case 4:
{
this->reload();
}
}
}
示例11: run
void ctkCmdLineModuleExplorerShowXmlAction::run()
{
QDialog* dialog = new QDialog();
try
{
dialog->setWindowTitle(this->ModuleRef.description().title());
}
catch (const ctkCmdLineModuleXmlException&)
{
dialog->setWindowTitle(this->ModuleRef.location().toString());
}
dialog->setLayout(new QVBoxLayout());
QHBoxLayout* buttonLayout = new QHBoxLayout();
buttonLayout->addStretch(1);
QPushButton* closeButton = new QPushButton(tr("Close"), dialog);
buttonLayout->addWidget(closeButton);
QTextEdit* textEdit = new QTextEdit(dialog);
textEdit->setPlainText(this->ModuleRef.rawXmlDescription().data());
QLabel* statusLabel = new QLabel(dialog);
statusLabel->setWordWrap(true);
if (this->ModuleRef.xmlValidationErrorString().isEmpty())
{
statusLabel->setText(tr("No validation errors."));
}
else
{
statusLabel->setText(this->ModuleRef.xmlValidationErrorString());
}
dialog->layout()->addWidget(statusLabel);
dialog->layout()->addWidget(textEdit);
dialog->layout()->addItem(buttonLayout);
connect(closeButton, SIGNAL(clicked()), dialog, SLOT(close()));
dialog->resize(800, 600);
dialog->show();
}
示例12: RunFormDialog
bool RunFormDialog (QWidget *widget)
{
QDialog *dialog (new QDialog ());
dialog->setWindowTitle (widget->windowTitle ());
dialog->setLayout (new QVBoxLayout ());
dialog->layout ()->addWidget (widget);
QDialogButtonBox *box = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog->layout ()->addWidget (box);
QObject::connect (box,
SIGNAL (accepted ()),
dialog,
SLOT (accept ()));
QObject::connect (box,
SIGNAL (rejected ()),
dialog,
SLOT (reject ()));
const bool result = dialog->exec () == QDialog::Accepted;
dialog->deleteLater ();
return result;
}
示例13: executable
QString CustomExecutableRunConfiguration::executable() const
{
QString exec;
if (QDir::isRelativePath(m_executable)) {
Environment env = project()->environment(project()->activeBuildConfiguration());
exec = env.searchInPath(m_executable);
} else {
exec = m_executable;
}
if (!QFileInfo(exec).exists()) {
// Oh the executable doesn't exists, ask the user.
QWidget *confWidget = const_cast<CustomExecutableRunConfiguration *>(this)->configurationWidget();
QDialog dialog;
dialog.setLayout(new QVBoxLayout());
dialog.layout()->addWidget(new QLabel("Could not find the executable, please specify one."));
dialog.layout()->addWidget(confWidget);
QDialogButtonBox *dbb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(dbb, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(dbb, SIGNAL(rejected()), &dialog, SLOT(reject()));
dialog.layout()->addWidget(dbb);
QString oldExecutable = m_executable;
QString oldWorkingDirectory = m_workingDirectory;
QStringList oldCmdArguments = m_cmdArguments;
if (dialog.exec()) {
return executable();
} else {
CustomExecutableRunConfiguration *that = const_cast<CustomExecutableRunConfiguration *>(this);
that->m_executable = oldExecutable;
that->m_workingDirectory = oldWorkingDirectory;
that->m_cmdArguments = oldCmdArguments;
emit that->changed();
return QString::null;
}
}
return exec;
}
示例14:
QDialog *PrincipalFormPlugin::dialogFromWidget(QWidget* w)
{
closeEater *ce = new closeEater;
w->installEventFilter( ce );
QDialog *d = new QDialog;
d->setLayout( new QHBoxLayout );
d->layout()->addWidget( w );
QObject::connect( ce,SIGNAL(close()),d,SLOT(close()) );
QObject::connect( d,SIGNAL(destroyed()),w,SLOT(deleteLater()) );
QObject::connect( w,SIGNAL(destroyed()),ce,SLOT(deleteLater()) );
return d;
}
示例15: optionDoAll
bool VOptionable::optionDoAll(QWidget* parent)
{
QDialog* dialog = this->optionCreateDlg(parent);
this->optionAddWidget(dialog->layout());
bool res = this->optionShowDlg(dialog);
if (res)
{
this->optionSaveDlg(dialog);
}
//
// do not delete dialog.
// dialog is automatically deleted when parent is delete.
//
// delete dialog;
return res;
}