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"; } }
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()); }
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; } }