本文整理汇总了C++中KButtonBox类的典型用法代码示例。如果您正苦于以下问题:C++ KButtonBox类的具体用法?C++ KButtonBox怎么用?C++ KButtonBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KButtonBox类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
CcaseCommentDlg::CcaseCommentDlg(bool bCheckin)
: QDialog(0, "", true)
{
setCaption( i18n("Clearcase Comment") );
QBoxLayout *layout = new QVBoxLayout(this, 10);
QLabel *messagelabel = new QLabel(i18n("Enter log message:"), this);
messagelabel->setMinimumSize(messagelabel->sizeHint());
layout->addWidget(messagelabel, 0);
_edit = new QMultiLineEdit(this);
QFontMetrics fm(_edit->fontMetrics());
_edit->setMinimumSize(fm.width("0")*40, fm.lineSpacing()*3);
layout->addWidget(_edit, 10);
QBoxLayout *layout2 = new QHBoxLayout(layout);
if(bCheckin) {
_check = new QCheckBox(i18n("Reserve"), this);
layout2->addWidget(_check);
}
KButtonBox *buttonbox = new KButtonBox(this);
buttonbox->addStretch();
QPushButton *ok = buttonbox->addButton(KStdGuiItem::ok());
QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
connect(ok, SIGNAL(clicked()), SLOT(accept()) );
connect(cancel, SIGNAL(clicked()), SLOT(reject()) );
ok->setDefault(true);
buttonbox->layout();
layout2->addWidget(buttonbox, 0);
layout->activate();
adjustSize();
}
示例2: QDialog
SaveScm::SaveScm( QWidget *parent, const char *name )
: QDialog( parent, name, TRUE )
{
setFocusPolicy(QWidget::StrongFocus);
setCaption( i18n("Add a color scheme"));
QBoxLayout *topLayout = new QVBoxLayout( this, 10 );
QBoxLayout *stackLayout = new QVBoxLayout( 3 );
topLayout->addLayout( stackLayout );
nameLine = new QLineEdit( this );
nameLine->setFocus();
nameLine->setMaxLength(18);
nameLine->setFixedHeight( nameLine->sizeHint().height() );
QLabel* tmpQLabel;
tmpQLabel = new QLabel( nameLine,
i18n( "&Enter a name for the new color scheme\n"\
"to be added to your personal list.\n\n"\
"The colors currently used in the preview will\n"\
"be copied into this scheme to begin with." ), this );
tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix );
tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() );
tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() );
stackLayout->addStretch( 10 );
stackLayout->addWidget( tmpQLabel );
stackLayout->addWidget( nameLine );
QFrame* tmpQFrame;
tmpQFrame = new QFrame( this );
tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
topLayout->addWidget( tmpQFrame );
KButtonBox *bbox = new KButtonBox( this );
bbox->addStretch( 10 );
QPushButton *ok = bbox->addButton( i18n( "&OK" ) );
connect( ok, SIGNAL( clicked() ), SLOT( accept() ) );
QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) );
connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
bbox->layout();
topLayout->addWidget( bbox );
topLayout->activate();
resize( 250, 0 );
}
示例3: QDialog
FieldSelect::FieldSelect(Procview *pv, Proc *proc)
: QDialog(0, "select fields"),
nbuttons(proc->cats.size()),
disp_fields(nbuttons),
procview(pv)
{
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
updating = FALSE;
setCaption("qps: select fields");
buts = new QCheckBox*[nbuttons];
QGridLayout *l1 = new QGridLayout((nbuttons + 1) / 2, 5, 0);
tl->addLayout(l1, 1);
l1->addColSpacing(2, 15);
int half = (nbuttons + 1) / 2;
for(int i = 0; i < nbuttons; i++) {
QCheckBox *but = new QCheckBox(proc->cats[i]->name, this);
QLabel *desc = new QLabel(proc->cats[i]->help, this);
but->setMinimumSize(but->sizeHint());
desc->setMinimumSize(desc->sizeHint());
if(i < half) {
l1->addWidget(but, i, 0);
l1->addWidget(desc, i, 1);
} else {
l1->addWidget(but, i-half, 3);
l1->addWidget(desc, i-half, 4);
}
buts[i] = but;
connect(but, SIGNAL(toggled(bool)), this, SLOT(field_toggled(bool)));
}
update_boxes();
KButtonBox *bbox = new KButtonBox(this);
bbox->addStretch(1);
QPushButton *closebut = bbox->addButton(i18n("Close"));
closebut->setDefault(TRUE);
closebut->setFocus();
closebut->setFixedSize(closebut->sizeHint());
bbox->layout();
tl->addWidget(bbox);
connect(closebut, SIGNAL(clicked()), SLOT(closed()));
QAccel *acc = new QAccel(this);
acc->connectItem(acc->insertItem(CTRL + Key_W),
this, SLOT(closed()));
tl->freeze();
}
示例4: KDialog
ResourceSelectDialog::ResourceSelectDialog(AddressBook *ab, QWidget *parent, const char *name) : KDialog(parent, name, true)
{
setCaption(i18n("Resource Selection"));
resize(300, 200);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(marginHint());
QGroupBox *groupBox = new QGroupBox(2, Qt::Horizontal, this);
groupBox->setTitle(i18n("Resources"));
mResourceId = new KListBox(groupBox);
mainLayout->addWidget(groupBox);
mainLayout->addSpacing(10);
KButtonBox *buttonBox = new KButtonBox(this);
buttonBox->addStretch();
buttonBox->addButton(KStdGuiItem::ok(), this, SLOT(accept()));
buttonBox->addButton(KStdGuiItem::cancel(), this, SLOT(reject()));
buttonBox->layout();
mainLayout->addWidget(buttonBox);
// setup listbox
uint counter = 0;
QPtrList< Resource > list = ab->resources();
for(uint i = 0; i < list.count(); ++i)
{
Resource *resource = list.at(i);
if(resource && !resource->readOnly())
{
mResourceMap.insert(counter, resource);
mResourceId->insertItem(resource->resourceName());
counter++;
}
}
mResourceId->setCurrentItem(0);
}
示例5: QDialog
KKeyDialog::KKeyDialog( QDict<KKeyEntry> *aKeyDict, QWidget *parent )
: QDialog( parent, 0, TRUE )
{
setCaption(i18n("Configure key bindings"));
setFocusPolicy( QWidget::StrongFocus );
QBoxLayout *topLayout = new QVBoxLayout( this, 10 );
KKeyChooser *kc = new KKeyChooser( aKeyDict, this );
topLayout->addWidget( kc, 10 );
// CREATE BUTTONS
KButtonBox *bbox = new KButtonBox( this );
bHelp = bbox->addButton( i18n("&Help") );
//connect( bHelp, SIGNAL(clicked()), SLOT(help()) );
bHelp->setEnabled( false );
bDefaults = bbox->addButton( i18n("&Defaults") );
connect( bDefaults, SIGNAL(clicked()), kc, SLOT(allDefault()) );
//bDefaults->setEnabled( false );
bbox->addStretch( 10 );
bOk = bbox->addButton( i18n("&OK") );
connect( bOk, SIGNAL(clicked()), SLOT(accept()) );
bCancel = bbox->addButton( i18n("&Cancel") );
connect( bCancel, SIGNAL(clicked()), SLOT(reject()) );
bbox->layout();
topLayout->addWidget( bbox );
topLayout->activate();
resize( 400, 350 );
}
示例6: KConfigWidget
//.........这里部分代码省略.........
bg1 = bg;
bg->setExclusive( TRUE );
QGridLayout *bgLay = new QGridLayout(bg,3,3,10,5);
bgLay->addRowSpacing(0,10);
bgLay->addRowSpacing(2,5);
bgLay->setRowStretch(0,0);
bgLay->setRowStretch(1,0);
rb_gbPolicyAccept = new QRadioButton( i18n("Accept"), bg );
rb_gbPolicyAccept->adjustSize();
rb_gbPolicyAccept->setMinimumSize(rb_gbPolicyAccept->size());
bgLay->addWidget(rb_gbPolicyAccept, 1, 0);
rb_gbPolicyAsk = new QRadioButton( i18n("Ask"), bg );
rb_gbPolicyAsk->adjustSize();
rb_gbPolicyAsk->setMinimumSize(rb_gbPolicyAsk->size());
bgLay->addWidget(rb_gbPolicyAsk, 1, 1);
rb_gbPolicyReject = new QRadioButton( i18n("Reject"), bg );
rb_gbPolicyReject->adjustSize();
rb_gbPolicyReject->setMinimumSize(rb_gbPolicyReject->size());
bgLay->addWidget(rb_gbPolicyReject, 1, 2);
bgLay->activate();
lay->addMultiCellWidget(bg,ROW_DEFAULT_ACCEPT,ROW_DEFAULT_ACCEPT+1,3,3);
}
// CREATE SPLIT LIST BOX
wList = new KSplitList( this );
wList->setMinimumHeight(80);
lay->addMultiCellWidget( wList, ROW_DEFAULT_ACCEPT+1, ROW_BOTTOM, 1, 1 );
// associated label (has to be _after_)
wListLabel = new QLabel( wList, i18n("Domain specific settings:"), this );
lay->addWidget( wListLabel, ROW_DEFAULT_ACCEPT, 1 );
wListLabel->setFixedHeight( wListLabel->sizeHint().height() );
connect( wList, SIGNAL( highlighted( int ) ), SLOT( updateDomain( int ) ) );
connect( wList, SIGNAL( selected( int ) ), SLOT( updateDomain( int ) ) );
{
QButtonGroup *bg = new QButtonGroup( i18n("Change domain accept policy"), this );
bg2 = bg;
bg->setExclusive( TRUE );
QGridLayout *bgLay = new QGridLayout(bg,6,3,10,5);
bgLay->addRowSpacing(0,10);
bgLay->addRowSpacing(2,10);
bgLay->setRowStretch(0,0);
bgLay->setRowStretch(1,0);
bgLay->setRowStretch(2,1);
bgLay->setRowStretch(3,0);
bgLay->setRowStretch(4,1);
bgLay->setRowStretch(5,0);
le_domain = new QLineEdit(bg);
le_domain->adjustSize();
le_domain->setMinimumSize(le_domain->size());
bgLay->addMultiCellWidget(le_domain,1,1,0,2);
rb_domPolicyAccept = new QRadioButton( i18n("Accept"), bg );
rb_domPolicyAccept->adjustSize();
rb_domPolicyAccept->setMinimumSize(rb_domPolicyAccept->size());
bgLay->addWidget(rb_domPolicyAccept, 3, 0);
rb_domPolicyAsk = new QRadioButton( i18n("Ask"), bg );
rb_domPolicyAsk->adjustSize();
rb_domPolicyAsk->setMinimumSize(rb_domPolicyAsk->size());
bgLay->addWidget(rb_domPolicyAsk, 3, 1);
rb_domPolicyReject = new QRadioButton( i18n("Reject"), bg );
rb_domPolicyReject->adjustSize();
rb_domPolicyReject->setMinimumSize(rb_domPolicyReject->size());
rb_domPolicyAsk->setChecked( true );
bgLay->addWidget(rb_domPolicyReject, 3, 2);
KButtonBox *bbox = new KButtonBox( bg );
bbox->addStretch( 20 );
b0 = bbox->addButton( i18n("Change") );
connect( b0, SIGNAL( clicked() ), this, SLOT( changePressed() ) );
bbox->addStretch( 10 );
b1 = bbox->addButton( i18n("Delete") );
connect( b1, SIGNAL( clicked() ), this, SLOT( deletePressed() ) );
bbox->addStretch( 20 );
bbox->layout();
bgLay->addMultiCellWidget( bbox, 5,5,0,2);
lay->addWidget(bg,ROW_CHANGE_DOMAIN,3);
}
lay->activate();
setMinimumSize(480,300);
// finally read the options
loadSettings();
}
示例7: QDialog
Zoom::Zoom( QWidget *parent, const char *name )
: QDialog( parent, name)
{
setFocusPolicy(QWidget::StrongFocus);
mag = 1;
int border = 10;
QBoxLayout *topLayout = new QVBoxLayout( this, border );
topLayout->addStretch( 10 );
//sbMag = new KSpinBox( this );
sbMag = new QComboBox (false, this);
// (2.0) make this configurable if needed -- at least don't hard code!
unsigned int i;
mags = new int [21];
for (i = 1; i <= 10; i++)
mags [i] = (int) (100*i/(10));
for (i = 1; i <= 10; i++)
mags [i+10] = (int)(100+200*i/(10));
for (i = 1; i <= 20; i++)
sbMag->insertItem( withPercent (mags[i]) );
// sbMag->adjustSize();
sbMag->setMinimumSize( sbMag->size() );
// connect ( sbMag, SIGNAL (valueIncreased()), SLOT (slotValueIncreased()) );
// connect ( sbMag, SIGNAL (valueDecreased()), SLOT (slotValueDecreased()) );
connect (sbMag, SIGNAL (activated (const char *)),
SLOT (slotZoom (const char *)) );
QLabel* tmpQLabel;
tmpQLabel = new QLabel( sbMag, i18n("&Zoom factor"), this );
tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() );
topLayout->addWidget( tmpQLabel );
topLayout->addWidget( sbMag );
QFrame* tmpQFrame;
tmpQFrame = new QFrame( this );
tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
topLayout->addWidget( tmpQFrame );
// CREATE BUTTONS
KButtonBox *bbox = new KButtonBox( this );
bbox->addStretch( 10 );
/*
okButton = bbox->addButton( i18n("&OK") );
connect( okButton, SIGNAL(clicked()), SLOT(slotOk ()) );
okButton->setEnabled (false);
apply = bbox->addButton( i18n("&Apply") );
connect( apply, SIGNAL(clicked()), SLOT(applyZoom()) );
apply->setEnabled (false);
*/
QButton *close = bbox->addButton( i18n("&Close") );
connect( close, SIGNAL(clicked()), SLOT(reject()) );
bbox->layout();
topLayout->addWidget( bbox );
topLayout->activate();
resize( 200,0 );
}
示例8: setCaption
InterfaceDlg::InterfaceDlg(QWidget *parent) :QDialog(parent,"Props", TRUE)
{
setCaption(i18n("aRts: Structureport View"));
QVBoxLayout *mainlayout = new QVBoxLayout(this);
//QHBoxLayout *contentslayout = new QHBoxLayout;
// object type
/*
mainlayout->addSpacing(5);
QLabel *objectlabel = new QLabel(this);
QFont labelfont(objectlabel->font());
labelfont.setPointSize(labelfont.pointSize()*3/2);
objectlabel->setFont(labelfont);
objectlabel->setText(QString(" ")+i18n("Object type: ")+QString(port->owner->name())+QString(" "));
objectlabel->setAlignment(AlignCenter);
min_size(objectlabel);
mainlayout->addWidget(objectlabel);
*/
// port description
/*
mainlayout->addSpacing(5);
QLabel *portlabel = new QLabel(this);
labelfont.setPointSize(labelfont.pointSize()*4/5);
portlabel->setFont(labelfont);
portlabel->setText(i18n("Port description: ")+ port->description);
min_size(portlabel);
portlabel->setAlignment(AlignCenter);
mainlayout->addWidget(portlabel);
int labelwidth = imax(portlabel->sizeHint().width(),objectlabel->sizeHint().width());
portlabel->setMinimumWidth(labelwidth);
objectlabel->setMinimumWidth(labelwidth);
// hruler
mainlayout->addSpacing(5);
KSeparator *ruler = new KSeparator( KSeparator::HLine, this);
mainlayout->addWidget(ruler);
mainlayout->addSpacing(5);
mainlayout->addLayout(contentslayout);
*/
// list
listbox = new QListBox(this);
update();
listbox->setMinimumSize(340,400);
mainlayout->addWidget(listbox);
connect( listbox, SIGNAL( doubleClicked ( QListBoxItem *)), this,
SLOT(accept()));
// hruler
mainlayout->addSpacing(5);
KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this);
mainlayout->addWidget(ruler2);
// buttons
QHBoxLayout *buttonlayout = new QHBoxLayout;
mainlayout->addSpacing(5);
mainlayout->addLayout(buttonlayout);
mainlayout->addSpacing(5);
buttonlayout->addSpacing(5);
KButtonBox *bbox = new KButtonBox(this);
bbox->addButton(KStdGuiItem::help(), this, SLOT( help() ));
bbox->addStretch(1);
QButton *okbutton = bbox->addButton(KStdGuiItem::ok());
connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) );
QButton *cancelbutton = bbox->addButton(KStdGuiItem::cancel());
connect( cancelbutton, SIGNAL( clicked() ), SLOT(reject() ) );
bbox->layout();
//min_size(bbox);
buttonlayout->addWidget(bbox);
buttonlayout->addSpacing(5);
//mainlayout->activate();
mainlayout->freeze();
}
示例9: QDialog
//.........这里部分代码省略.........
pgGroup->insert( arb, All );
grid->addWidget( arb, 1, 1 );
if ( arb->sizeHint().width() > widest )
widest = arb->sizeHint().width();
QRadioButton *rb = new QRadioButton( i18n("&Current"), group );
rb->setFixedHeight( rb->sizeHint().height()+6 );
pgGroup->insert( rb, Current );
grid->addWidget( rb, 1, 2 );
if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
rb = new QRadioButton( i18n("&Marked"), group );
rb->setFixedHeight( rb->sizeHint().height()+6 );
if ( !marked )
rb->setEnabled( false );
else
{
arb->setChecked ( false );
rb->setChecked ( true );
}
pgGroup->insert( rb, Marked );
grid->addWidget( rb, 3, 1 );
if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
rb = new QRadioButton( i18n("&Range"), group );
rb->setFixedHeight( rb->sizeHint().height()+6 );
pgGroup->insert( rb, Range );
grid->addWidget( rb, 3, 2 );
if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
leStart = new QLineEdit( group );
leStart->setFixedHeight( rb->sizeHint().height()+6 );
grid->addWidget( leStart, 3, 3 );
lTo = new QLabel( group );
lTo->setText( i18n("to") );
lTo->setAlignment( AlignCenter );
lTo->setMinimumSize( lTo->sizeHint() );
grid->addWidget( lTo, 3, 4 );
leEnd = new QLineEdit( group );
leEnd->setFixedHeight( rb->sizeHint().height()+6 );
grid->addWidget( leEnd, 3, 5 );
group->setMinimumSize( QSize( 4*widest+25, 4*(rb->sizeHint().height()+6) ) );
cbOrder = new QCheckBox( i18n("Print document in re&verse order"), this );
cbOrder->setFixedHeight( cbOrder->sizeHint().height() );
topLayout->addWidget( cbOrder );
QFrame* tmpQFrame;
tmpQFrame = new QFrame( this );
tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
topLayout->addWidget( tmpQFrame );
// CREATE BUTTONS
KButtonBox *bbox = new KButtonBox( this );
QPushButton* setup = bbox->addButton( i18n("&Setup ...") );
connect( setup, SIGNAL(clicked()), SLOT( setup()) );
bbox->addStretch( 10 );
QPushButton* ok = bbox->addButton( i18n("&OK") );
connect( ok, SIGNAL(clicked()), SLOT( checkRange() ) );
QPushButton* cancel = bbox->addButton( i18n("&Cancel") );
connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
bbox->layout();
topLayout->addWidget( bbox );
topLayout->activate();
if ( marked )
slotPageMode( Marked );
else
slotPageMode( All );
resize( 250, 0 );
}
示例10: QDialog
PPPdArguments::PPPdArguments(QWidget *parent, const char *name)
: QDialog(parent, name, TRUE)
{
setCaption(i18n("Customize pppd Arguments"));
KWM::setMiniIcon(winId(), kapp->getMiniIcon());
QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
QHBoxLayout *tl = new QHBoxLayout(10);
l->addLayout(tl);
QVBoxLayout *l1 = new QVBoxLayout();
QVBoxLayout *l2 = new QVBoxLayout();
tl->addLayout(l1, 1);
tl->addLayout(l2, 0);
QHBoxLayout *l11 = new QHBoxLayout(10);
l1->addLayout(l11);
argument_label = newLabel(i18n("Argument:"), this);
l11->addWidget(argument_label);
argument = newLineEdit(0, this);
connect(argument, SIGNAL(returnPressed()),
SLOT(addbutton()));
l11->addWidget(argument);
connect(argument, SIGNAL(textChanged(const char *)),
this, SLOT(textChanged(const char *)));
arguments = new QListBox(this);
arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
connect(arguments, SIGNAL(highlighted(int)),
this, SLOT(itemSelected(int)));
l1->addWidget(arguments, 1);
add = new QPushButton(i18n("Add"), this);
FIXED_HEIGHT(add);
MIN_WIDTH(add);
connect(add, SIGNAL(clicked()), SLOT(addbutton()));
l2->addWidget(add);
l2->addStretch(1);
remove = new QPushButton(i18n("Remove"), this);
FIXED_HEIGHT(remove);
MIN_WIDTH(remove);
connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
l2->addWidget(remove);
defaults = new QPushButton(i18n("Defaults"), this);
FIXED_HEIGHT(defaults);
MIN_WIDTH(defaults);
connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
l2->addWidget(defaults);
l->addSpacing(5);
KButtonBox *bbox = new KButtonBox(this);
bbox->addStretch(1);
closebtn = bbox->addButton(i18n("OK"));
connect(closebtn, SIGNAL(clicked()), SLOT(closebutton()));
QPushButton *cancel = bbox->addButton(i18n("Cancel"));
connect(cancel, SIGNAL(clicked()),
this, SLOT(reject()));
bbox->layout();
l->addWidget(bbox);
l->freeze();
//load info from gpppdata
init();
add->setEnabled(false);
remove->setEnabled(false);
argument->setFocus();
}
示例11: QDialog
kRockSetup::kRockSetup( QWidget *parent, const char *name )
: QDialog( parent, name, TRUE )
{
speed = 50;
number = 50;
readSettings();
setCaption( glocale->translate("Setup krock") );
QLabel *label;
QPushButton *button;
KSlider *slider;
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
QHBoxLayout *tl1 = new QHBoxLayout;
tl->addLayout(tl1);
QVBoxLayout *tl11 = new QVBoxLayout(5);
tl1->addLayout(tl11);
label = new QLabel( glocale->translate("Speed:"), this );
min_size(label);
tl11->addWidget(label);
slider = new KSlider( KSlider::Horizontal, this );
slider->setMinimumSize( 90, 20 );
slider->setRange( 0, 100 );
slider->setSteps( 25, 50 );
slider->setValue( speed );
connect( slider, SIGNAL( valueChanged( int ) ),
SLOT( slotSpeed( int ) ) );
tl11->addWidget(slider);
tl11->addSpacing(5);
label = new QLabel( glocale->translate("Number:"), this );
min_size(label);
tl11->addWidget(label);
slider = new KSlider( KSlider::Horizontal, this );
slider->setMinimumSize( 90, 20 );
slider->setRange( 20, 260 );
slider->setSteps( 20, 80 );
slider->setValue( number );
connect( slider, SIGNAL( valueChanged( int ) ),
SLOT( slotNumber( int ) ) );
tl11->addWidget(slider);
tl11->addSpacing(5);
QCheckBox *cb = new QCheckBox( glocale->translate("Move"), this );
min_size(cb);
cb->setChecked( move );
connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotMove( bool ) ) );
tl11->addWidget(cb);
cb = new QCheckBox( glocale->translate("Rotate"), this );
min_size(cb);
cb->setChecked( rotate );
connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotRotate( bool ) ) );
tl11->addWidget(cb);
tl11->addStretch(1);
preview = new QWidget( this );
preview->setFixedSize( 220, 170 );
preview->setBackgroundColor( black );
preview->show(); // otherwise saver does not get correct size
saver = new kRockSaver( preview->winId() );
tl1->addWidget(preview);
KButtonBox *bbox = new KButtonBox(this);
button = bbox->addButton( glocale->translate("About"));
connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) );
bbox->addStretch(1);
button = bbox->addButton( glocale->translate("OK"));
connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) );
button = bbox->addButton(glocale->translate("Cancel"));
connect( button, SIGNAL( clicked() ), SLOT( reject() ) );
bbox->layout();
tl->addWidget(bbox);
tl->freeze();
}
示例12: fontMetrics
void UMLOperationDialog::setupDialog() {
int margin = fontMetrics().height();
QVBoxLayout * topLayout = new QVBoxLayout( plainPage() );
m_pGenGB = new QGroupBox(i18n("General Properties"), plainPage() );
QGridLayout * genLayout = new QGridLayout(m_pGenGB, 3, 4 );
genLayout -> setColStretch(1, 1);
genLayout -> setColStretch(3, 1);
genLayout -> addColSpacing(1, 200);
genLayout -> addColSpacing(3, 200);
genLayout -> setMargin(margin);
genLayout -> setSpacing(10);
Dialog_Utils::makeLabeledEditField( m_pGenGB, genLayout, 0,
m_pNameL, i18n("&Name:"),
m_pNameLE, m_pOperation->getName() );
m_pRtypeL = new QLabel(i18n("&Type:"), m_pGenGB );
genLayout -> addWidget(m_pRtypeL, 0, 2);
m_pRtypeCB = new KComboBox(true, m_pGenGB );
genLayout -> addWidget(m_pRtypeCB, 0, 3);
m_pRtypeL->setBuddy(m_pRtypeCB);
m_pStereoTypeL = new QLabel( i18n("Stereotype name:"), m_pGenGB );
genLayout -> addWidget(m_pStereoTypeL, 1, 0);
m_pStereoTypeCB = new KComboBox(true, m_pGenGB );
genLayout -> addWidget(m_pStereoTypeCB, 1, 1);
m_pAbstractCB = new QCheckBox( i18n("&Abstract operation"), m_pGenGB );
m_pAbstractCB -> setChecked( m_pOperation->getAbstract() );
genLayout -> addWidget( m_pAbstractCB, 2, 0 );
m_pStaticCB = new QCheckBox( i18n("Classifier &scope (\"static\")"), m_pGenGB );
m_pStaticCB -> setChecked( m_pOperation->getStatic() );
genLayout -> addWidget( m_pStaticCB, 2, 1 );
m_pQueryCB = new QCheckBox( i18n("&Query (\"const\")"), m_pGenGB );
m_pQueryCB -> setChecked( m_pOperation->getConst() );
genLayout -> addWidget( m_pQueryCB, 2, 2 );
topLayout -> addWidget( m_pGenGB );
m_pScopeBG = new QButtonGroup(i18n("Visibility"), plainPage() );
QHBoxLayout * scopeLayout = new QHBoxLayout(m_pScopeBG);
scopeLayout -> setMargin(margin);
m_pPublicRB = new QRadioButton(i18n("P&ublic"), m_pScopeBG);
scopeLayout -> addWidget(m_pPublicRB);
m_pPrivateRB = new QRadioButton(i18n("P&rivate"), m_pScopeBG);
scopeLayout -> addWidget(m_pPrivateRB);
m_pProtectedRB = new QRadioButton(i18n("Prot&ected"), m_pScopeBG);
scopeLayout -> addWidget(m_pProtectedRB);
m_pImplementationRB = new QRadioButton(i18n("I&mplementation"), m_pScopeBG);
scopeLayout -> addWidget(m_pImplementationRB);
topLayout -> addWidget(m_pScopeBG);
m_pParmsGB = new QGroupBox(i18n("Parameters"), plainPage() );
QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB);
parmsLayout->setMargin(margin);
parmsLayout->setSpacing(10);
//horizontal box contains the list box and the move up/down buttons
QHBoxLayout* parmsHBoxLayout = new QHBoxLayout(parmsLayout);
m_pParmsLB = new QListBox(m_pParmsGB);
parmsHBoxLayout->addWidget(m_pParmsLB);
//the move up/down buttons (another vertical box)
QVBoxLayout* buttonLayout = new QVBoxLayout( parmsHBoxLayout );
m_pUpButton = new KArrowButton( m_pParmsGB );
m_pUpButton->setEnabled( false );
buttonLayout->addWidget( m_pUpButton );
m_pDownButton = new KArrowButton( m_pParmsGB, Qt::DownArrow );
m_pDownButton->setEnabled( false );
buttonLayout->addWidget( m_pDownButton );
KButtonBox* buttonBox = new KButtonBox(m_pParmsGB);
buttonBox->addButton( i18n("Ne&w Parameter..."), this, SLOT(slotNewParameter()) );
m_pDeleteButton = buttonBox->addButton( i18n("&Delete"), this, SLOT(slotDeleteParameter()) );
m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), this,
SLOT(slotParameterProperties()) );
parmsLayout->addWidget(buttonBox);
topLayout -> addWidget(m_pParmsGB);
m_pDeleteButton->setEnabled(false);
m_pPropertiesButton->setEnabled(false);
m_pUpButton->setEnabled(false);
m_pDownButton->setEnabled(false);
// Add "void". We use this for denoting "no return type" independent
// of the programming language.
// For example, the Ada generator would interpret the return type
// "void" as an instruction to generate a procedure instead of a
// function.
//.........这里部分代码省略.........
示例13: QDialog
kSwarmSetup::kSwarmSetup( QWidget *parent, const char *name )
: QDialog( parent, name, TRUE )
{
readSettings();
setCaption( glocale->translate("Setup KSwarm") );
QLabel *label;
QPushButton *button;
KSlider *slider;
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
QHBoxLayout *tl1 = new QHBoxLayout;
tl->addLayout(tl1);
QVBoxLayout *tl11 = new QVBoxLayout(5);
tl1->addLayout(tl11);
label = new QLabel( glocale->translate("Speed:"), this );
min_size(label);
tl11->addWidget(label);
slider = new KSlider( KSlider::Horizontal, this );
slider->setMinimumSize( 90, 20 );
slider->setRange( MINSPEED, MAXSPEED );
slider->setSteps( (MAXSPEED-MINSPEED)/4, (MAXSPEED-MINSPEED)/2 );
slider->setValue( speed );
connect( slider, SIGNAL( valueChanged( int ) ),
SLOT( slotSpeed( int ) ) );
tl11->addWidget(slider);
tl11->addSpacing(5);
label = new QLabel( glocale->translate("Number of Bees:"), this );
min_size(label);
tl11->addWidget(label);
slider = new KSlider( KSlider::Horizontal, this );
slider->setMinimumSize( 90, 20 );
slider->setRange( MINBATCH, MAXBATCH );
slider->setSteps( (MAXBATCH-MINBATCH)/4, (MAXBATCH-MINBATCH)/2 );
slider->setValue( maxLevels );
connect( slider, SIGNAL( valueChanged( int ) ),
SLOT( slotLevels( int ) ) );
tl11->addWidget(slider);
tl11->addStretch(1);
preview = new QWidget( this );
preview->setFixedSize( 220, 170 );
preview->setBackgroundColor( black );
preview->show(); // otherwise saver does not get correct size
saver = new kSwarmSaver( preview->winId() );
tl1->addWidget(preview);
KButtonBox *bbox = new KButtonBox(this);
button = bbox->addButton( glocale->translate("About"));
connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) );
bbox->addStretch(1);
button = bbox->addButton( glocale->translate("OK"));
connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) );
button = bbox->addButton(glocale->translate("Cancel"));
connect( button, SIGNAL( clicked() ), SLOT( reject() ) );
bbox->layout();
tl->addWidget(bbox);
tl->freeze();
}
示例14: KDialog
ChooseBusDlg::ChooseBusDlg(QWidget *parent)
: KDialog(parent,"X", TRUE)
, _newbusitemindex( -1 )
{
setCaption(i18n("Choose Bus"));
QVBoxLayout *mainlayout = new QVBoxLayout(this);
// caption label: "Synthesis running..."
mainlayout->addSpacing(5);
QLabel *captionlabel = new QLabel(this);
QFont labelfont(captionlabel->font());
labelfont.setPointSize(labelfont.pointSize()*3/2);
captionlabel->setFont(labelfont);
captionlabel->setText(QString(" ")+i18n("Available busses:")+QString(" "));
captionlabel->setAlignment(AlignCenter);
min_size(captionlabel);
mainlayout->addWidget(captionlabel);
// hruler
mainlayout->addSpacing(5);
KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this);
mainlayout->addWidget(ruler2);
mainlayout->addSpacing(5);
// listwidget
listbox = new QListBox(this);
listbox->setMinimumSize(300,200);
Arts::AudioManager aman = Arts::Reference("global:Arts_AudioManager");
if(!aman.isNull())
{
vector<string> *destinations = aman.destinations();
unsigned long i;
for(i=0;i<destinations->size();i++)
listbox->insertItem((*destinations)[i].c_str());
delete destinations;
}
if( listbox->count() > 0 )
listbox->setCurrentItem( 0 );
mainlayout->addWidget(listbox);
// hruler
mainlayout->addSpacing(5);
KSeparator *ruler = new KSeparator( KSeparator::HLine, this);
mainlayout->addWidget(ruler);
mainlayout->addSpacing(5);
// new bus lineedit
QBoxLayout * layout2 = new QHBoxLayout( mainlayout );
//mainlayout->addLayout( layout2 );
QLabel * newbuslabel = new QLabel( i18n( "New bus:" ), this );
layout2->addWidget( newbuslabel );
lineedit = new KLineEdit( this );
connect( lineedit, SIGNAL( textChanged( const QString & ) ), SLOT( textChanged( const QString & ) ) );
layout2->addWidget( lineedit );
// hruler
mainlayout->addSpacing(5);
KSeparator *ruler3 = new KSeparator( KSeparator::HLine, this);
mainlayout->addWidget(ruler3);
mainlayout->addSpacing(5);
// buttons
mainlayout->addSpacing(5);
QHBoxLayout *buttonlayout = new QHBoxLayout( mainlayout );
//mainlayout->addLayout(buttonlayout);
mainlayout->addSpacing(5);
buttonlayout->addSpacing(5);
KButtonBox *bbox = new KButtonBox(this);
bbox->addButton(KStdGuiItem::help(), this, SLOT( help() ));
bbox->addStretch(1);
QPushButton * okbutton = bbox->addButton(KStdGuiItem::ok());
okbutton->setDefault( true );
connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) );
QButton *cancelbutton = bbox->addButton(KStdGuiItem::cancel());
connect( cancelbutton, SIGNAL( clicked() ), SLOT(reject() ) );
bbox->layout();
buttonlayout->addWidget(bbox);
buttonlayout->addSpacing(5);
mainlayout->freeze();
//.........这里部分代码省略.........