本文整理汇总了C++中KComboBox::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::setAutoFillBackground方法的具体用法?C++ KComboBox::setAutoFillBackground怎么用?C++ KComboBox::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::setAutoFillBackground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KComboBox
void HolidayRegionSelector::Private::initItem( QTreeWidgetItem *listItem, HolidayRegion *region )
{
m_ui.regionTreeWidget->blockSignals( true );
QString languageName = KGlobal::locale()->languageCodeToName( region->languageCode() );
listItem->setCheckState( Private::SelectColumn, Qt::Unchecked );
QString text = i18n( "<p>Select to use Holiday Region</p>" );
listItem->setToolTip( Private::SelectColumn, text );
listItem->setToolTip( Private::ComboColumn, text );
text = i18n( "<p>Select to use Holiday Region</p>" );
listItem->setToolTip( Private::SelectColumn, text );
listItem->setToolTip( Private::ComboColumn, text );
listItem->setText( Private::RegionColumn, region->name() );
QString toolTip = i18n( "<p><b>Region:</b> %1<br/>"
"<b>Language:</b> %2<br/>"
"<b>Description:</b> %3</p>",
region->name(), languageName, region->description() );
listItem->setToolTip( Private::RegionColumn, toolTip );
listItem->setData( Private::RegionColumn, Qt::UserRole, region->regionCode() );
listItem->setText( Private::LanguageColumn, languageName );
listItem->setData( Private::LanguageColumn, Qt::UserRole, region->languageCode() );
listItem->setText( Private::DescriptionColumn, region->description() );
listItem->setToolTip( Private::DescriptionColumn, region->description() );
KComboBox *combo = new KComboBox();
combo->setAutoFillBackground( true );
QString comboText = i18n( "<p>You can choose to display the Holiday Region for information only, "
"or to use the Holiday Region when displaying or calculating days off "
"such as Public Holidays. If you choose to use the Holiday Region for "
"Days Off, then only those Holiday Events marked in the Holiday Region "
"as Days Off will be used for non-work days, Holiday Events that are "
"not marked in the Holiday Region as Days Off will continue to be "
"work days.</p>" );
combo->setToolTip( comboText );
comboText = i18nc( "Combobox label, Holiday Region not used", "Not Used" );
combo->addItem( comboText, QVariant( NotUsed ) );
comboText = i18nc( "Combobox label, use Holiday Region for information only", "Information" );
combo->addItem( comboText, QVariant( UseInformationOnly ) );
comboText = i18nc( "Combobox label, use Holiday Region for days off", "Days Off" );
combo->addItem( comboText, QVariant( UseDaysOff ) );
combo->setCurrentIndex( 0 );
listItem->setData( Private::ComboColumn, Qt::UserRole, NotUsed );
m_ui.regionTreeWidget->setItemWidget( listItem, ComboColumn, combo );
connect( combo, SIGNAL(currentIndexChanged(int)),
q, SLOT(itemChanged(int)) );
m_ui.regionTreeWidget->blockSignals( false );
}
示例2: KComboBox
QWidget * IngredientNameDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */,
const QModelIndex & index ) const
{
//Set up the combo box
KComboBox * editor = new KComboBox( parent );
editor->setAutoFillBackground( true );
editor->setEditable( true );
editor->setCompletionMode( KGlobalSettings::CompletionPopup );
//Set the models and the completion objects
if ( !index.data(IngredientsEditor::IsHeaderRole).toBool() ) {
editor->setModel( m_database->allIngredientsModels()->ingredientNameModel() );
editor->setCompletionObject(
m_database->allIngredientsModels()->ingredientNameCompletion() );
} else {
editor->setModel( m_database->allIngHeadersModels()->ingHeaderNameModel() );
editor->setCompletionObject(
m_database->allIngHeadersModels()->ingHeaderNameCompletion() );
}
return editor;
}