本文整理汇总了C++中QDialog::setWindowModality方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setWindowModality方法的具体用法?C++ QDialog::setWindowModality怎么用?C++ QDialog::setWindowModality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setWindowModality方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectAttribute
void Dialog::selectAttribute()
{
QList<QString> currentAttributeList;
int i;
for (i=0; i < this->trendDataCollectorList.count(); i++)
{
currentAttributeList.append(this->trendDataCollectorList[i]->getAttributeName());
}
QDialog selDlg;
AttributeSelectForm* selWidget = new AttributeSelectForm(&selDlg, currentAttributeList, "");
selDlg.setWindowModality(Qt::WindowModal);
QBoxLayout dlgLayout(QBoxLayout::LeftToRight);
dlgLayout.addWidget(selWidget);
dlgLayout.setMargin(0);
selDlg.setLayout(&dlgLayout);
if (selDlg.exec() == QDialog::Accepted)
{
QList<QString> attrList = selWidget->getAttributes();
for (i=0; i < attrList.count(); i++)
{
qDebug() << attrList[i] << "\n";
if (!currentAttributeList.contains(attrList[i]))
{
this->addTrend(attrList[i]);
}
}
for (i=0; i < currentAttributeList.count(); i++)
{
if (!attrList.contains(currentAttributeList[i]))
{
this->removeTrend(currentAttributeList[i]);
}
}
}
else
{
qDebug() << "Not accepted\n";
}
}
示例2: testChildDialogInFrontOfModalParent
void tst_MacNativeEvents::testChildDialogInFrontOfModalParent()
{
// Test that a child dialog of a modal parent dialog is
// in front of the parent, and active:
QDialog parent;
parent.setWindowModality(Qt::ApplicationModal);
QDialog child(&parent);
QPushButton button("close", &child);
connect(&button, SIGNAL(clicked()), &child, SLOT(close()));
parent.show();
child.show();
QPoint inside = button.mapToGlobal(button.geometry().center());
// Post a click on the button to close the child dialog:
NativeEventList native;
native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 1, Qt::NoModifier));
native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 0, Qt::NoModifier));
native.play();
QTest::qWait(100);
QVERIFY(!child.isVisible());
}
示例3: on_mRendererSettingsButton_clicked
void QgsPointDisplacementRendererWidget::on_mRendererSettingsButton_clicked()
{
if ( mEmbeddedRendererWidget )
{
//create a dialog with the embedded widget
#ifdef Q_OS_MAC
QDialog* d = new QDialog( this->window() );
d->setWindowModality( Qt::WindowModal );
#else
QDialog* d = new QDialog();
#endif
QGridLayout* layout = new QGridLayout( d );
mEmbeddedRendererWidget->setParent( d );
QDialogButtonBox* buttonBox = new QDialogButtonBox( d );
buttonBox->addButton( QDialogButtonBox::Ok );
QObject::connect( buttonBox, SIGNAL( accepted() ), d, SLOT( accept() ) );
layout->addWidget( mEmbeddedRendererWidget, 0, 0 );
layout->addWidget( buttonBox, 1, 0 );
d->exec();
mEmbeddedRendererWidget->setParent( 0 );
delete d;
}
}