本文整理汇总了C++中QListWidgetItem::background方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::background方法的具体用法?C++ QListWidgetItem::background怎么用?C++ QListWidgetItem::background使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::background方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onColor
void PeakColorDlg::onColor()
{
QListWidgetItem* item = d_list->currentItem();
Q_ASSERT( item != 0 );
const QColor clr = QColorDialog::getColor( item->background().color(), this );
if( !clr.isValid() )
return;
item->setBackground( clr );
d_colors->setColor( item->type(), clr );
}
示例2: actionListWidget_itemClicked
void SettingsDialog::actionListWidget_itemClicked(QListWidgetItem *item)
{
QStringList actions;
item->setBackground(item->background() == disabled ? enabled : disabled);
for (int i = 0; i < actionListWidget->count(); i++) {
QListWidgetItem *listitem = actionListWidget->item(i);
if (listitem->background() != disabled)
actions.append(listitem->text());
}
globalSettings.toolbarActions = actions;
globalSettings.toolbarActionsModified = true;
writeSettings();
pmchart->setEnabledActionsList(actions, true);
pmchart->updateToolbarContents();
}
示例3: saveFile
bool AnnoqtConfEditor::saveFile( const QString &fileName )
{
QFile file( fileName );
if ( !file.open( QFile::WriteOnly | QFile::Text ) )
{
QMessageBox::warning( this, tr( "Application" ),
tr( "Cannot write file %1:\n%2." )
.arg( fileName )
.arg( file.errorString() ) );
return false;
}
QTextStream out( &file );
out << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" << endl;
out << "<annotationConfiguration>" << endl;
out << " <entities>" << endl;
QApplication::setOverrideCursor( Qt::WaitCursor );
for (int i = 0; i < m_listWidget->count(); i++)
{
QListWidgetItem* item = m_listWidget->item(i);
out << " <entity name=\""<<item->text()<<"\" color=\""<<item->background().color().name()<<"\"";
if (item->checkState() == Qt::Checked)
{
out << " recursive=\"true\"";
}
out << "/>" << endl;
}
QApplication::restoreOverrideCursor();
out << " </entities>" << endl;
out << " <templates>" << endl;
out << " </templates>" << endl;
out << "</annotationConfiguration>" << endl;
statusBar()->showMessage( tr( "File saved" ), 2000 );
setWindowModified( false );
return true;
}