本文整理汇总了C++中QListWidgetItem::setFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::setFlags方法的具体用法?C++ QListWidgetItem::setFlags怎么用?C++ QListWidgetItem::setFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::setFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_mAddButton_clicked
void QgsComposerManager::on_mAddButton_clicked()
{
QgsComposer* newComposer = 0;
newComposer = QgisApp::instance()->createNewComposer();
if ( !newComposer )
{
return;
}
if ( mTemplate->currentIndex() > 0 )
{
QDomDocument templateDoc;
QFile templateFile( mTemplate->itemData( mTemplate->currentIndex() ).toString() );
if ( templateFile.open( QIODevice::ReadOnly ) )
{
if ( templateDoc.setContent( &templateFile, false ) )
{
newComposer->readXML( templateDoc );
}
}
}
QListWidgetItem* item = new QListWidgetItem( newComposer->title(), mComposerListWidget );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
mItemComposerMap.insert( item, newComposer );
}
示例2: on_newColumnButton_clicked
void TreeWidgetEditor::on_newColumnButton_clicked()
{
m_updating = true;
QListWidgetItem *currentColumn = ui.listWidget->currentItem();
int idx = ui.listWidget->count();
if (currentColumn)
idx = ui.listWidget->currentRow() + 1;
QString newColumnString = tr("New Column");
int columnCount = ui.treeWidget->columnCount();
ui.treeWidget->setColumnCount(columnCount + 1);
ui.treeWidget->headerItem()->setText(columnCount, newColumnString);
moveColumnsLeft(idx, columnCount);
QListWidgetItem *item = new QListWidgetItem();
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setText(newColumnString);
ui.listWidget->insertItem(idx, item);
ui.listWidget->setCurrentItem(item);
ui.treeWidget->setCurrentItem(ui.treeWidget->currentItem(), ui.listWidget->currentRow());
m_updating = false;
updateEditor();
ui.listWidget->editItem(item);
}
示例3: AddPage
void SettingsDialog::AddPage(Page id, SettingsPage* page) {
// Create the list item
QListWidgetItem* item = new QListWidgetItem(page->windowIcon(),
page->windowTitle());
ui_->list->addItem(item);
if (!page->IsEnabled()) {
item->setFlags(Qt::NoItemFlags);
}
// Create a scroll area containing the page
QScrollArea* area = new QScrollArea;
area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
area->setWidget(page);
area->setWidgetResizable(true);
area->setFrameShape(QFrame::NoFrame);
area->setMinimumWidth(page->layout()->minimumSize().width());
// Add the page to the stack
ui_->stacked_widget->addWidget(area);
// Remember where the page is
PageData data;
data.index_ = ui_->list->row(item);
data.scroll_area_ = area;
data.page_ = page;
pages_[id] = data;
}
示例4: refreshComposers
void QgsComposerManager::refreshComposers()
{
QString selName = mComposerListWidget->currentItem() ? mComposerListWidget->currentItem()->text() : "";
mItemComposerMap.clear();
mComposerListWidget->clear();
QSet<QgsComposer*> composers = QgisApp::instance()->printComposers();
QSet<QgsComposer*>::const_iterator it = composers.constBegin();
for ( ; it != composers.constEnd(); ++it )
{
QListWidgetItem* item = new QListWidgetItem(( *it )->title(), mComposerListWidget );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
mItemComposerMap.insert( item, *it );
}
mComposerListWidget->sortItems();
// Restore selection
if ( !selName.isEmpty() )
{
QList<QListWidgetItem*> items = mComposerListWidget->findItems( selName, Qt::MatchExactly );
if ( !items.isEmpty() )
{
mComposerListWidget->setCurrentItem( items.first() );
}
}
}
示例5: QListWidgetItem
void
BCI2000Viewer::FillChannelList()
{
ui->channelList->blockSignals( true );
ui->channelList->clear();
if( mFile.IsOpen() )
{
QListWidgetItem* pItem = new QListWidgetItem( tr("States"), ui->channelList );
pItem->setBackground( cHeadingColor );
pItem->setFlags( Qt::NoItemFlags );
const StateList* states = mFile.States();
for( int i = 0; i < states->Size(); ++i )
{
pItem = new QListWidgetItem( ( *states )[ i ].Name().c_str(), ui->channelList );
pItem->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
}
pItem = new QListWidgetItem( tr("Channels"), ui->channelList );
pItem->setBackground( cHeadingColor );
pItem->setFlags( Qt::NoItemFlags );
int base = ui->channelList->count(),
channelsInFile = mFile.SignalProperties().Channels();
if( mFile.Parameters()->Exists( "ChannelNames" ) )
{
ParamRef ChannelNames = mFile.Parameter( "ChannelNames" );
for( int i = 0; i < ChannelNames->NumValues() && i < channelsInFile; ++i )
{
pItem = new QListWidgetItem( ChannelNames( i ).c_str(), ui->channelList );
pItem->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
}
}
for( int i = ui->channelList->count() - base; i < channelsInFile; ++i )
{
pItem = new QListWidgetItem( QString( tr("Channel %1") ).arg( i + 1 ), ui->channelList );
pItem->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
}
int j = 0;
for( ++j; j < ui->channelList->count()
&& ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ); ++j )
ui->channelList->item( j )->setCheckState( Qt::Unchecked );
for( ++j; j < ui->channelList->count()
&& ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ); ++j )
ui->channelList->item( j )->setCheckState( Qt::Checked );
}
ui->channelList->blockSignals( false );
}
示例6: createIcon
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::createIcon(const QString &icon, const QString &text)
{
QListWidgetItem *button = new QListWidgetItem(contentsWidget);
button->setIcon(QIcon(icon));
button->setText(text);
button->setTextAlignment(Qt::AlignHCenter);
button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
示例7: on_add_clicked
void DlgEditListParameter::on_add_clicked()
{
QListWidgetItem *item = new QListWidgetItem();
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
list->addItem(item);
list->setCurrentItem(item);
list->editItem(item);
}
示例8: setValues
/*!
\details Set the editor values
\param values The string list to set as values
*/
void StringListEditor::setValues(const QStringList& values) {
_list->clear();
foreach ( QString value, values ) {
QListWidgetItem* it = new QListWidgetItem( value, _list );
it->setFlags( it->flags() | Qt::ItemIsEditable );
_list->setCurrentItem( it );
_list->scrollToItem( it );
}
示例9: appendToFileList
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFileHierarchyDialog::appendToFileList(const QString& fileName)
{
QString itemText = fileName;
itemText.remove(0, rootDir().size());
QListWidgetItem* item = new QListWidgetItem(itemText, m_fileList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(Qt::Checked);
}
示例10: addSourcesListItem
void QtShaderWindow::addSourcesListItem(const QString& title, bool isChecked, bool isBuiltIn)
{
QListWidgetItem* item = new QListWidgetItem(title, m_sourcesListWidget);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(isChecked ? Qt::Checked : Qt::Unchecked);
item->setData(SOURCES_LIST_BUILT_IN_ROLE, isBuiltIn);
m_sourcesListWidget->addItem(item);
}
示例11: on_mAddUrlPushButton_clicked
void QgsOptions::on_mAddUrlPushButton_clicked()
{
QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
newItem->setText( "URL" );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mExcludeUrlListWidget->addItem( newItem );
mExcludeUrlListWidget->setCurrentItem( newItem );
}
示例12: QListWidgetItem
QListWidgetItem *TodoProjectSettingsWidget::addToExcludedPatternsList(const QString &pattern)
{
QListWidgetItem *item = new QListWidgetItem(pattern);
item->setFlags(item->flags() | Qt::ItemIsEditable);
prepareItem(item);
ui->excludedPatternsList->addItem(item);
return item;
}
示例13: addListItem
void addListItem(QListWidget* list, const QString& text)
{
QListWidgetItem* item = new QListWidgetItem();
item->setText(text);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(Qt::Checked);
list->addItem(item);
}
示例14: createLPanel
void MainWindow::createLPanel() {
accountWidget = new AccountPage;
folderWidget = new FolderPage;
logWidget = new LogPage;
aboutWidget = new AboutPage;
ui->lPanelWidget->setViewMode(QListView::IconMode);
ui->lPanelWidget->setMovement(QListView::Static);
ui->lPanelWidget->setSpacing(8);
ui->rPanelWidget->removeWidget(ui->rPanelWidget->widget(1));
ui->rPanelWidget->removeWidget(ui->rPanelWidget->widget(0));
ui->rPanelWidget->addWidget(accountWidget);
ui->rPanelWidget->addWidget(folderWidget);
ui->rPanelWidget->addWidget(logWidget);
ui->rPanelWidget->addWidget(aboutWidget);
QListWidgetItem *account = new QListWidgetItem(ui->lPanelWidget);
account->setIcon(QIcon(":/resources/account.png"));
account->setText(tr("Пользователи"));
account->setTextAlignment(Qt::AlignHCenter);
account->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *folder = new QListWidgetItem(ui->lPanelWidget);
folder->setIcon(QIcon(":/resources/folder.png"));
folder->setText(tr("Расшаренная \nпапка"));
folder->setTextAlignment(Qt::AlignHCenter);
folder->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *logging = new QListWidgetItem(ui->lPanelWidget);
logging->setIcon(QIcon(":/resources/log.png"));
logging->setText(tr("Логирование"));
logging->setTextAlignment(Qt::AlignHCenter);
logging->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *about = new QListWidgetItem(ui->lPanelWidget);
about->setIcon(QIcon(":/resources/info.png"));
about->setText(tr("О программе..."));
about->setTextAlignment(Qt::AlignHCenter);
about->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(ui->lPanelWidget,
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
}
示例15: fillWidget
void medPacsSelector::fillWidget( QList<QVariant> nodes )
{
d->selectionList->clear();
foreach(QVariant node, nodes)
{
QListWidgetItem* myItem = new QListWidgetItem(node.toStringList().at(0),d->selectionList);
myItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
myItem->setCheckState(Qt::Checked);
}