void QgsAttributeEditor::selectDate() { QPushButton *pb = qobject_cast<QPushButton *>( sender() ); if ( !pb ) return; QWidget *hbox = qobject_cast<QWidget *>( pb->parent() ); if ( !hbox ) return; QLineEdit *le = hbox->findChild<QLineEdit *>(); if ( !le ) return; QDialog *dlg = new QDialog(); dlg->setWindowTitle( tr( "Select a date" ) ); QVBoxLayout *vl = new QVBoxLayout( dlg ); QCalendarWidget *cw = new QCalendarWidget( dlg ); cw->setSelectedDate( QDate::fromString( le->text(), Qt::ISODate ) ); vl->addWidget( cw ); QDialogButtonBox *buttonBox = new QDialogButtonBox( dlg ); buttonBox->addButton( QDialogButtonBox::Ok ); buttonBox->addButton( QDialogButtonBox::Cancel ); vl->addWidget( buttonBox ); connect( buttonBox, SIGNAL( accepted() ), dlg, SLOT( accept() ) ); connect( buttonBox, SIGNAL( rejected() ), dlg, SLOT( reject() ) ); if ( dlg->exec() == QDialog::Accepted ) { le->setText( cw->selectedDate().toString( Qt::ISODate ) ); } }
void AndroidGdbServerKitInformationWidget::showDialog() { QDialog dialog; QVBoxLayout *layout = new QVBoxLayout(&dialog); QFormLayout *formLayout = new QFormLayout; formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); QLabel *binaryLabel = new QLabel(tr("&Binary:")); PathChooser *chooser = new PathChooser; chooser->setExpectedKind(PathChooser::ExistingCommand); chooser->setPath(AndroidGdbServerKitInformation::gdbServer(m_kit).toString()); binaryLabel->setBuddy(chooser); formLayout->addRow(binaryLabel, chooser); layout->addLayout(formLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); layout->addWidget(buttonBox); dialog.setWindowTitle(tr("GDB Server for \"%1\"").arg(m_kit->displayName())); if (dialog.exec() == QDialog::Accepted) AndroidGdbServerKitInformation::setGdbSever(m_kit, chooser->fileName()); }
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() ); } }
void QSoundProcessor::open_volume_dialog() { QDialog dialog; dialog.setWindowTitle(tr("Volume level")); dialog.setFixedSize(160,80); QVBoxLayout Lcenter; QGroupBox GBbox(tr("Set volume level:")); QHBoxLayout layout; QSlider slider; slider.setOrientation(Qt::Horizontal); slider.setRange(1, VOLUME_STEPS); slider.setTickInterval(10); slider.setTickPosition(QSlider::TicksBothSides); QLabel lable(tr("error")); connect(&slider, SIGNAL(valueChanged(int)), &lable, SLOT(setNum(int))); if(pt_audioinput) { slider.setValue( VOLUME_STEPS * pt_audioinput->volume() ); } connect(&slider, SIGNAL(sliderMoved(int)), this, SLOT(set_volume(int))); layout.addWidget(&slider); layout.addWidget(&lable, 2, Qt::AlignRight); GBbox.setLayout(&layout); Lcenter.addWidget(&GBbox); dialog.setLayout(&Lcenter); dialog.exec(); }
void SettingDialog::testClicked() { QDir dir(QDir::currentPath()); dir.cd("sounds"); QDialog dlg; QPushButton ok("Ok",&dlg); QLabel label(soundName()); //dlg.setSoundFile(); QVBoxLayout layout; layout.addWidget(&ok); layout.addWidget(&label); dlg.setWindowTitle(trUtf8("تجربة الصوت")); dlg.setLayout(&layout); Phonon::MediaObject* player=new Phonon::MediaObject(&dlg); player->setCurrentSource(Phonon::MediaSource(dir.filePath(soundName()))); Phonon::AudioOutput* audioOutput=new Phonon::AudioOutput(&dlg); Phonon::createPath(player,audioOutput); dlg.exec(); player->stop(); delete player; delete audioOutput; player=0; audioOutput=0; }
void MessageHandlerWidget::fatalMessageReceived(const QString &app, const QString &message, const QTime &time, const QStringList &backtrace) { if (Endpoint::isConnected() && !qobject_cast<MessageHandlerClient*>(ObjectBroker::object<MessageHandlerInterface*>())) { // only show on remote side return; } QDialog dlg; dlg.setWindowTitle(QObject::tr("QFatal in %1 at %2").arg(app).arg(time.toString())); QGridLayout *layout = new QGridLayout; QLabel *iconLabel = new QLabel; QIcon icon = dlg.style()->standardIcon(QStyle::SP_MessageBoxCritical, 0, &dlg); int iconSize = dlg.style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, &dlg); iconLabel->setPixmap(icon.pixmap(iconSize, iconSize)); iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(iconLabel, 0, 0); QLabel *errorLabel = new QLabel; errorLabel->setTextFormat(Qt::PlainText); errorLabel->setWordWrap(true); errorLabel->setText(message); layout->addWidget(errorLabel, 0, 1); QDialogButtonBox *buttons = new QDialogButtonBox; if (!backtrace.isEmpty()) { QListWidget *backtraceWidget = new QListWidget; foreach (const QString &frame, backtrace) { backtraceWidget->addItem(frame); }
/************ * *功能:重新启动操作 * * * **/ void mainview::rebootcomputer() { QDialog *tmp = new QDialog(); tmp->setWindowIcon(QIcon("./images/logo.png")); tmp->setWindowTitle("重启提示"); QVBoxLayout *vlay = new QVBoxLayout(); QHBoxLayout *hlay = new QHBoxLayout(); QLabel *afforminfo = new QLabel("重启?",tmp); QPushButton *button_ok = new QPushButton("OK",tmp); QPushButton *button_cancel = new QPushButton("Quit",tmp); hlay->addWidget(button_ok); hlay->addWidget(button_cancel); vlay->addWidget(afforminfo); vlay->addLayout(hlay); tmp->setLayout(vlay); connect(button_ok,SIGNAL(clicked()),tmp,SLOT(accept())); connect(button_cancel,SIGNAL(clicked()),tmp,SLOT(close())); if(tmp->exec() == QDialog::Accepted) { QProcess::execute("shutdown -r now"); } }
int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName(app.translate("main", "Matrix Quiz")); #ifdef Q_WS_MAC app.setCursorFlashTime(0); #endif qsrand(static_cast<uint>(time(0))); QWebSettings *webSettings = QWebSettings::globalSettings(); webSettings->setAttribute(QWebSettings::AutoLoadImages, true); webSettings->setAttribute(QWebSettings::JavascriptEnabled, true); webSettings->setAttribute(QWebSettings::PluginsEnabled, true); QString url = QUrl::fromLocalFile(AQP::applicationPathOf() + "/matrixquiz.html").toString(); BrowserWindow *browser = new BrowserWindow(url, new WebPage); browser->showToolBar(false); browser->enableActions(false); QDialogButtonBox *buttonBox = new QDialogButtonBox; QPushButton *quitButton = buttonBox->addButton( app.translate("main", "&Quit"), QDialogButtonBox::AcceptRole); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(browser, 1); layout->addWidget(buttonBox); QDialog dialog; dialog.setLayout(layout); QObject::connect(quitButton, SIGNAL(clicked()), &dialog, SLOT(accept())); dialog.setWindowTitle(app.applicationName()); dialog.show(); return app.exec(); }
void RenderWindow::slotMenuAboutNews() { QString filename = systemData.docDir + "NEWS"; QFile f(filename); QString text = ""; if (f.open(QIODevice::ReadOnly | QIODevice::Text)) { text = f.readAll(); } QLabel *label = new QLabel; label->setText(text); label->setWordWrap(true); label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); QScrollArea *scroll = new QScrollArea(); scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scroll->setWidget(label); scroll->setWidgetResizable(true); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(scroll); QDialog *dialog = new QDialog(); dialog->setLayout(layout); dialog->setWindowTitle(QObject::tr("News")); dialog->show(); }
static void * qQuailNotifyFormatted(const char *title, const char *primary, const char *secondary, const char *text) { QDialog *dialog; QVBoxLayout *layout; QLabel *label; QTextEdit *textview; QString message; QString newTitle; message = ""; if (primary != NULL) { message += "<p>"; message += primary; message += "</p>"; } if (secondary != NULL) { message += "<p>"; message += secondary; message += "</p>"; } if (title == NULL) { if (primary != NULL) newTitle = QString(primary).trimmed(); else newTitle = ""; } else newTitle = title; //dialog = new QDialog(NULL, "notify-formatted"); dialog = new QDialog(); dialog->setWindowTitle(newTitle); layout = new QVBoxLayout(); dialog->setLayout(layout); //layout->setAutoAdd(true); label = new QLabel(dialog); layout->addWidget(label); label->setText(message); textview = new QTextEdit(dialog); layout->addWidget(textview); textview->setText(text); dialog->show(); return NULL; }
void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const QString& hash) { if (upload->getError() == AssetUpload::NoError) { // show message box for successful upload, with copiable text for ATP hash QDialog* hashCopyDialog = new QDialog(_dialogParent); // delete the dialog on close hashCopyDialog->setAttribute(Qt::WA_DeleteOnClose); // set the window title hashCopyDialog->setWindowTitle(tr("Successful Asset Upload")); // setup a layout for the contents of the dialog QVBoxLayout* boxLayout = new QVBoxLayout; // set the label text (this shows above the text box) QLabel* lineEditLabel = new QLabel; lineEditLabel->setText(QString("ATP URL for %1").arg(QFileInfo(upload->getFilename()).fileName())); // setup the line edit to hold the copiable text QLineEdit* lineEdit = new QLineEdit; QString atpURL = QString("%1:%2.%3").arg(URL_SCHEME_ATP).arg(hash).arg(upload->getExtension()); // set the ATP URL as the text value so it's copiable lineEdit->insert(atpURL); // figure out what size this line edit should be using font metrics QFontMetrics textMetrics { lineEdit->font() }; // set the fixed width on the line edit // pad it by 10 to cover the border and some extra space on the right side (for clicking) static const int LINE_EDIT_RIGHT_PADDING { 10 }; lineEdit->setFixedWidth(textMetrics.width(atpURL) + LINE_EDIT_RIGHT_PADDING ); // left align the ATP URL line edit lineEdit->home(true); // add the label and line edit to the dialog boxLayout->addWidget(lineEditLabel); boxLayout->addWidget(lineEdit); // setup an OK button to close the dialog QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttonBox, &QDialogButtonBox::accepted, hashCopyDialog, &QDialog::close); boxLayout->addWidget(buttonBox); // set the new layout on the dialog hashCopyDialog->setLayout(boxLayout); // show the new dialog hashCopyDialog->show(); } else { // display a message box with the error showErrorDialog(upload, _dialogParent); } upload->deleteLater(); }
void PosService::on_btSetTime_clicked() { int button_width = data->getVariables()->value(_S("standart_button_width")).toInt(); int button_height = data->getVariables()->value(_S("standart_button_height")).toInt(); int button_margin = data->getVariables()->value(_S("standart_margins")).toInt(); QDialog dlg; QVBoxLayout* mainLayout = new QVBoxLayout(); dlg.setLayout(mainLayout); dlg.setWindowTitle(_T("Установка времени")); QDateTimeEdit* edit = new QDateTimeEdit(QDateTime::currentDateTime()); edit->setMaximumHeight(button_height); edit->setMinimumHeight(button_height); mainLayout->addWidget(edit); QHBoxLayout *btLayout = new QHBoxLayout(); mainLayout->addLayout(btLayout); QPushButton* bt; bt = new QPushButton(_T("OK"), this); bt->setMaximumSize(button_width * 2 + button_margin, button_height); bt->setMinimumSize(button_width * 2 + button_margin, button_height); btLayout->addWidget(bt); connect(bt, SIGNAL(clicked()), &dlg, SLOT(accept())); bt = new QPushButton(_T("Отмена"), this); bt->setMaximumSize(button_width * 2 + button_margin, button_height); bt->setMinimumSize(button_width * 2 + button_margin, button_height); btLayout->addWidget(bt); connect(bt, SIGNAL(clicked()), &dlg, SLOT(reject())); int result = dlg.exec(); if(result==QDialog::Accepted) { QString dt = edit->dateTime().toString(data->getSettings()->value("posservice/command_setdatetime_format").toString()); QString command = data->getSettings()->value("posservice/command_setdatetime").toString().arg(dt); if (loglevel > 0) qDebug() << _T("%1 Устанавливаем новое время: %2 (было: %3)") .arg(posForLog) .arg(edit->dateTime().toString(Qt::ISODate)) .arg(QDateTime::currentDateTime().toString(Qt::ISODate)); int result = QProcess::execute(command); if(result<0) { qDebug() << _T("%1 Ошибка установки нового времени. Код ошибки: %2") .arg(posForLog) .arg(result); QMessageBox message; message.setText(_T("Ошибка установки нового времени.\nКод ошибки: %1").arg(result)); message.exec(); } } }
void showabout() { QDialog vedit; vedit.setWindowTitle(QObject::tr("About vedit")); vedit.contentsRect(); vedit.resize(300, 150); vedit.exec(); }
bool NetworkPermissionTester::havePermission() { QSettings settings; settings.beginGroup("Preferences"); QString tag = QString("network-permission-%1").arg(SV_VERSION); bool permish = false; if (settings.contains(tag)) { permish = settings.value(tag, false).toBool(); } else { QDialog d; d.setWindowTitle(QCoreApplication::translate("NetworkPermissionTester", "Welcome to Sonic Visualiser")); QGridLayout *layout = new QGridLayout; d.setLayout(layout); QLabel *label = new QLabel; label->setWordWrap(true); label->setText (QCoreApplication::translate ("NetworkPermissionTester", "<h2>Welcome to Sonic Visualiser!</h2>" "<p><img src=\":icons/qm-logo-smaller.png\" style=\"float:right\">Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.</p>" "<p>Developed in the Centre for Digital Music at Queen Mary, University of London, Sonic Visualiser is provided free as open source software under the GNU General Public License.</p>" "<p><hr></p>" "<p><b>Before we go on...</b></p>" "<p>Sonic Visualiser would like to make networking connections and open a network port.</p>" "<p>This is to:</p>" "<ul><li> Find information about available and installed plugins;</li>" "<li> Support the use of Open Sound Control, where configured; and</li>" "<li> Tell you when updates are available.</li>" "</ul>" "<p>No personal information will be sent, no tracking is carried out, and all requests happen in the background without interrupting your work.</p>" "<p>We recommend that you allow this, because it makes Sonic Visualiser more useful. But if you do not wish to do so, please un-check the box below.<br></p>")); layout->addWidget(label, 0, 0); QCheckBox *cb = new QCheckBox(QCoreApplication::translate("NetworkPermissionTester", "Allow this")); cb->setChecked(true); layout->addWidget(cb, 1, 0); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); QObject::connect(bb, SIGNAL(accepted()), &d, SLOT(accept())); layout->addWidget(bb, 2, 0); d.exec(); permish = cb->isChecked(); settings.setValue(tag, permish); } settings.endGroup(); return permish; }
void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) { QDialog* dialog = new QDialog(p_QupZilla); dialog->setWindowTitle(tr("Authorization required")); QFormLayout* formLa = new QFormLayout(dialog); QLabel* label = new QLabel(dialog); QLabel* userLab = new QLabel(dialog); QLabel* passLab = new QLabel(dialog); userLab->setText(tr("Username: "******"Password: "******"Save username and password on this site")); pass->setEchoMode(QLineEdit::Password); 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("A username and password are being requested by %1. " "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm()))); formLa->addRow(label); formLa->addRow(userLab, user); formLa->addRow(passLab, pass); formLa->addRow(save); formLa->addWidget(box); AutoFillModel* fill = mApp->autoFill(); if (fill->isStored(reply->url())) { save->setChecked(true); user->setText(fill->getUsername(reply->url())); pass->setText(fill->getPassword(reply->url())); } emit wantsFocus(reply->url()); //Do not save when private browsing is enabled if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { save->setVisible(false); } if (dialog->exec() != QDialog::Accepted) { return; } auth->setUser(user->text()); auth->setPassword(pass->text()); if (save->isChecked()) { fill->addEntry(reply->url(), user->text(), pass->text()); } }
CrashHandler::Action CrashHandler::promptUserForAction(bool showCrashMessage) { QDialog crashDialog; QLabel* label; if (showCrashMessage) { crashDialog.setWindowTitle("Interface Crashed Last Run"); label = new QLabel("If you are having trouble starting would you like to reset your settings?"); } else { crashDialog.setWindowTitle("Reset Settings"); label = new QLabel("Would you like to reset your settings?"); } QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(label); QRadioButton* option1 = new QRadioButton("Reset all my settings"); QRadioButton* option2 = new QRadioButton("Reset my settings but keep essential info"); QRadioButton* option3 = new QRadioButton("Continue with my current settings"); option3->setChecked(true); layout->addWidget(option1); layout->addWidget(option2); layout->addWidget(option3); layout->addSpacing(12); layout->addStretch(); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok); layout->addWidget(buttons); crashDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept())); crashDialog.setLayout(layout); int result = crashDialog.exec(); if (result == QDialog::Accepted) { if (option1->isChecked()) { return CrashHandler::DELETE_INTERFACE_INI; } if (option2->isChecked()) { return CrashHandler::RETAIN_IMPORTANT_INFO; } } // Dialog cancelled or "do nothing" option chosen return CrashHandler::DO_NOTHING; }
/** * Creates and brings up the dialog box which allows the user to * re-label the plot various labes. * */ void ScatterPlotWindow::reLabel() { QDialog *dialog = new QDialog(p_scatterPlotWindow); dialog->setWindowTitle("Name Plot Labels"); QWidget *buttons = new QWidget (dialog); QWidget *textAreas = new QWidget (dialog); QWidget *labels = new QWidget (dialog); QWidget *main = new QWidget (dialog); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(main,0); layout->addWidget(buttons,0); dialog->setLayout(layout); QToolButton *okButton = new QToolButton(dialog); connect(okButton,SIGNAL(released()),this,SLOT(setLabels())); connect(okButton,SIGNAL(released()),dialog,SLOT(hide())); okButton->setShortcut(Qt::Key_Enter); okButton->setText("Ok"); QToolButton *cancelButton = new QToolButton(dialog); connect(cancelButton,SIGNAL(released()),dialog,SLOT(hide())); cancelButton->setText("Cancel"); QLabel *plotLabel = new QLabel("Plot Title: "); QLabel *xAxisLabel = new QLabel("X-Axis Label: "); QLabel *yAxisLabel = new QLabel("Y-Axis Label: "); QVBoxLayout *vlayout = new QVBoxLayout(); vlayout->addWidget(plotLabel); vlayout->addWidget(xAxisLabel); vlayout->addWidget(yAxisLabel); labels->setLayout(vlayout); p_plotTitleText = new QLineEdit(p_plot->title().text(),dialog); p_xAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::xBottom).text(),dialog); p_yAxisText = new QLineEdit(p_plot->axisTitle(QwtPlot::yLeft).text(),dialog); QVBoxLayout *v2layout = new QVBoxLayout(); v2layout->addWidget(p_plotTitleText); v2layout->addWidget(p_xAxisText); v2layout->addWidget(p_yAxisText); textAreas->setLayout(v2layout); QHBoxLayout *mainLayout = new QHBoxLayout(); mainLayout->addWidget(labels); mainLayout->addWidget(textAreas); main->setLayout(mainLayout); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->addWidget(okButton); hlayout->addWidget(cancelButton); buttons->setLayout(hlayout); dialog->setFixedSize(400,190); dialog->show(); }
// ---------------------------------------------------------------------------- // VOptionable // ---------------------------------------------------------------------------- QDialog* VOptionable::optionCreateDlg(QWidget* parent) { QDialog* dialog = new QDialog(parent); VObject* object = dynamic_cast<VObject*>(this); if (object != NULL) dialog->setWindowTitle(object->name == "" ? "Option" : object->name + " Option"); new QGridLayout(dialog); return dialog; }
void ccRenderingTools::ShowDepthBuffer(ccGBLSensor* sensor, QWidget* parent) { if (!sensor) return; const ccGBLSensor::DepthBuffer& depthBuffer = sensor->getDepthBuffer(); if (!depthBuffer.zBuff) return; //determine min and max depths ScalarType minDist = 0, maxDist = 0; { const ScalarType *_zBuff = depthBuffer.zBuff; for (int x=0; x<depthBuffer.height*depthBuffer.width; ++x,++_zBuff) { if (x==0) { maxDist = minDist = *_zBuff; } else if (*_zBuff > 0) { maxDist = std::max(maxDist,*_zBuff); minDist = std::min(minDist,*_zBuff); } } } QImage bufferImage(depthBuffer.width,depthBuffer.height,QImage::Format_RGB32); { ccColorScale::Shared colorScale = ccColorScalesManager::GetDefaultScale(); assert(colorScale); ScalarType coef = maxDist-minDist < ZERO_TOLERANCE ? 0 : static_cast<ScalarType>(ccColorScale::MAX_STEPS-1)/(maxDist-minDist); const ScalarType* _zBuff = depthBuffer.zBuff; for (int y=0; y<depthBuffer.height; ++y) { for (int x=0; x<depthBuffer.width; ++x,++_zBuff) { const colorType* col = (*_zBuff >= minDist ? colorScale->getColorByIndex(static_cast<unsigned>((*_zBuff-minDist)*coef)) : ccColor::black); bufferImage.setPixel(x,depthBuffer.height-1-y,qRgb(col[0],col[1],col[2])); } } } QDialog* dlg = new QDialog(parent); dlg->setWindowTitle(QString("%0 depth buffer [%1 x %2]").arg(sensor->getParent()->getName()).arg(depthBuffer.width).arg(depthBuffer.height)); dlg->setFixedSize(bufferImage.size()); QVBoxLayout* vboxLayout = new QVBoxLayout(dlg); vboxLayout->setContentsMargins(0,0,0,0); QLabel* label = new QLabel(dlg); label->setScaledContents(true); vboxLayout->addWidget(label); label->setPixmap(QPixmap::fromImage(bufferImage)); dlg->show(); }
void newWordManageWindow::insertWord(QString spell, QString meaning) { QDialog *dialog = new QDialog(addDialog); dialog->setWindowTitle("重复"); dialog->resize(200, 110); QLabel *label = new QLabel(dialog); QLabel *labelText = new QLabel(dialog); label->setStyleSheet("background-color:lightblue"); labelText->setAlignment(Qt::AlignCenter); labelText->setGeometry(30, 0, 140, 70); label->setGeometry(0, 0, this->width(), this->height()); QPushButton *yesButton = new QPushButton(dialog); yesButton->setGeometry(140, 70, 55, 20); yesButton->setText("返回"); yesButton->setStyleSheet("color:black"); bool fail = false; if(spell.size()==0) { labelText->setText("单词不能为空!"); fail = true; } else if(meaning.size()==0) { labelText->setText("释义不能为空!"); fail = true; } for(int i=0; i<newWordList.size(); i++) { if(newWordList[i].spell==spell) { labelText->setText("您已经添加过这个生词了!"); } fail = true; break; } if(fail) { dialog->show(); connect(yesButton,SIGNAL(clicked()), dialog, SLOT(close())); } if(!fail) { QDateTime sysTime = QDateTime::currentDateTime(); QStringList list = sysTime.toString("yyyy-MM-dd").split('-'); QString time = list[0]+list[1]+list[2]; NEWWORD newword = { meaning, spell, time }; newWordList.push_front(newword); qDebug() << currentPage << " " << TotalPages; update(); } }
void CPBoolPlugin::configDialog() { QDialog dialog; QGridLayout *layout = new QGridLayout; QLabel *topictxt = new QLabel(tr("Topic Name:")); QLineEdit *topicedit = new QLineEdit(topic); layout->addWidget(topictxt, 0, 0); layout->addWidget(topicedit, 0, 1); QLabel *slabeltxt = new QLabel(tr("Show Label:")); QCheckBox *slabelcheck = new QCheckBox(); slabelcheck->setChecked(ui->label->isVisible()); layout->addWidget(slabeltxt, 1, 0); layout->addWidget(slabelcheck, 1, 1); QLabel *labeltxt = new QLabel(tr("Label:")); QLineEdit *labeledit = new QLineEdit(ui->label->text()); connect(slabelcheck, SIGNAL(toggled(bool)), labeledit, SLOT(setEnabled(bool))); labeledit->setEnabled(ui->label->isVisible()); layout->addWidget(labeltxt, 2, 0); layout->addWidget(labeledit, 2, 1); QPushButton *okbutton = new QPushButton(tr("&OK")); layout->addWidget(okbutton, 3, 1); dialog.setLayout(layout); dialog.setWindowTitle("Plugin Configuration - Bool"); connect(okbutton, SIGNAL(clicked()), &dialog, SLOT(accept())); if(!dialog.exec()) return; if(topic != topicedit->text()) { emit changeValue("N/A"); topic = topicedit->text(); settings->setValue(uuid.toString() + "/Topic", topic); activateNodelet(true); } if(ui->label->isVisible() != slabelcheck->isChecked()) { ui->label->setVisible(slabelcheck->isChecked()); ui->value->setAlignment((slabelcheck->isChecked() ? Qt::AlignLeft : Qt::AlignHCenter) | Qt::AlignVCenter); settings->setValue(uuid.toString() + "/ShowLabel", slabelcheck->isChecked()); } if(ui->label->text() != labeledit->text()) { emit changeLabel(labeledit->text()); settings->setValue(uuid.toString() + "/Label", labeledit->text()); } }
void InjectTransactions::injectBulk() { QDialog d; Ui_InjectTransactions u; u.setupUi(&d); d.setWindowTitle("Bulk Inject Transactions"); if (d.exec() == QDialog::Accepted) for (QString const& s: u.transactions->toPlainText().split("\n")) doInject(s); }
void IbisHardwareModule::OpenTrackerSettingsDialog() { QDialog * dialog = new QDialog(); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setWindowTitle( "Tracker Settings" ); QVBoxLayout * layout = new QVBoxLayout( dialog ); QWidget * dlg = m_tracker->CreateSettingsDialog( dialog ); layout->addWidget( dlg ); dialog->show(); }
QDialog *GraphicsScene::createDialog(const QString &windowTitle) const { QDialog *dialog = new QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint); dialog->setWindowOpacity(0.8); dialog->setWindowTitle(windowTitle); dialog->setLayout(new QVBoxLayout); return dialog; }
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(); }
void QgsDualView::modifySort() { if ( !mLayer ) return; QgsAttributeTableConfig config = mConfig; QDialog orderByDlg; orderByDlg.setWindowTitle( tr( "Configure Attribute Table Sort Order" ) ); QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); QGridLayout *layout = new QGridLayout(); connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept ); connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject ); orderByDlg.setLayout( layout ); QGroupBox *sortingGroupBox = new QGroupBox(); sortingGroupBox->setTitle( tr( "Defined sort order in attribute table" ) ); sortingGroupBox->setCheckable( true ); sortingGroupBox->setChecked( !sortExpression().isEmpty() ); layout->addWidget( sortingGroupBox ); sortingGroupBox->setLayout( new QGridLayout() ); QgsExpressionBuilderWidget *expressionBuilder = new QgsExpressionBuilderWidget(); QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) ); expressionBuilder->setExpressionContext( context ); expressionBuilder->setLayer( mLayer ); expressionBuilder->loadFieldNames(); expressionBuilder->loadRecent( QStringLiteral( "generic" ) ); expressionBuilder->setExpressionText( sortExpression().isEmpty() ? mLayer->displayExpression() : sortExpression() ); sortingGroupBox->layout()->addWidget( expressionBuilder ); QCheckBox *cbxSortAscending = new QCheckBox( tr( "Sort ascending" ) ); cbxSortAscending->setChecked( config.sortOrder() == Qt::AscendingOrder ); sortingGroupBox->layout()->addWidget( cbxSortAscending ); layout->addWidget( dialogButtonBox ); if ( orderByDlg.exec() ) { Qt::SortOrder sortOrder = cbxSortAscending->isChecked() ? Qt::AscendingOrder : Qt::DescendingOrder; if ( sortingGroupBox->isChecked() ) { setSortExpression( expressionBuilder->expressionText(), sortOrder ); config.setSortExpression( expressionBuilder->expressionText() ); config.setSortOrder( sortOrder ); } else { setSortExpression( QString(), sortOrder ); config.setSortExpression( QString() ); } setAttributeTableConfig( config ); } }
void NoteDialog::infos() { if (!m_note) { QMessageBox::information(this, "Informations sur la note", "Aucune information pour l'instant.<br>La note n'est pas encore enregistrée."); return; } QDialog *dialog = new QDialog(this, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); dialog->setWindowTitle("Informations sur la note"); QLabel *creation = new QLabel(m_note->createdAt().toString("d MMM yyyy à hh:mm:ss")); QLabel *update = new QLabel(m_note->updatedAt().toString("d MMM yyyy à hh:mm:ss")); QLabel *sync = new QLabel(m_note->toSync() ? "Synchronisation nécessaire" : "Synchronisé le " + m_note->syncedAt().toString("d MMM yyyy à hh:mm:ss")); QLabel *chars = new QLabel(QString::number(m_noteEdit->contentChars())); QLabel *words = new QLabel(QString::number(m_noteEdit->contentWords())); QLabel *lines = new QLabel(QString::number(m_noteEdit->contentLines())); creation->setAlignment(Qt::AlignRight); update->setAlignment(Qt::AlignRight); sync->setAlignment(Qt::AlignRight); chars->setAlignment(Qt::AlignRight); words->setAlignment(Qt::AlignRight); lines->setAlignment(Qt::AlignRight); QFormLayout *noteLayout = new QFormLayout; noteLayout->addRow("Créée le", creation); noteLayout->addRow("Mise à jour le", update); noteLayout->addRow("Statut", sync); QFormLayout *textLayout = new QFormLayout; textLayout->addRow("Caractères", chars); textLayout->addRow("Mots", words); textLayout->addRow("Lignes", lines); QGroupBox *noteGroupBox = new QGroupBox("Note"); noteGroupBox->setLayout(noteLayout); QGroupBox *textGroupBox = new QGroupBox("Texte"); textGroupBox->setLayout(textLayout); QPushButton *close = new QPushButton("&Fermer", dialog); connect(close, SIGNAL(clicked()), dialog, SLOT(accept())); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addWidget(noteGroupBox); mainLayout->addWidget(textGroupBox); mainLayout->addWidget(close, 0, Qt::AlignRight); dialog->setLayout(mainLayout); dialog->exec(); }
void RectangleAnnotationTool::mouseDoubleClickEvent(QMouseEvent *event) { if (std::shared_ptr<MultiResolutionImage> local_img = _annotationPlugin->getCurrentImage().lock()) { std::vector<double> spacing = local_img->getSpacing(); QString suffix(" pixels"); if (spacing.size() > 1) { suffix = QString::fromUtf8(u8" \u03bcm"); } QDialog* createRectDiaglog = new QDialog(); createRectDiaglog->setWindowTitle("Specify width and height for rectangular annotations"); QVBoxLayout* dialogLayout = new QVBoxLayout(); QFormLayout* heightWidthLayout = new QFormLayout(); QHBoxLayout* buttonLayout = new QHBoxLayout(); QDoubleSpinBox* widthSpinBox = new QDoubleSpinBox(); widthSpinBox->setMinimum(1); widthSpinBox->setMaximum(100000); widthSpinBox->setValue(1000); widthSpinBox->setSingleStep(100); widthSpinBox->setSuffix(suffix); widthSpinBox->setObjectName("Width"); heightWidthLayout->addRow("Width", widthSpinBox); QDoubleSpinBox* heightSpinBox = new QDoubleSpinBox(); heightSpinBox->setMinimum(1); heightSpinBox->setMaximum(100000); heightSpinBox->setValue(1000); heightSpinBox->setSingleStep(100); heightSpinBox->setSuffix(suffix); heightSpinBox->setObjectName("Height"); heightWidthLayout->addRow("Height", heightSpinBox); dialogLayout->addLayout(heightWidthLayout); QPushButton* cancel = new QPushButton("Cancel"); QPushButton* ok = new QPushButton("Ok"); cancel->setDefault(true); connect(cancel, SIGNAL(clicked()), createRectDiaglog, SLOT(reject())); connect(ok, SIGNAL(clicked()), createRectDiaglog, SLOT(accept())); buttonLayout->addWidget(cancel); buttonLayout->addWidget(ok); dialogLayout->addLayout(buttonLayout); createRectDiaglog->setLayout(dialogLayout); int rval = createRectDiaglog->exec(); if (rval == 1) { float rectWidth = widthSpinBox->value(); float rectHeight = heightSpinBox->value(); if (spacing.size() > 1) { rectWidth /= spacing[0]; rectHeight /= spacing[1]; } QPointF scenePos = _viewer->mapToScene(event->pos()); this->addCoordinate(QPointF(scenePos.x() + (_viewer->getSceneScale() * rectWidth / 2), scenePos.y() + (_viewer->getSceneScale() * rectHeight / 2))); } else { this->cancelAnnotation(); } } }
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(); }
void MainWindow::on_actionFind_triggered() { QDialog *findDlg = new QDialog(this); findDlg->setWindowTitle(tr("查找")); find_textEditLine = new QLineEdit(findDlg); QPushButton *find_Btn = new QPushButton(tr("查找下一个"),findDlg); QVBoxLayout *layout = new QVBoxLayout(findDlg); layout->addWidget(find_textEditLine); layout->addWidget(find_Btn); findDlg->show(); connect(find_Btn,SIGNAL(clicked()),this,SLOT(show_findText())); }