本文整理汇总了C++中QBoxLayout::activate方法的典型用法代码示例。如果您正苦于以下问题:C++ QBoxLayout::activate方法的具体用法?C++ QBoxLayout::activate怎么用?C++ QBoxLayout::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout::activate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFrame
void kdvi::makeToolBar2(QWidget *parent)
{
QPixmap pm;
toolBar2 = new QFrame( parent );
QBoxLayout * gl = new QBoxLayout( toolBar2, QBoxLayout::Down );
sbox = new ScrollBox( toolBar2 );
connect( sbox, SIGNAL(valueChanged(QPoint)),
dviwin, SLOT(scroll(QPoint)) );
connect( sbox, SIGNAL(button3Pressed()), dviwin, SLOT(nextPage()) );
connect( sbox, SIGNAL(button2Pressed()), dviwin, SLOT(prevPage()) );
connect( dviwin, SIGNAL(pageSizeChanged( QSize )),
sbox, SLOT(setPageSize( QSize )) );
connect( dviwin, SIGNAL(viewSizeChanged( QSize )),
sbox, SLOT(setViewSize( QSize )) );
connect( dviwin, SIGNAL(currentPosChanged( QPoint )),
sbox, SLOT(setViewPos( QPoint )) );
QToolTip::add( sbox, 0, tipgroup, i18n("Scroll window and switch the page") );
sbox->setFixedSize(70,80);
gl->addWidget( sbox );
// Create a MarkList
marklist = new MarkList( toolBar2 );
connect( marklist, SIGNAL(selected(const char *)),
SLOT(pageActivated(const char *)) );
QToolTip::add( marklist, 0, tipgroup, i18n("Select page and mark pages for printing") );
gl->addWidget( marklist );
gl->activate();
sbox->setPageSize( dviwin->pageSize() );
}
示例2: AboutInherited
//-----------------------------------------------------------------------------
About::About (QWidget * aParent, const char *aName, bool aInit)
: AboutInherited(aParent, aName)
{
QBoxLayout* box;
QLabel* lbl;
QFrame* frm;
QString str;
QFont fnt;
if (aInit) return;
box = new QVBoxLayout(this, 20, 6);
lblTheme = new QLabel(" ", this);
fnt = lblTheme->font();
fnt.setPointSize(fnt.pointSize() * 1.2);
lblTheme->setFont(fnt);
lblTheme->setMinimumSize(lblTheme->sizeHint());
lblTheme->setAutoResize(true);
box->addWidget(lblTheme);
lblVersion = new QLabel(" ", this);
lblVersion->setMinimumSize(lblVersion->sizeHint());
lblVersion->setAutoResize(true);
box->addWidget(lblVersion);
lblAuthor = new QLabel(" ", this);
lblAuthor->setMinimumSize(lblAuthor->sizeHint());
lblAuthor->setAutoResize(true);
box->addWidget(lblAuthor);
lblHomepage = new QLabel(" ", this);
lblHomepage->setMinimumSize(lblHomepage->sizeHint());
lblHomepage->setAutoResize(true);
box->addWidget(lblHomepage);
frm = new QFrame(this);
frm->setFrameStyle(QFrame::HLine|QFrame::Raised);
box->addSpacing(5);
box->addWidget(frm);
box->addSpacing(5);
lbl = new QLabel(i18n("KDE Theme Manager"), this);
lbl->setFont(fnt);
lbl->setMinimumSize(lbl->sizeHint());
box->addWidget(lbl);
str.sprintf(i18n("Version %s\n\n"
"Copyright (C) 1998 by\n%s\n\n"
"Gnu Public License (GPL)"),
KTHEME_VERSION,
"Stefan Taferner <[email protected]>\n"
"Waldo Bastian <[email protected]>");
lbl = new QLabel(str, this);
lbl->setMinimumSize(lbl->sizeHint());
box->addWidget(lbl);
box->addStretch(1000);
box->activate();
}
示例3: fm
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();
}
示例4: activate
bool QBoxLayoutProto::activate()
{
QBoxLayout *item = qscriptvalue_cast<QBoxLayout*>(thisObject());
if (item)
return item->activate();
return false;
}
示例5: QFrame
MainWidget::MainWidget( QWidget* parent, const char* name )
: QFrame( parent, name )
{
QBoxLayout *grid = new QHBoxLayout( this, 5 ); //(rows,col)
bPainter = new BallPainter();
lsb = new LinesBoard(bPainter, this);
grid->addWidget( lsb );
QBoxLayout *right = new QVBoxLayout(grid, 2);
QLabel *label = new QLabel(i18n("Next balls:"), this);
lPrompt = new LinesPrompt(bPainter, this);
connect(lPrompt, SIGNAL(PromptPressed()), parent, SLOT(switchPrompt()));
right->addWidget( label, 0, Qt::AlignBottom | Qt::AlignHCenter );
right->addWidget( lPrompt, 0, Qt::AlignTop | Qt::AlignHCenter );
grid->activate();
grid->freeze(0,0);
// warning("width: %i height: %i", width(), height() );
// warning("wh: %i hh: %i", sizeHint().width(), sizeHint().height() );
}
示例6: 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 );
}
示例7: QFrame
Frame::Frame(QWidget* parent, const char* name): QFrame(parent, name){
button1 = new QPushButton("Simple Popup", this);
connect ( button1, SIGNAL( clicked() ), SLOT( button1Clicked() ) );
button2 = new QPushButton("Fancy Popup", this);
connect ( button2, SIGNAL( pressed() ), SLOT( button2Pressed() ) );
QBoxLayout * l = new QHBoxLayout( this );
button1->setMaximumSize(button1->sizeHint());
button2->setMaximumSize(button2->sizeHint());
l->addWidget( button1 );
l->addWidget( button2 );
l->activate();
// button1->setGeometry(20,20,100,30);
// button2->setGeometry(140,20,100,30);
resize(270, 70);
//create a very simple popup: it is just composed with other
//widget and will be shown after clicking on button1
popup1 = new QFrame( this ,0, WType_Popup);
popup1->setFrameStyle( WinPanel|Raised );
popup1->resize(150,100);
QLineEdit *tmpE = new QLineEdit( popup1 );
connect( tmpE, SIGNAL( returnPressed() ), popup1, SLOT( hide() ) );
tmpE->setGeometry(10,10, 130, 30);
tmpE->setFocus();
QPushButton *tmpB = new QPushButton("Click me!", popup1);
connect( tmpB, SIGNAL( clicked() ), popup1, SLOT( close() ) );
tmpB->setGeometry(10, 50, 130, 30);
// the fancier version uses its own class. It will be shown when
// pressing button2, so they behavior is more like a modern menu
// or toolbar.
popup2 = new FancyPopup( this );
// you might also add new widgets to the popup, just like you do
// it with any other widget. The next four lines (if not
// commented out) will for instance add a line edit widget.
// tmpE = new QLineEdit( popup2 );
// tmpE->setFocus();
// connect( tmpE, SIGNAL( returnPressed() ), popup2, SLOT( close() ) );
// tmpE->setGeometry(10, 10, 130, 30);
}
示例8: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget *toplevel = new QWidget();
QBoxLayout *mainbox = new QBoxLayout(toplevel, QBoxLayout::TopToBottom, 10);
KSeparator *sep1 = new KSeparator( KSeparator::VLine, toplevel );
mainbox->addWidget(sep1);
KSeparator *sep2 = new KSeparator( KSeparator::HLine, toplevel );
mainbox->addWidget(sep2);
mainbox->activate();
app.setMainWidget(toplevel);
toplevel->show();
return app.exec();
}
示例9: 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 );
}
示例10: setupPage
void KDMSessionsWidget::setupPage(QWidget *)
{
QGroupBox *group0 = new QGroupBox( i18n("Allow to shutdown"), this );
sdcombo = new QComboBox( FALSE, group0 );
connect(sdcombo, SIGNAL(highlighted(int)), SLOT(slotSetAllowShutdown(int)));
sdcombo->insertItem(klocale->translate("None"), 0);
sdcombo->insertItem(klocale->translate("All"), 1);
sdcombo->insertItem(klocale->translate("Root Only"), 2);
sdcombo->insertItem(klocale->translate("Console Only"), 3);
sdcombo->setCurrentItem(sdMode);
sdcombo->setFixedSize(sdcombo->sizeHint());
QGroupBox *group1 = new QGroupBox( klocale->translate("Commands"), this );
QLabel *shutdown_label = new QLabel(klocale->translate("Shutdown"), group1);
shutdown_label->setFixedSize(shutdown_label->sizeHint());
shutdown_lined = new QLineEdit(group1);
shutdown_lined->setFixedHeight(shutdown_lined->sizeHint().height());
shutdown_lined->setText(shutdownstr);
QLabel *restart_label = new QLabel(klocale->translate("Restart"), group1);
restart_label->setFixedSize(restart_label->sizeHint());
restart_lined = new QLineEdit(group1);
restart_lined->setFixedHeight(shutdown_lined->height());
restart_lined->setText(restartstr);
QGroupBox *group2 = new QGroupBox( klocale->translate("Session types"), this );
QLabel *type_label = new QLabel(klocale->translate("New type"), group2);
type_label->setFixedSize(type_label->sizeHint());
session_lined = new QLineEdit(group2);
session_lined->setFixedHeight(session_lined->sizeHint().height());
connect(session_lined, SIGNAL(textChanged(const char*)),
SLOT(slotCheckNewSession(const char*)));
connect(session_lined, SIGNAL(returnPressed()),
SLOT(slotAddSessionType()));
QLabel *types_label = new QLabel(klocale->translate("Available types"), group2);
types_label->setFixedSize(types_label->sizeHint());
sessionslb = new MyListBox(group2);
connect(sessionslb, SIGNAL(highlighted(int)), SLOT(slotSessionHighlighted(int)));
sessionslb->insertStrList(&sessions);
btnrm = new QPushButton( klocale->translate("Remove"), group2 );
btnrm->setFixedSize(btnrm->sizeHint());
btnrm->setEnabled(false);
connect( btnrm, SIGNAL( clicked() ), SLOT( slotRemoveSessionType() ) );
btnadd = new QPushButton( klocale->translate("Add"), group2 );
btnadd->setFixedSize(btnadd->sizeHint());
btnadd->setEnabled(false);
connect( btnadd, SIGNAL( clicked() ), SLOT( slotAddSessionType() ) );
btnup = new KDirectionButton(UpArrow, group2);
btnup->setFixedSize(20, 20);
btnup->setEnabled(false);
connect(btnup, SIGNAL( clicked() ), SLOT( slotSessionUp() ));
btndown = new KDirectionButton(DownArrow, group2);
btndown->setFixedSize(20, 20);
btndown->setEnabled(false);
connect(btndown,SIGNAL( clicked() ), SLOT( slotSessionDown() ));
QBoxLayout *main = new QVBoxLayout( this, 10 );
QBoxLayout *lgroup0 = new QVBoxLayout( group0, 10 );
QBoxLayout *lgroup1 = new QVBoxLayout( group1, 10 );
QBoxLayout *lgroup1a = new QHBoxLayout();
QBoxLayout *lgroup1b = new QHBoxLayout();
QBoxLayout *lgroup2 = new QVBoxLayout( group2, 10 );
QBoxLayout *lgroup2sub = new QHBoxLayout();
QBoxLayout *lgroup2a = new QVBoxLayout();
QBoxLayout *lgroup2b = new QVBoxLayout();
QBoxLayout *lgroup2c = new QVBoxLayout();
main->addWidget(group0);
main->addWidget(group1);
main->addWidget(group2, 2);
lgroup0->addSpacing(10);
lgroup0->addWidget(sdcombo);
lgroup1->addSpacing(group1->fontMetrics().height()/2);
lgroup1->addLayout(lgroup1a);
lgroup1->addLayout(lgroup1b);
lgroup1a->addWidget(shutdown_label);
lgroup1a->addWidget(shutdown_lined);
lgroup1b->addWidget(restart_label);
lgroup1b->addWidget(restart_lined);
lgroup1->activate();
lgroup2->addSpacing(group2->fontMetrics().height()/2);
lgroup2->addLayout(lgroup2sub);
lgroup2sub->addLayout(lgroup2a, 2);
lgroup2sub->addLayout(lgroup2b, 2);
lgroup2sub->addLayout(lgroup2c);
//.........这里部分代码省略.........
示例11: QWidget
KMdiDockContainer::KMdiDockContainer( QWidget *parent, QWidget *win, int position, int flags )
: QWidget( parent ), KDockContainer()
{
m_tabSwitching = false;
m_block = false;
m_inserted = -1;
m_mainWin = win;
oldtab = -1;
mTabCnt = 0;
m_position = position;
m_previousTab = -1;
m_separatorPos = 18000;
m_movingState = NotMoving;
m_startEvent = 0;
kdDebug( 760 ) << k_funcinfo << endl;
QBoxLayout *l;
m_horizontal = ( ( position == KDockWidget::DockTop ) || ( position == KDockWidget::DockBottom ) );
if ( m_horizontal )
l = new QVBoxLayout( this ); //vertical layout for top and bottom docks
else
l = new QHBoxLayout( this ); //horizontal layout for left and right docks
l->setAutoAdd( false );
m_tb = new KMultiTabBar( m_horizontal ? KMultiTabBar::Horizontal : KMultiTabBar::Vertical, this );
m_tb->setStyle( KMultiTabBar::KMultiTabBarStyle( flags ) );
m_tb->showActiveTabTexts( true );
KMultiTabBar::KMultiTabBarPosition kmtbPos;
switch( position )
{
case KDockWidget::DockLeft:
kmtbPos = KMultiTabBar::Left;
break;
case KDockWidget::DockRight:
kmtbPos = KMultiTabBar::Right;
break;
case KDockWidget::DockTop:
kmtbPos = KMultiTabBar::Top;
break;
case KDockWidget::DockBottom:
kmtbPos = KMultiTabBar::Bottom;
break;
default:
kmtbPos = KMultiTabBar::Right;
break;
}
m_tb->setPosition( kmtbPos );
m_ws = new QWidgetStack( this );
m_ws->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
//layout the tabbar
if ( position == KDockWidget::DockLeft || position == KDockWidget::DockTop )
{
//add the tabbar then the widget stack
l->add( m_tb );
l->add( m_ws );
}
else
{
//add the widget stack then the tabbar
l->add( m_ws );
l->add( m_tb );
}
l->activate();
m_ws->hide();
}
示例12: 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 );
}
示例13: QWidget
//.........这里部分代码省略.........
rb->adjustSize();
rb->setFixedHeight( rb->height() );
rb->setMinimumWidth( rb->width() );
kbGroup->insert( rb, NoKey );
grid->addMultiCellWidget( rb, 1, 1, 1, 2 );
rb = new QRadioButton( i18n("&Default key"), fCArea );
rb->adjustSize();
rb->setFixedHeight( rb->height() );
rb->setMinimumWidth( rb->width() );
kbGroup->insert( rb, DefaultKey );
grid->addMultiCellWidget( rb, 2, 2, 1, 2 );
rb = new QRadioButton( i18n("&Custom key"), fCArea );
rb->adjustSize();
rb->setFixedHeight( rb->height() );
rb->setMinimumWidth( rb->width() );
kbGroup->insert( rb, CustomKey );
connect( kbGroup, SIGNAL( clicked( int ) ), SLOT( keyMode( int ) ) );
grid->addMultiCellWidget( rb, 3, 3, 1, 2 );
QBoxLayout *pushLayout = new QHBoxLayout( 2 );
grid->addLayout( pushLayout, 4, 2 );
cShift = new QCheckBox( fCArea );
cShift->setText( "SHIFT" );
cShift->setEnabled( FALSE );
connect( cShift, SIGNAL( clicked() ), SLOT( shiftClicked() ) );
cCtrl = new QCheckBox( fCArea );
cCtrl->setText( "CTRL" );
cCtrl->setEnabled( FALSE );
connect( cCtrl, SIGNAL( clicked() ), SLOT( ctrlClicked() ) );
cAlt = new QCheckBox( fCArea );
cAlt->setText( "ALT" );
cAlt->setEnabled( FALSE );
connect( cAlt, SIGNAL( clicked() ), SLOT( altClicked() ) );
bChange = new KKeyButton("key", fCArea);
bChange->setEnabled( FALSE );
connect( bChange, SIGNAL( clicked() ), SLOT( changeKey() ) );
// Set height of checkboxes to basic key button height.
// Basic key button height = push button height.
cAlt->adjustSize();
cAlt->setFixedHeight( bChange->sizeHint().height() );
cAlt->setMinimumWidth( cAlt->width() );
cShift->adjustSize();
cShift->setFixedHeight( bChange->sizeHint().height() );
cShift->setMinimumWidth( cShift->width() );
cCtrl->adjustSize();
cCtrl->setFixedHeight( bChange->sizeHint().height() );
cCtrl->setMinimumWidth( cCtrl->width() );
fCArea->setMinimumHeight( bChange->sizeHint().height() + 20 +
3*rb->height() + 4*10);
// Add widgets to the geometry manager
pushLayout->addWidget( cShift );
pushLayout->addSpacing( 8 );
pushLayout->addWidget( cCtrl );
pushLayout->addSpacing( 8 );
pushLayout->addWidget( cAlt );
pushLayout->addSpacing( 18 );
pushLayout->addWidget( bChange );
pushLayout->addStretch( 10 );
lNotConfig = new QLabel(fCArea);
lNotConfig->resize(0,0);
lNotConfig->setFont( QFont("Helvetica", 14, QFont::Bold) );
lNotConfig->setAlignment( AlignCenter );
lNotConfig->setFrameStyle( QFrame::Panel | QFrame::Sunken );
if ( wList->count()==0 )
lNotConfig->setText(i18n("No keys defined"));
else {
lNotConfig->setText(i18n("Not configurable"));
lNotConfig->hide();
}
lNotConfig->hide();
lInfo = new QLabel(fCArea);
resize(0,0);
lInfo->setAlignment( AlignCenter );
lInfo->setEnabled( FALSE );
lInfo->hide();
wList->setAutoUpdate(TRUE);
wList->update();
globalDict = new QDict<int> ( 37, false );
globalDict->setAutoDelete( true );
readGlobalKeys();
topLayout->activate();
}
示例14: QWidget
//.........这里部分代码省略.........
// ...and tell the layout about it.
topLayout->setMenuBar( menubar );
// Make an hbox that will hold a row of buttons.
QBoxLayout *buttons = new QHBoxLayout( topLayout );
int i;
for ( i = 1; i <= 4; i++ ) {
QPushButton* but = new QPushButton( this );
QString s;
s.sprintf( "Button %d", i );
but->setText( s );
// Set horizontal stretch factor to 10 to let the buttons
// stretch horizontally. The buttons will not stretch
// vertically, since bigWidget below will take up vertical
// stretch.
buttons->addWidget( but, 10 );
// (Actually, the result would have been the same with a
// stretch factor of 0; if no items in a layout have non-zero
// stretch, the space is divided equally between members.)
}
// Make another hbox that will hold a left-justified row of buttons.
QBoxLayout *buttons2 = new QHBoxLayout( topLayout );
QPushButton* but = new QPushButton( "Button five", this );
buttons2->addWidget( but );
but = new QPushButton( "Button 6", this );
buttons2->addWidget( but );
// Fill up the rest of the hbox with stretchable space, so that
// the buttons get their minimum width and are pushed to the left.
buttons2->addStretch( 10 );
// Make a big widget that will grab all space in the middle.
QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
bigWidget->setText( "This widget will get all the remaining space" );
bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );
// Set vertical stretch factor to 10 to let the bigWidget stretch
// vertically. It will stretch horizontally because there are no
// widgets beside it to take up horizontal stretch.
// topLayout->addWidget( bigWidget, 10 );
topLayout->addWidget( bigWidget );
// Make a grid that will hold a vertical table of QLabel/QLineEdit
// pairs next to a large QMultiLineEdit.
// Don't use hard-coded row/column numbers in QGridLayout, you'll
// regret it when you have to change the layout.
const int numRows = 3;
const int labelCol = 0;
const int linedCol = 1;
const int multiCol = 2;
// Let the grid-layout have a spacing of 10 pixels between
// widgets, overriding the default from topLayout.
QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
int row;
for ( row = 0; row < numRows; row++ ) {
QLineEdit *ed = new QLineEdit( this );
// The line edit goes in the second column
grid->addWidget( ed, row, linedCol );
// Make a label that is a buddy of the line edit
QString s;
s.sprintf( "Line &%d", row+1 );
QLabel *label = new QLabel( ed, s, this );
// The label goes in the first column.
grid->addWidget( label, row, labelCol );
}
// The multiline edit will cover the entire vertical range of the
// grid (rows 0 to numRows) and stay in column 2.
QMultiLineEdit *med = new QMultiLineEdit( this );
grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );
// The labels will take the space they need. Let the remaining
// horizontal space be shared so that the multiline edit gets
// twice as much as the line edit.
grid->setColStretch( linedCol, 10 );
grid->setColStretch( multiCol, 20 );
// Add a widget at the bottom.
QLabel* sb = new QLabel( this );
sb->setText( "Let's pretend this is a status bar" );
sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
// This widget will use all horizontal space, and have a fixed height.
// we should have made a subclass and implemented sizePolicy there...
sb->setFixedHeight( sb->sizeHint().height() );
sb->setAlignment( AlignVCenter | AlignLeft );
topLayout->addWidget( sb );
topLayout->activate();
}
示例15: KConfigWidget
//CT 21Oct1998 - rewritten for using layouts
KDesktopConfig::KDesktopConfig (QWidget * parent, const char *name)
: KConfigWidget (parent, name)
{
QBoxLayout *lay = new QVBoxLayout(this, 5);
ElectricBox = new QButtonGroup(klocale->translate("Active desktop borders"),
this);
QGridLayout *eLay = new QGridLayout(ElectricBox,5,3,10,5);
eLay->addRowSpacing(0,10);
eLay->setColStretch(0,0);
eLay->setColStretch(1,1);
enable= new
QCheckBox(klocale->translate("Enable active desktop borders"),
ElectricBox);
enable->adjustSize();
enable->setMinimumSize(enable->size());
eLay->addMultiCellWidget(enable,1,1,0,1);
movepointer = new
QCheckBox(klocale->translate("Move pointer towards center after switch"),
ElectricBox);
movepointer->adjustSize();
movepointer->setMinimumSize(movepointer->size());
eLay->addMultiCellWidget(movepointer,2,2,0,1);
delaylabel = new QLabel(klocale->translate("Desktop switch delay:"),
ElectricBox);
delaylabel->adjustSize();
delaylabel->setMinimumSize(delaylabel->size());
delaylabel->setAlignment(AlignVCenter|AlignLeft);
eLay->addWidget(delaylabel,3,0);
delaylcd = new QLCDNumber (2, ElectricBox);
delaylcd->setFrameStyle( QFrame::NoFrame );
delaylcd->setFixedHeight(30);
delaylcd->adjustSize();
delaylcd->setMinimumSize(delaylcd->size());
eLay->addWidget(delaylcd,3,1);
delayslider = new KSlider(0,MAX_EDGE_RES/10,10,0,
KSlider::Horizontal, ElectricBox);
delayslider->setSteps(10,10);
delayslider->adjustSize();
delayslider->setMinimumSize(delaylabel->width(), delayslider->height());
eLay->addMultiCellWidget(delayslider,4,4,1,2);
connect( delayslider, SIGNAL(valueChanged(int)), delaylcd, SLOT(display(int)) );
connect( enable, SIGNAL(clicked()), this, SLOT(setEBorders()));
eLay->activate();
lay->addWidget(ElectricBox,5);
//CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
MagicBox = new QButtonGroup(klocale->translate("Magic Borders"), this);
eLay = new QGridLayout(MagicBox,4,3,10,5);
eLay->addRowSpacing(0,10);
eLay->addRowSpacing(2,10);
eLay->setColStretch(0,0);
eLay->setColStretch(1,0);
eLay->setColStretch(2,1);
BrdrSnapLabel = new QLabel(klocale->translate("Border Snap Zone:\n (pixels)"), MagicBox);
BrdrSnapLabel->adjustSize();
BrdrSnapLabel->setMinimumSize(BrdrSnapLabel->size());
BrdrSnapLabel->setAlignment(AlignTop);
eLay->addWidget(BrdrSnapLabel,1,0);
BrdrSnapLCD = new QLCDNumber (2, MagicBox);
BrdrSnapLCD->setFrameStyle( QFrame::NoFrame );
BrdrSnapLCD->setFixedHeight(30);
BrdrSnapLCD->adjustSize();
BrdrSnapLCD->setMinimumSize(BrdrSnapLCD->size());
eLay->addWidget(BrdrSnapLCD,1,1);
BrdrSnapSlider = new KSlider(0,MAX_BRDR_SNAP,1,0,
KSlider::Horizontal, MagicBox);
BrdrSnapSlider->setSteps(1,1);
BrdrSnapSlider->adjustSize();
BrdrSnapSlider->setMinimumSize( BrdrSnapLabel->width()+
BrdrSnapLCD->width(),
BrdrSnapSlider->height());
eLay->addWidget(BrdrSnapSlider,1,2);
eLay->addRowSpacing(0,5);
connect( BrdrSnapSlider, SIGNAL(valueChanged(int)), BrdrSnapLCD, SLOT(display(int)) );
WndwSnapLabel = new QLabel(klocale->translate("Window Snap Zone:\n (pixels)"), MagicBox);
WndwSnapLabel->adjustSize();
WndwSnapLabel->setMinimumSize(WndwSnapLabel->size());
WndwSnapLabel->setAlignment(AlignTop);
eLay->addWidget(WndwSnapLabel,3,0);
WndwSnapLCD = new QLCDNumber (2, MagicBox);
//.........这里部分代码省略.........