本文整理汇总了C++中KPushButton::height方法的典型用法代码示例。如果您正苦于以下问题:C++ KPushButton::height方法的具体用法?C++ KPushButton::height怎么用?C++ KPushButton::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPushButton
的用法示例。
在下文中一共展示了KPushButton::height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateItemWidgets
void ServiceItemDelegate::updateItemWidgets(const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index) const
{
QCheckBox* checkBox = static_cast<QCheckBox*>(widgets[0]);
KPushButton *configureButton = static_cast<KPushButton*>(widgets[1]);
const int itemHeight = sizeHint(option, index).height();
// Update the checkbox showing the service name and icon
const QAbstractItemModel* model = index.model();
checkBox->setText(model->data(index).toString());
const QString iconName = model->data(index, Qt::DecorationRole).toString();
if (!iconName.isEmpty()) {
checkBox->setIcon(KIcon(iconName));
}
checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool());
const bool configurable = model->data(index, ServiceModel::ConfigurableRole).toBool();
int checkBoxWidth = option.rect.width();
if (configurable) {
checkBoxWidth -= configureButton->sizeHint().width();
}
checkBox->resize(checkBoxWidth, checkBox->sizeHint().height());
checkBox->move(0, (itemHeight - checkBox->height()) / 2);
// Update the configuration button
if (configurable) {
configureButton->setEnabled(checkBox->isChecked());
configureButton->setIcon(KIcon("configure"));
configureButton->resize(configureButton->sizeHint());
configureButton->move(option.rect.right() - configureButton->width(),
(itemHeight - configureButton->height()) / 2);
}
configureButton->setVisible(configurable);
}
示例2: updateItemWidgets
void ItemsViewDelegate::updateItemWidgets( const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
const QPersistentModelIndex& index ) const
{
const GluonPlayer::GameItemsModel* model = qobject_cast<const GluonPlayer::GameItemsModel*>( index.model() );
if( !model )
{
kDebug() << "Warning - Invalid Model!";
return;
}
// setup the install button
int margin = option.fontMetrics.height() / 2;
int right = option.rect.width();
const_cast<QSize&>( m_buttonSize ) = QSize( 32, 32 );
KPushButton* playButton = qobject_cast<KPushButton*>( widgets.at( DelegatePlayButton ) );
if( playButton )
{
playButton->setIcon( KIcon( "media-playback-start" ) );
playButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding );
playButton->resize( m_buttonSize );
playButton->move( right - playButton->width() - margin, option.fontMetrics.height() + playButton->height() * 0.5 );
}
GameTextLabel* gameName = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameName ) );
// gameName->setWordWrap(true);
if( gameName )
{
gameName->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() );
gameName->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) );
gameName->setText( index.data( GluonPlayer::GameItemsModel::GameNameRole ).toString() );
}
GameTextLabel* gameDescription = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameDescription ) );
// gameName->setWordWrap(true);
if( gameDescription )
{
gameDescription->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() * 1 + gameName->size().height() );
gameDescription->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) );
gameDescription->setText( index.data( GluonPlayer::GameItemsModel::GameDescriptionRole ).toString() );
}
}