本文整理汇总了C++中QAbstractButton::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setSizePolicy方法的具体用法?C++ QAbstractButton::setSizePolicy怎么用?C++ QAbstractButton::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setSizePolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newButton
QAbstractButton* newButton( const QString& text, QWidget* parent = 0 )
{
QAbstractButton* pushButton = new QPushButton( parent );
pushButton->setText( text );
pushButton->setCheckable( true );
pushButton->setAutoExclusive( true );
pushButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
pushButton->setAttribute( Qt::WA_LayoutUsesWidgetRect );
pushButton->setAttribute( Qt::WA_MacNoClickThrough );
return pushButton;
}
示例2: setIndex
void LocationBar::setIndex( const QModelIndex &index )
{
qDeleteAll( buttons );
buttons.clear();
qDeleteAll( actions );
actions.clear();
QModelIndex i = index;
bool first = true;
while( true )
{
PLItem *item = model->getItem( i );
QString text;
char *fb_name = input_item_GetTitle( item->inputItem() );
if( EMPTY_STR( fb_name ) )
{
free( fb_name );
fb_name = input_item_GetName( item->inputItem() );
}
text = qfu(fb_name);
free(fb_name);
QAbstractButton *btn = new LocationButton( text, first, !first, this );
btn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
buttons.append( btn );
QAction *action = new QAction( text, this );
actions.append( action );
CONNECT( btn, clicked(), action, trigger() );
mapper->setMapping( action, item->id() );
CONNECT( action, triggered(), mapper, map() );
first = false;
if( i.isValid() ) i = i.parent();
else break;
}
QString prefix;
for( int a = actions.count() - 1; a >= 0 ; a-- )
{
actions[a]->setText( prefix + actions[a]->text() );
prefix += QString(" ");
}
if( isVisible() ) layOut( size() );
}
示例3: setIndex
void LocationBar::setIndex( const QModelIndex &index )
{
qDeleteAll( buttons );
buttons.clear();
qDeleteAll( actions );
actions.clear();
QModelIndex i = index;
bool first = true;
while( true )
{
QString text = model->getTitle( i );
QAbstractButton *btn = new LocationButton( text, first, !first, this );
btn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
buttons.append( btn );
QAction *action = new QAction( text, this );
actions.append( action );
CONNECT( btn, clicked(), action, trigger() );
mapper->setMapping( action, model->itemId( i, PLAYLIST_ID ) );
CONNECT( action, triggered(), mapper, map() );
first = false;
if( i.isValid() ) i = i.parent();
else break;
}
QString prefix;
for( int a = actions.count() - 1; a >= 0 ; a-- )
{
actions[a]->setText( prefix + actions[a]->text() );
prefix += QString(" ");
}
if( isVisible() ) layOut( size() );
}