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


C++ QDialog::saveGeometry方法代码示例

本文整理汇总了C++中QDialog::saveGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::saveGeometry方法的具体用法?C++ QDialog::saveGeometry怎么用?C++ QDialog::saveGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDialog的用法示例。


在下文中一共展示了QDialog::saveGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

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

示例2: selectKey

QString RscViewer::selectKey(const QString &rscName, int localFilter)
{
	QDialog d;
	d.setWindowTitle("Выбор знака");

	QPushButton pbOk("Готово");
	QPushButton pbCancel("Отмена");

	RscViewer view;
	view.setRsc(rscName);
	view.setLocalFilter(localFilter);
	if(localFilter >= 0)
	{
		view.hideFilter();
	}

	connect(&pbOk, SIGNAL(clicked()), &d, SLOT(accept()));
	connect(&view, SIGNAL(signSelected()), &d, SLOT(accept()));
	connect(&pbCancel, SIGNAL(clicked()), &d, SLOT(reject()));

	QVBoxLayout *main = new QVBoxLayout(&d);

	main->addWidget( &view );

	QHBoxLayout *btnlay = new QHBoxLayout();
	btnlay->addStretch();
	btnlay->addWidget( &pbOk );
	btnlay->addWidget( &pbCancel );

	main->addLayout(btnlay);

	QSettings set(qApp->organizationName(), qApp->applicationName());

	d.restoreGeometry( set.value("rscviewer_geometry").toByteArray() );

	bool ok = d.exec();

	set.setValue("rscviewer_geometry", d.saveGeometry() );

	if(!ok)
	{
		return 0;
	}

	return view.selectedSignKey();
}
开发者ID:yog-muskrat,项目名称:mapapi,代码行数:46,代码来源:rscviewer.cpp


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