本文整理汇总了C++中QDialogButtonBox::setFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::setFocus方法的具体用法?C++ QDialogButtonBox::setFocus怎么用?C++ QDialogButtonBox::setFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::setFocus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
/*
* Path is not saved in linux without installer - added workspace to properties dialog.
*/
NewProject::NewProject(QWidget *parent) : QDialog(parent)
{
mypath = getCurrentPath();
path = new QLineEdit(mypath,this);
path->setToolTip(tr("Directory for new project."));
QPushButton *btnBrowsePath = new QPushButton(this);
btnBrowsePath->setText(tr("Browse"));
name = new QLineEdit(this);
name->setToolTip(tr("New project name and sub-directory."));
connect(name,SIGNAL(textChanged(QString)),this,SLOT(nameChanged()));
path->setText(mypath+name->text());
QLabel *pathLabel = new QLabel(tr("Workspace"));
QLabel *nameLabel = new QLabel(tr("Project Name"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(btnBrowsePath, SIGNAL(clicked()), this, SLOT(browsePath()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
okButton = (QPushButton*) buttonBox->buttons().at(0);
cancelButton = (QPushButton*) buttonBox->buttons().at(1);
if(okButton->text().contains("cancel",Qt::CaseInsensitive)) {
okButton = (QPushButton*) buttonBox->buttons().at(1);
cancelButton = (QPushButton*) buttonBox->buttons().at(1);
}
QLabel *create = new QLabel(this);
create->setText(tr("Creating a new project:"));
create->setFont(QFont(this->font().family(),this->font().pointSize()*1.5,QFont::Bold));
QLabel *inst = new QLabel(this);
inst->setText(tr(" 1) Choose project workspace.\n 2) Set project name.\n\n" \
"A project folder with project name will be created in the workspace.\n" \
"The new folder will have a main .c file and a .side project file.\n"));
QVBoxLayout *blay = new QVBoxLayout(this);
QGridLayout *layout = new QGridLayout();
layout->addWidget(path,0,1,1,1); // tab order for widgets is according to add order
layout->addWidget(name,1,1,1,1);
layout->addWidget(btnBrowsePath,0,2,1,1);
layout->addWidget(nameLabel,1,0,1,1);
layout->addWidget(pathLabel,0,0,1,1);
blay->addWidget(create);
blay->addWidget(inst);
blay->addLayout(layout);
blay->addWidget(new QLabel(this));
blay->addWidget(buttonBox);
setLayout(blay);
buttonBox->setFocus();
int fontSize = path->fontInfo().pixelSize();
setMinimumWidth(mypath.length()*fontSize+100);
setWindowFlags(Qt::Tool);
}
示例2: buildPrivDialog
void FirstRun::buildPrivDialog()
{
setWindowTitle( qtr( "Privacy and Network Access Policy" ) );
setWindowRole( "vlc-privacy" );
setWindowModality( Qt::ApplicationModal );
setWindowFlags( Qt::Dialog );
setAttribute( Qt::WA_DeleteOnClose );
QGridLayout *gLayout = new QGridLayout( this );
QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Access Policy" ) );
QGridLayout *blablaLayout = new QGridLayout( blabla );
QLabel *text = new QLabel( qtr(
"<p>In order to protect your privacy, <i>VLC media player</i> "
"does <b>not</b> collect personal data or transmit them, "
"not even in anonymized form, to anyone."
"</p>\n"
"<p>Nevertheless, <i>VLC</i> is able to automatically retrieve "
"information about the media in your playlist from third party "
"Internet-based services. This includes cover art, track names, "
"artist names and other meta-data."
"</p>\n"
"<p>Consequently, this may entail identifying some of your media files to third party "
"entities. Therefore the <i>VLC</i> developers require your express "
"consent for the media player to access the Internet automatically."
"</p>\n"
) );
text->setWordWrap( true );
text->setTextFormat( Qt::RichText );
blablaLayout->addWidget( text, 0, 0 ) ;
QGroupBox *options = new QGroupBox( qtr( "Network Access Policy" ) );
QGridLayout *optionsLayout = new QGridLayout( options );
gLayout->addWidget( blabla, 0, 0, 1, 3 );
gLayout->addWidget( options, 1, 0, 1, 3 );
int line = 0;
checkbox = new QCheckBox( qtr( "Automatically retrieve media info" ) );
checkbox->setChecked( true );
optionsLayout->addWidget( checkbox, line++, 0 );
#ifdef UPDATE_CHECK
checkbox2 = new QCheckBox( qtr( "Regularly check for VLC updates" ) );
checkbox2->setChecked( true );
optionsLayout->addWidget( checkbox2, line++, 0 );
#endif
QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
buttonsBox->addButton( qtr( "Continue" ), QDialogButtonBox::AcceptRole );
gLayout->addWidget( buttonsBox, 2, 0, 2, 3 );
CONNECT( buttonsBox, accepted(), this, save() );
buttonsBox->setFocus();
}
示例3: buildPrivDialog
void FirstRun::buildPrivDialog()
{
setWindowTitle( qtr( "Privacy and Network Access Policy" ) );
setWindowRole( "vlc-privacy" );
setWindowModality( Qt::ApplicationModal );
setWindowFlags( Qt::Dialog );
setAttribute( Qt::WA_DeleteOnClose );
QGridLayout *gLayout = new QGridLayout( this );
QGroupBox *blabla = new QGroupBox( qtr( "Privacy and Network Access Policy" ) );
QGridLayout *blablaLayout = new QGridLayout( blabla );
QLabel *text = new QLabel( qtr(
"<p><i>VLC media player</i> does <b>not</b> send or collect any "
"information, even anonymously, about your usage.</p>\n"
"<p>However, it can connect to the Internet "
"in order to display <b>medias information</b> "
#ifdef UPDATE_CHECK
"or to check for available <b>updates</b>"
#endif
".</p>\n"
"<p><i>VideoLAN</i> (the authors) requires you to express your consent "
"before allowing this software to access the Internet.</p>\n"
"<p>According to your choices, please check or uncheck the following options:</p>\n"
) );
text->setWordWrap( true );
text->setTextFormat( Qt::RichText );
blablaLayout->addWidget( text, 0, 0 ) ;
QGroupBox *options = new QGroupBox( qtr( "Network Access Policy" ) );
QGridLayout *optionsLayout = new QGridLayout( options );
gLayout->addWidget( blabla, 0, 0, 1, 3 );
gLayout->addWidget( options, 1, 0, 1, 3 );
int line = 0;
checkbox = new QCheckBox( qtr( "Allow downloading media information" ) );
checkbox->setChecked( true );
optionsLayout->addWidget( checkbox, line++, 0 );
#ifdef UPDATE_CHECK
checkbox2 = new QCheckBox( qtr( "Allow checking for VLC updates" ) );
checkbox2->setChecked( true );
optionsLayout->addWidget( checkbox2, line++, 0 );
#endif
QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
buttonsBox->addButton( qtr( "Save and Continue" ), QDialogButtonBox::AcceptRole );
gLayout->addWidget( buttonsBox, 2, 0, 2, 3 );
CONNECT( buttonsBox, accepted(), this, save() );
buttonsBox->setFocus();
}
示例4: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
QLabel *pixmapLabel = new QLabel;
pixmapLabel->setPixmap(QPixmap(":/icons/qtikz-128.png"));
QLabel *label = new QLabel(QString("<h1>%1 %2</h1><p>%3</p><p>%4</p>")
.arg(KtikzApplication::applicationName())
.arg(QCoreApplication::applicationVersion())
.arg(tr("Copyright 2007-2011 Florian Hackenberger and Glad Deschrijver"))
.arg(tr("This is a program for creating TikZ (from the LaTeX pgf package) diagrams.")));
label->setWordWrap(true);
QWidget *topWidget = new QWidget;
QHBoxLayout *topLayout = new QHBoxLayout;
topLayout->addWidget(pixmapLabel);
topLayout->addWidget(label);
topWidget->setLayout(topLayout);
QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free "
"software; you can redistribute it and/or modify it under the "
"terms of the GNU General Public License as published by the "
"Free Software Foundation; either version 2 of the License, "
"or (at your option) any later version.</p>"
"<p>This program is distributed in the hope that it will "
"be useful, but WITHOUT ANY WARRANTY; without even the implied "
"warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
"See the GNU General Public License for more details.</p>"));
textEdit->setReadOnly(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(topWidget);
mainLayout->addWidget(textEdit);
mainLayout->addWidget(buttonBox);
mainLayout->setSpacing(10);
buttonBox->setFocus();
setWindowTitle(tr("About %1").arg(KtikzApplication::applicationName()));
}
示例5: QPushButton
HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Help" ) );
setWindowRole( "vlc-help" );
setMinimumSize( 350, 300 );
QVBoxLayout *layout = new QVBoxLayout( this );
QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) );
QDialogButtonBox *closeButtonBox = new QDialogButtonBox( this );
closeButtonBox->addButton(
new QPushButton( qtr("&Close") ), QDialogButtonBox::RejectRole );
closeButtonBox->setFocus();
layout->addWidget( helpBrowser );
layout->addWidget( closeButtonBox );
CONNECT( closeButtonBox, rejected(), this, close() );
restoreWidgetPosition( "Help", QSize( 500, 450 ) );
}