本文整理汇总了C++中QDialog::result方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::result方法的具体用法?C++ QDialog::result怎么用?C++ QDialog::result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineBurgersCircuit_end
void AppWin::defineBurgersCircuit_end()
{
PltWin *pw = plotWidget[tabWidget->currentIndex()];
QString txt;
DVector B(3);
double Blen;
bool ok;
pw->doAfterMouseClicks = DO_NOTHING;
BVectFromCircuit(pw, pw->napicked, pw->apicked, B, Blen);
Ui::DCalcBVector ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
txt.sprintf("%d", pw->napicked-1);
ui.numNodes->setText(txt);
txt.sprintf("%0.6lf", B(1));
ui.Bx->setText(txt);
txt.sprintf("%0.6lf", B(2));
ui.By->setText(txt);
txt.sprintf("%0.6lf", B(3));
ui.Bz->setText(txt);
txt.sprintf("%0.6lf", Blen);
ui.Blen->setText(txt);
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
}
示例2: slt_loadingStart
void JBlockerMainWindow::slt_loadingStart()
{
this->statusBar()->showMessage(tr("LOADING MESSAGES ..."));
// QMessageBox::information(this, QString(), QString("PROGRAM NEED TO LOAD MESSAGES"), QMessageBox::Ok);
/* Create dialog */
QDialog dialog;
dialog.setWindowTitle(tr("Account Selection"));
QHBoxLayout* layout = new QHBoxLayout();
/* Label for dialog */
QLabel* dialogLabel = new QLabel(tr("Select An Account:"));
layout->addWidget(dialogLabel, 0, Qt::AlignHCenter);
/* Combo box for selecting account */
QComboBox* accountComboBox = new QComboBox();
accountComboBox->setFixedWidth(280);
/* Get account name list from message core */
accountComboBox->addItems(p_messageCore->getAccountNameList());
layout->addWidget(accountComboBox, 0, Qt::AlignHCenter);
/* Button for dialog */
QPushButton* dialogButton = new QPushButton(tr("Confirm"));
layout->addWidget(dialogButton, 0, Qt::AlignHCenter);
dialog.setLayout(layout);
QObject::connect(dialogButton, SIGNAL(clicked()), &dialog, SLOT(accept()));
dialog.exec();
if(dialog.result())
{
/* Set selected account id */
p_messageCore->setSelectedAccountId(accountComboBox->currentIndex());
}
this->statusBar()->addPermanentWidget(p_progressBar, 0);
p_progressBar->setValue(0);
p_progressBar->show();
/* Core runs */
p_messageCore->run();
}
示例3: dlgDPosPeierlsNabarro
void AppWin::dlgDPosPeierlsNabarro()
{
PltWin *pw = plotWidget[ tabWidget->currentIndex() ];
int i;
bool ok;
Ui::DFindDPosPeierlsNabarro ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
if (ok) {
for (i=0; i<tabWidget->count(); i++) {
plotWidget[i]->ndpoly = 0;
plotWidget[i]->nchain = 0;
plotWidget[i]->ndpath = 0;
}
pw->applyHow = ui.applyHow->currentIndex();
pw->napicked = 0;
pw->apicked.Allocate(10);
pw->apicked.EnlargeStep(5);
pw->clickAtoms = true;
pw->doAfterMouseClicks = CALC_DPOS_PEIERLSNABARRO;
pw->repaint();
}
}
示例4: probeAtomDispl
void AppWin::probeAtomDispl()
{
PltWin *pw = plotWidget[ tabWidget->currentIndex() ];
int i;
bool ok;
Ui::DSetupProbeAtomDispl ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
if (ok) {
for (i=0; i<tabWidget->count(); i++) {
plotWidget[i]->ndpoly = 0;
plotWidget[i]->nchain = 0;
plotWidget[i]->ndpath = 0;
}
pw->napicked = 0;
pw->apicked.Allocate(10);
pw->apicked.EnlargeStep(5);
pw->clickAtoms = true;
pw->doAfterMouseClicks = CALC_ATOM_DISPL;
pw->repaint();
}
}
示例5: SelectTopic
void DisparityPlugin::SelectTopic()
{
QDialog dialog;
Ui::topicselect ui;
ui.setupUi(&dialog);
std::vector<ros::master::TopicInfo> topics;
ros::master::getTopics(topics);
for (unsigned int i = 0; i < topics.size(); i++)
{
if (topics[i].datatype == "stereo_msgs/DisparityImage")
{
ui.displaylist->addItem(topics[i].name.c_str());
}
}
ui.displaylist->setCurrentRow(0);
dialog.exec();
if (dialog.result() == QDialog::Accepted && ui.displaylist->selectedItems().count() == 1)
{
ui_.topic->setText(ui.displaylist->selectedItems().first()->text());
TopicEdited();
}
}
示例6: defineBurgersCircuit
void AppWin::defineBurgersCircuit()
{
PltWin *pw = plotWidget[tabWidget->currentIndex()];
int i;
bool ok;
Ui::DDefineBCircuit ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
if (ok) {
for (i=0; i<tabWidget->count(); i++) {
plotWidget[i]->ndpoly = 0;
plotWidget[i]->nchain = 0;
plotWidget[i]->ndpath = 0;
}
pw->napicked = 0;
pw->apicked.Allocate(10);
pw->apicked.EnlargeStep(5);
pw->clickAtoms = true;
pw->doAfterMouseClicks = CALC_BURG_VECTOR;
pw->repaint();
}
}
示例7: drv_dialog
int drv_dialog(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QDialog *self = (QDialog*)head->native;
switch (drvid) {
case DIALOG_INIT: {
drvNewObj(a0,new QDialog);
break;
}
case DIALOG_SETMODAL: {
self->setModal(drvGetBool(a1));
break;
}
case DIALOG_ISMODAL: {
drvSetBool(a1,self->isModal());
break;
}
case DIALOG_SETRESULT: {
self->setResult(drvGetInt(a1));
break;
}
case DIALOG_RESULT: {
drvSetInt(a1,self->result());
break;
}
case DIALOG_EXEC: {
drvSetInt(a1,self->exec());
break;
}
case DIALOG_DONE: {
self->done(drvGetInt(a1));
break;
}
case DIALOG_ACCEPT: {
self->accept();
break;
}
case DIALOG_REJECT: {
self->reject();
break;
}
case DIALOG_ONACCEPTED: {
QObject::connect(self,SIGNAL(acceped()),drvNewSignal(self,a1,a2),SLOT(call()));
break;
}
case DIALOG_ONREJECTED: {
QObject::connect(self,SIGNAL(rejected()),drvNewSignal(self,a1,a2),SLOT(call()));
break;
}
default:
return 0;
}
return 1;
}
示例8: editBookmark
void BookmarksToolbar::editBookmark()
{
QAction* act = qobject_cast<QAction*> (sender());
if (!act) {
return;
}
ToolButton* button = static_cast<ToolButton*>(act->data().value<void*>());
if (!button) {
return;
}
Bookmark b = button->data().value<Bookmark>();
QDialog* dialog = new QDialog(this);
QFormLayout* layout = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLineEdit* editUrl = new QLineEdit(dialog);
QLineEdit* editTitle = new QLineEdit(dialog);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("Edit bookmark: "));
layout->addRow(label);
layout->addRow(new QLabel(tr("Title: ")), editTitle);
layout->addRow(new QLabel(tr("Url: ")), editUrl);
layout->addRow(box);
editUrl->setText(b.url.toString());
editTitle->setText(b.title);
editUrl->setCursorPosition(0);
editTitle->setCursorPosition(0);
dialog->setWindowTitle(tr("Edit Bookmark"));
dialog->setMinimumSize(400, 100);
dialog->exec();
if (dialog->result() == QDialog::Rejected) {
return;
}
QUrl url = QUrl::fromEncoded(editUrl->text().toUtf8());
QString title = editTitle->text();
if (url.isEmpty() || title.isEmpty()) {
return;
}
m_bookmarksModel->editBookmark(b.id, title, url, b.folder);
}
示例9: editFeed
void RSSManager::editFeed()
{
QString url = ui->tabWidget->tabToolTip(ui->tabWidget->currentIndex());
if (url.isEmpty()) {
return;
}
QDialog* dialog = new QDialog(this);
QFormLayout* layout = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLineEdit* editUrl = new QLineEdit(dialog);
QLineEdit* editTitle = new QLineEdit(dialog);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("Fill title and URL of a feed: "));
layout->addRow(label);
layout->addRow(new QLabel(tr("Feed title: ")), editTitle);
layout->addRow(new QLabel(tr("Feed URL: ")), editUrl);
layout->addRow(box);
editUrl->setText(ui->tabWidget->tabToolTip(ui->tabWidget->currentIndex()));
editTitle->setText(ui->tabWidget->tabText(ui->tabWidget->currentIndex()));
dialog->setWindowTitle(tr("Edit RSS Feed"));
dialog->setMinimumSize(400, 100);
dialog->exec();
if (dialog->result() == QDialog::Rejected) {
return;
}
QString address = editUrl->text();
QString title = editTitle->text();
if (address.isEmpty() || title.isEmpty()) {
return;
}
QSqlQuery query;
query.prepare("UPDATE rss SET address=?, title=? WHERE address=?");
query.bindValue(0, address);
query.bindValue(1, title);
query.bindValue(2, url);
query.exec();
refreshTable();
}
示例10: openPPICalculationDialog
void GeneralPage::openPPICalculationDialog()
{
int primary_screen_width = QApplication::primaryScreen()->size().width();
int primary_screen_height = QApplication::primaryScreen()->size().height();
float screen_diagonal_pixels = qSqrt(primary_screen_width*primary_screen_width + primary_screen_height*primary_screen_height);
float old_ppi = ppi_edit->value();
float old_screen_diagonal_inches = screen_diagonal_pixels / old_ppi;
QDialog* dialog = new QDialog(window(), Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
QGridLayout* layout = new QGridLayout();
int row = 0;
QLabel* resolution_label = new QLabel(tr("Primary screen resolution in pixels:"));
layout->addWidget(resolution_label, row, 0);
QLabel* resolution_display = new QLabel(QStringLiteral("%1 x %2").arg(primary_screen_width).arg(primary_screen_height));
layout->addWidget(resolution_display, row, 1);
row++;
QLabel* size_label = new QLabel(tr("Primary screen size in inches (diagonal):"));
layout->addWidget(size_label, row, 0);
QDoubleSpinBox* size_edit = Util::SpinBox::create(2, 0.01, 9999);
size_edit->setValue(old_screen_diagonal_inches);
layout->addWidget(size_edit, row, 1);
row++;
layout->addItem(Util::SpacerItem::create(this), row, 1);
row++;
QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
layout->addWidget(button_box, row, 0, 1, 2);
dialog->setLayout(layout);
connect(button_box, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
connect(button_box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
dialog->exec();
if (dialog->result() == QDialog::Accepted)
{
float screen_diagonal_inches = size_edit->value();
float new_ppi = screen_diagonal_pixels / screen_diagonal_inches;
ppi_edit->setValue(new_ppi);
ppiChanged(new_ppi);
}
}
示例11: burgVect
void AppWin::burgVect()
{
PltWin *pw = plotWidget[ tabWidget->currentIndex() ];
QString str;
int i, istart, iend;
bool ok;
Ui::DBurgVect ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
str.sprintf("%0.4lf", pw->Bvect(1));
ui.xcoord->setText(str);
ui.xcoord->selectAll();
str.sprintf("%0.4lf", pw->Bvect(2));
ui.ycoord->setText(str);
str.sprintf("%0.4lf", pw->Bvect(3));
ui.zcoord->setText(str);
dialog->exec();
ok = dialog->result()==QDialog::Accepted;
if (ok) {
if (ui.applyHow->currentIndex()==0)
istart = iend = tabWidget->currentIndex();
else {
istart = 0;
iend = tabWidget->count()-1;
}
for (i=istart; i<=iend; i++) {
pw = plotWidget[i];
if (!pw->isSelected)
continue;
pw->Bvect(1) = ui.xcoord->text().toDouble();
pw->Bvect(2) = ui.ycoord->text().toDouble();
pw->Bvect(3) = ui.zcoord->text().toDouble();
// must re-calculate the relative displacements - arrows plotted between different neighbors
if (pw->DispComponent==EDGE)
pw->calcEdgeRelDisp();
else if (pw->DispComponent==SCREW)
pw->calcScrewRelDisp();
pw->repaint();
}
}
}
示例12: mouseReleaseEvent
void XletSwitchBoard::mouseReleaseEvent(QMouseEvent *)
{
// qDebug() << Q_FUNC_INFO;
if (m_trace_box) {
QRect rect = QRect(m_first_corner, m_second_corner).normalized();
QRect gridRect = m_layout->getGridRect(rect);
if ((gridRect.top() != gridRect.bottom()) &&
(gridRect.right() != gridRect.left())) {
QString name;
QDialog dialog;
dialog.setWindowTitle(tr("New group"));
QVBoxLayout *layout = new QVBoxLayout(&dialog);
layout->addWidget(new QLabel(tr("Please enter a name for the new group"), &dialog));
QLineEdit *lineedit = new QLineEdit(&dialog);
layout->addWidget(lineedit);
layout->addWidget(new QLabel(tr("Please choose a color for the new group"), &dialog));
QtColorPicker *colorpicker = new QtColorPicker(&dialog);
colorpicker->setStandardColors();
colorpicker->setCurrentColor(QColor(63, 63, 255));
layout->addWidget(colorpicker);
QDialogButtonBox *buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
layout->addWidget(buttonbox);
connect(buttonbox, SIGNAL(accepted()),
&dialog, SLOT(accept()) );
connect(buttonbox, SIGNAL(rejected()),
&dialog, SLOT(reject()) );
dialog.exec();
if (dialog.result() == QDialog::Accepted)
name = lineedit->text();
if (!name.isEmpty()) {
Group *group = new Group(this);
group->setRect(gridRect);
group->setName(name);
group->setColor(colorpicker->currentColor());
m_group_list.append(group);
saveGroups();
}
}
m_trace_box = false;
update();
}
if (m_group_to_resize) {
unsetCursor();
m_group_to_resize = NULL;
}
}
示例13: login
bool GmailPyInterface::login()
{
bool goon=true;
while(m_user == "" || m_pass == "") {
QDialog d;
d.setModal(true);
QLineEdit* user(new QLineEdit);
QLineEdit* pass(new QLineEdit);
pass->setEchoMode(QLineEdit::Password);
QVBoxLayout* layout(new QVBoxLayout);
d.setLayout(layout);
layout->addWidget(new QLabel("Enter you gmail account:"));
QGridLayout* glayout(new QGridLayout());
glayout->addWidget(new QLabel("Username:"),0,0);
glayout->addWidget(user,0,1);
glayout->addWidget(new QLabel("Password:"),1,0);
glayout->addWidget(pass,1,1);
layout->addLayout(glayout);
QHBoxLayout* buttons(new QHBoxLayout);
QPushButton* okbutton(new QPushButton("Ok"));
QPushButton* cancelbutton(new QPushButton("Cancel"));
QObject::connect(okbutton, SIGNAL(clicked()), &d, SLOT(accept()));
QObject::connect(cancelbutton, SIGNAL(clicked()), &d, SLOT(reject()));
buttons->addWidget(okbutton);
buttons->addWidget(cancelbutton);
layout->addLayout(buttons);
d.exec();
if (d.result() == QDialog::Accepted) {
if (user->text().isEmpty() || pass->text().isEmpty()) continue;
m_user = user->text();
m_pass = pass->text();
break;
} else return false;
}
delete m_sender;
m_sender = 0;
m_sender = new MailSender("smtp.gmail.com", m_user + "@gmail.com", QStringList(m_user + "@gmail.com"), "@SAK", "Enjoy!");
m_sender->setSsl(true);
m_sender->setPort(587);
m_sender->setLogin(m_user, m_pass);
return true;
}
示例14: createNew
/*
* Створюємо новий пустий шаблон кросворду
*/
void tableTemplateWidget::createNew(void)
{
QDialog *dialog = new QDialog();
sizeOfTemplate = new Ui::SizeOfTemplate();
sizeOfTemplate->setupUi(dialog);
dialog->setModal(true);
dialog->exec();
if (dialog->result() == QDialog::Accepted)
{
numRow = sizeOfTemplate->spinRows->value();
numCol = sizeOfTemplate->spinColumns->value();
QSqlQuery query;
query.prepare("INSERT INTO crossword.templates (_rows, _columns) VALUES (?, ?);");
query.addBindValue(QVariant(numRow));
query.addBindValue(QVariant(numCol));
query.exec();
QSqlError le = query.lastError();
if (le.type() == QSqlError::NoError)
templateId = query.lastInsertId().toInt();
else
qDebug() << "createNew: " << le.text();
wi.clear();
setRowCount(numRow);
setColumnCount(numCol);
for (int i = 0; i < numRow; i++)
for (int j = 0; j < numCol; j++)
newCell(i, j, 0);
isDirty = true;
}
delete dialog;
}
示例15: openPPICalculationDialog
// slot
void GeneralSettingsPage::openPPICalculationDialog()
{
int primary_screen_width = QApplication::primaryScreen()->size().width();
int primary_screen_height = QApplication::primaryScreen()->size().height();
float screen_diagonal_pixels = qSqrt(primary_screen_width*primary_screen_width + primary_screen_height*primary_screen_height);
float old_ppi = ppi_edit->value();
float old_screen_diagonal_inches = screen_diagonal_pixels / old_ppi;
QDialog* dialog = new QDialog(window(), Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
auto layout = new QVBoxLayout(dialog);
auto form_layout = new QFormLayout();
QLabel* resolution_display = new QLabel(tr("%1 x %2").arg(primary_screen_width).arg(primary_screen_height));
form_layout->addRow(tr("Primary screen resolution in pixels:"), resolution_display);
QDoubleSpinBox* size_edit = Util::SpinBox::create(2, 0.01, 9999);
size_edit->setValue(old_screen_diagonal_inches);
form_layout->addRow(tr("Primary screen size in inches (diagonal):"), size_edit);
layout->addLayout(form_layout);
layout->addItem(Util::SpacerItem::create(this));
QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
layout->addWidget(button_box);
connect(button_box, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
connect(button_box, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
dialog->exec();
if (dialog->result() == QDialog::Accepted)
{
ppi_edit->setValue(screen_diagonal_pixels / size_edit->value());
}
}