本文整理汇总了C++中QDialog::setCaption方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialog::setCaption方法的具体用法?C++ QDialog::setCaption怎么用?C++ QDialog::setCaption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialog
的用法示例。
在下文中一共展示了QDialog::setCaption方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTab
int DevicesWidget::doTab(){
QDialog *dlg = new QDialog( 0, "newDevice", true, Qt::WStyle_ContextHelp );
QVBoxLayout *layout = new QVBoxLayout( dlg );
layout->setSpacing( 0 );
layout->setMargin( 1 );
QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" );
layout->addWidget( tabWindow );
bool isnew;
if(_pppdata->devname().isEmpty()) {
dlg->setCaption(tr("New Device"));
isnew = true;
} else {
QString tit = tr("Edit Device: ");
tit += _pppdata->devname();
dlg->setCaption(tit);
isnew = false;
}
modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" );
tabWindow->addTab( modem1, tr("&Device") );
modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" );
tabWindow->addTab( modem2, tr("&Modem") );
connect(modem2, SIGNAL(sig_beforeQueryModem()),
modem1, SLOT(slotBeforeModemQuery()));
connect(modem2, SIGNAL(sig_afterQueryModem()),
modem1, SLOT(slotAfterModemQuery()));
int result = 0;
bool ok = false;
while (!ok){
result = QPEApplication::execDialog( dlg );
ok = true;
if(result == QDialog::Accepted) {
if (!modem1->save()){
QMessageBox::critical(this, tr("Error"), tr( "You must enter a unique device name"));
ok = false;
}else{
modem2->save();
}
}
}
delete dlg;
return result;
}
示例2: slotAddDlgClosed
void ButtonSettings::slotAddDlgClosed( int key )
{
if( key > 0 ) {
odebug << "**** Add button " << ODevice::keyToString( key ) << oendl;
delete m_addWidget;
m_addWidget = 0;
buttoninfo *bi = buttonInfoForKeycode( key );
if( bi ) {
QMessageBox::warning ( this, tr( "Already bound" ), tr( "The pressed button is already in the list." ));
return;
}
// Get a name for the key
QDialog *dlg = new QDialog( this, 0, true );
QVBoxLayout *lay = new QVBoxLayout( dlg );
QLabel *l = new QLabel( tr("Please enter a name for this button"), dlg );
lay->addWidget(l);
QLineEdit *le = new QLineEdit( dlg );
lay->addWidget(le);
lay->addStretch(1);
dlg->setGeometry( qApp->desktop()->width() / 8, (qApp->desktop()->height() / 2) - 25,
3 * (qApp->desktop()->width() / 4), 50 );
dlg->setCaption( tr( "Button name" ) );
dlg->show();
if( dlg->exec() == QDialog::Accepted ) {
ODevice::inst()->registerCustomButton( key, le->text(), "" );
addButtonItem( ODevice::inst()->buttons().last() );
updateLabels();
m_customChanged = true;
}
}
}
示例3: addAccountDescription
void NewAccount::addAccountDescription ()
{
// Function for adding or editing an account description.
QDialog *description = new QDialog ( this, "description", TRUE );
description->setCaption ( "Notes" );
QMultiLineEdit *enter = new QMultiLineEdit ( description );
enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) );
enter->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) );
enter->setWordWrap ( QMultiLineEdit::WidgetWidth );
if ( accountdescription != "(NULL)" )
enter->setText ( accountdescription );
if ( description->exec () == QDialog::Accepted )
accountdescription = enter->text ();
}
示例4: getName
QString OHighscore::getName()
{
QString name;
QDialog *d = new QDialog ( this, 0, true );
d->setCaption( tr( "Enter your name!" ));
QLineEdit *ed = new QLineEdit ( d );
( new QVBoxLayout ( d, 3, 3 ))->addWidget ( ed );
ed->setFocus ( );
if ( d->exec() == QDialog::Accepted ) {
name = ed->text();
}
//delete d;
return name;
}
示例5: showPropertiesDialog
void KasTaskItem::showPropertiesDialog()
{
//
// Create Dialog
//
QDialog *dlg = new QDialog( /*kasbar()*/0L, "task_props", false );
//
// Title
//
KPopupTitle *title = new KPopupTitle( dlg, "title" );
dlg->setCaption( i18n("Task Properties") );
title->setText( i18n("Task Properties") );
title->setIcon( icon() );
//
// Tabbed View
//
QTabWidget *tabs = new QTabWidget( dlg );
tabs->addTab( createX11Props( tabs ), i18n("General") );
tabs->addTab( createTaskProps( task_, tabs ), i18n("Task") );
tabs->addTab( createTaskProps( this, tabs ), i18n("Item") );
tabs->addTab( createTaskProps( kasbar(), tabs, false ), i18n("Bar") );
#if 0
tabs->addTab( createNETProps( tabs ), i18n("NET") );
#endif
//
// Layout Dialog
//
QVBoxLayout *vbl = new QVBoxLayout( dlg, KDialog::marginHint(), KDialog::spacingHint() );
vbl->addWidget( title );
vbl->addWidget( tabs );
dlg->resize( 470, 500 );
dlg->show();
}
示例6: tr
//.........这里部分代码省略.........
transOut.setPostDate(date);
transOut.setPostTime(time);
transOut.setMemo(tr("Deposit to safe"));
transOut.setStoreId(store_id);
transOut.setStationId(station_id);
transOut.setEmployeeId(employee_id);
transOut.setShiftId(shift_id);
transOut.setAccountId(transfer_id);
// Memo for transfer in depends on method
QString memo;
if (station_id != INVALID_ID) {
Station station;
_quasar->db()->lookup(station_id, station);
memo = tr("Deposit from: %1").arg(station.name());
} else {
Employee employee;
_quasar->db()->lookup(employee_id, employee);
memo = tr("Deposit from: %1").arg(employee.nameFL());
}
// Prepare transfer in transaction
TenderAdjust transIn;
transIn.setPostDate(date);
transIn.setPostTime(time);
transIn.setMemo(memo);
transIn.setStoreId(safe_store_id);
transIn.setStationId(safe_station_id);
transIn.setEmployeeId(safe_employee_id);
transIn.setAccountId(transfer_id);
// Setup screen
QDialog* dialog = new QDialog(this, "Summary", true);
dialog->setCaption(tr("Reconcile Summary"));
ListView* tenderList = new ListView(dialog);
tenderList->addTextColumn(tr("Tender"), 20);
tenderList->addMoneyColumn(tr("Shifts"));
tenderList->addMoneyColumn(tr("Counts"));
tenderList->addMoneyColumn(tr("Over/Short"));
tenderList->setAllColumnsShowFocus(true);
tenderList->setSorting(-1);
QFrame* buttons = new QFrame(dialog);
QPushButton* post = new QPushButton(tr("Reconcile"), buttons);
QPushButton* cancel = new QPushButton(tr("Cancel"), buttons);
cancel->setDefault(true);
connect(post, SIGNAL(clicked()), dialog, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), dialog, SLOT(reject()));
QGridLayout* buttonGrid = new QGridLayout(buttons);
buttonGrid->setSpacing(3);
buttonGrid->setMargin(3);
buttonGrid->setColStretch(0, 1);
buttonGrid->addWidget(post, 0, 1);
buttonGrid->addWidget(cancel, 0, 2);
QGridLayout* grid = new QGridLayout(dialog);
grid->setSpacing(3);
grid->setMargin(3);
grid->setRowStretch(0, 1);
grid->setColStretch(0, 1);
grid->addWidget(tenderList, 0, 0);
grid->addWidget(buttons, 1, 0);
示例7: slotButtReplace
// -----------------------------------------------------------------------
// Is called if the "Replace"-button is pressed.
void ChangeDialog::slotButtReplace()
{
Expr.setWildcard(true); // switch into wildcard mode
Expr.setPattern(CompNameEdit->text());
if(!Expr.isValid()) {
QMessageBox::critical(this, tr("Error"),
tr("Regular expression for component name is invalid."));
return;
}
// create dialog showing all found components
QDialog *Dia = new QDialog(this);
Dia->setCaption(tr("Found Components"));
QVBoxLayout *Dia_All = new QVBoxLayout(Dia);
Dia_All->setSpacing(3);
Dia_All->setMargin(5);
QScrollArea *Dia_Scroll = new QScrollArea(Dia);
//Dia_Scroll->setMargin(5);
Dia_All->addWidget(Dia_Scroll);
QVBoxLayout *Dia_Box = new QVBoxLayout(Dia_Scroll->viewport());
Dia_Scroll->insertChild(Dia_Box);
QLabel *Dia_Label = new QLabel(tr("Change properties of\n")
+ tr("these components ?"), Dia);
Dia_All->addWidget(Dia_Label);
QHBoxLayout *Dia_h = new QHBoxLayout(Dia);
Dia_h->setSpacing(5);
QPushButton *YesButton = new QPushButton(tr("Yes"));
QPushButton *CancelButton = new QPushButton(tr("Cancel"));
Dia_h->addWidget(YesButton);
Dia_h->addWidget(CancelButton);
connect(YesButton, SIGNAL(clicked()), Dia, SLOT(accept()));
connect(CancelButton, SIGNAL(clicked()), Dia, SLOT(reject()));
Dia_All->addLayout(Dia_h);
QList<QCheckBox *> pList;
QCheckBox *pb;
Component *pc;
QStringList List;
QString str;
int i1, i2;
// search through all components
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
if(matches(pc->Model)) {
if(Expr.search(pc->Name) >= 0)
for(Property *pp = pc->Props.first(); pp!=0; pp = pc->Props.next())
if(pp->Name == PropNameEdit->currentText()) {
pb = new QCheckBox(pc->Name);
Dia_Box->addWidget(pb);
pList.append(pb);
pb->setChecked(true);
i1 = pp->Description.find('[');
if(i1 < 0) break; // no multiple-choice property
i2 = pp->Description.findRev(']');
if(i2-i1 < 2) break;
str = pp->Description.mid(i1+1, i2-i1-1);
str.replace( QRegExp("[^a-zA-Z0-9_,]"), "" );
List = List.split(',',str);
if(List.findIndex(NewValueEdit->text()) >= 0)
break; // property value is okay
pb->setChecked(false);
pb->setEnabled(false);
break;
}
}
}
/*
QColor theColor;
if(pList.isEmpty()) {
YesButton->setEnabled(false);
theColor =
(new QLabel(tr("No match found!"), Dia_Box))->paletteBackgroundColor();
}
else theColor = pList.current()->paletteBackgroundColor();
*/
//Dia_Scroll->viewport()->setPaletteBackgroundColor(theColor);
Dia->resize(50, 300);
// show user all components found
int Result = Dia->exec();
if(Result != QDialog::Accepted) return;
bool changed = false;
// change property values
QListIterator<QCheckBox *> i(pList);
while(i.hasNext()){
pb = i.next();
if(!pb->isChecked()) continue;
for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
//.........这里部分代码省略.........
示例8: QDialog
void
ItemTransfer::slotSearch()
{
QDialog* dialog = new QDialog(this, "Search", true);
dialog->setCaption(tr("Item Search"));
QLabel* numberLabel = new QLabel(tr("Item Number:"), dialog);
LineEdit* numberWidget = new LineEdit(dialog);
QLabel* descLabel = new QLabel(tr("Description:"), dialog);
LineEdit* descWidget = new LineEdit(dialog);
QCheckBox* startOver = new QCheckBox(tr("Start search at top?"), dialog);
QFrame* buttons = new QFrame(dialog);
QPushButton* next = new QPushButton(tr("&Next"), buttons);
QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons);
next->setDefault(true);
QGridLayout* buttonGrid = new QGridLayout(buttons);
buttonGrid->setMargin(6);
buttonGrid->setSpacing(10);
buttonGrid->addWidget(next, 0, 1);
buttonGrid->addWidget(cancel, 0, 2);
QGridLayout* grid = new QGridLayout(dialog);
grid->setMargin(6);
grid->setSpacing(10);
grid->addWidget(numberLabel, 0, 0);
grid->addWidget(numberWidget, 0, 1, AlignLeft | AlignVCenter);
grid->addWidget(descLabel, 1, 0);
grid->addWidget(descWidget, 1, 1, AlignLeft | AlignVCenter);
grid->addMultiCellWidget(startOver, 2, 2, 0, 1, AlignLeft | AlignVCenter);
grid->addMultiCellWidget(buttons, 3, 3, 0, 1);
connect(next, SIGNAL(clicked()), dialog, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), dialog, SLOT(reject()));
_items->setFocus();
startOver->setChecked(true);
while (true) {
if (dialog->exec() != QDialog::Accepted)
break;
QString number = numberWidget->text();
QString desc = descWidget->text();
if (number.isEmpty() && desc.isEmpty()) {
QString message = tr("No search criteria given");
QMessageBox::critical(this, tr("Error"), message);
continue;
}
int startRow = -1;
if (!startOver->isChecked())
startRow = _items->currentRow();
int foundRow = -1;
for (int row = startRow + 1; row < _items->rows(); ++row) {
QString rowNumber = _items->cellValue(row, 0).toPlu().number();
QString rowDesc = _items->cellValue(row, 1).toString();
if (!number.isEmpty() && rowNumber.contains(number, false)) {
foundRow = row;
break;
}
if (!desc.isEmpty() && rowDesc.contains(desc, false)) {
foundRow = row;
break;
}
}
if (foundRow == -1 && startOver->isChecked()) {
QString message = tr("No matches found");
QMessageBox::critical(this, tr("Error"), message);
} else if (foundRow == -1 && !startOver->isChecked()) {
QString message = tr("No further matches found");
int choice = QMessageBox::critical(this, tr("Error"), message,
tr("Start Over"), tr("Cancel"));
if (choice != 0) break;
_items->setCurrentCell(0, 0);
startOver->setChecked(true);
} else {
_items->setCurrentCell(foundRow, 0);
startOver->setChecked(false);
}
}
delete dialog;
}