本文整理汇总了C++中QDialog::setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setWindowTitle方法的具体用法?C++ QDialog::setWindowTitle怎么用?C++ QDialog::setWindowTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setWindowTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectDate
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 ) );
}
}
示例2: showDialog
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());
}
示例3: 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() );
}
}
示例4: open_volume_dialog
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();
}
示例5: testClicked
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;
}
示例6: fatalMessageReceived
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);
}
示例7: QDialog
/************
*
*功能:重新启动操作
*
*
*
**/
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");
}
}
示例8: main
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();
}
示例9: slotMenuAboutNews
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();
}
示例10: QString
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;
}
示例11: handleUploadFinished
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();
}
示例12: on_btSetTime_clicked
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();
}
}
}
示例13: showabout
void showabout()
{
QDialog vedit;
vedit.setWindowTitle(QObject::tr("About vedit"));
vedit.contentsRect();
vedit.resize(300, 150);
vedit.exec();
}
示例14: QString
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;
}
示例15: authentication
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: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
QCheckBox* save = new QCheckBox(dialog);
save->setText(tr("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());
}
}