本文整理汇总了C++中QTreeWidgetItem::setChildIndicatorPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setChildIndicatorPolicy方法的具体用法?C++ QTreeWidgetItem::setChildIndicatorPolicy怎么用?C++ QTreeWidgetItem::setChildIndicatorPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setChildIndicatorPolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_actionOpen_triggered
void ClifView::on_actionOpen_triggered()
{
QString filename = QFileDialog::getOpenFileName(this,
tr("Open clif File"));
std::string path(filename.toLocal8Bit().constData());
lf_file.open(path, H5F_ACC_RDONLY);
//lffile = H5::H5File(filename.toLocal8Bit().constData(), H5F_ACC_RDONLY);
vector<string> datasets = lf_file.datasetList();
//FIXME clean root list!
for(uint i=0;i<datasets.size();i++) {
QString path(datasets[i].c_str());
DatasetRoot *root = new DatasetRoot(&lf_file, datasets[i]);
QTreeWidgetItem *item = new QTreeWidgetItem(ui->tree, QStringList(path));
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
item->setData(0, Qt::UserRole, QVP<DatasetRoot>::asQVariant(root));
root_list.push_back(root);
}
}
示例2: taskListDownloaded
void TasksDialog::taskListDownloaded(SynergyResponse response)
{
if (response.error)
{
error(response.stdErr);
return;
}
ui->treeWidget->clear();
if (response.stdOut.isEmpty())
{
m_taskListReceived = true;
ui->stackedWidget->setCurrentIndex(0);
return;
}
QStringList taskList = response.stdOut.split(QLatin1String("\n"), QString::SkipEmptyParts);
foreach(QString task, taskList)
{
int spaceIndex = task.indexOf(QLatin1Char(' '));
QString objectName = task.left(spaceIndex);
QString displayName = task.right(task.length() - spaceIndex);
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->treeWidget);
treeItem->setText(0, displayName);
treeItem->setData(0, Qt::UserRole, objectName);
treeItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
}
示例3: removeExpands
void BasketTreeListView::removeExpands()
{
QTreeWidgetItemIterator it(this);
while (*it) {
QTreeWidgetItem *item = *it;
if (item->childCount() <= 0)
item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
++it;
}
}
示例4: onCanvasAdded
void CanvasPhotoWidget::onCanvasAdded(const std::string &name)
{
QTreeWidgetItem* item = new QTreeWidgetItem();
if (!item) return;
item->setText(0, QString(name.c_str()));
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setData(0,cher::DelegateChildRole,1);
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
// item->setSizeHint(0, QSize(cher::APP_WIDGET_BUTTON, cher::APP_WIDGET_BUTTON));
this->addTopLevelItem(item);
}
示例5: initMaterialCatalog
void MaterialBrowser::initMaterialCatalog( QString const & path )
{
QFileInfoList topLevelList = QDir( path ).entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
for ( int i=0 ; i<topLevelList.size() ; i++ )
{
DP_ASSERT( topLevelList[i].isDir() );
QTreeWidgetItem * topLevelItem = new QTreeWidgetItem();
topLevelItem->setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );
topLevelItem->setData( 0, Qt::UserRole, topLevelList[i].absoluteFilePath() );
topLevelItem->setText( 0, topLevelList[i].absoluteFilePath().section( '/', -1 ) );
m_catalog->addTopLevelItem( topLevelItem );
}
}
示例6: browseItems
void dlgAddItems::browseItems()
{
vector<OpcItem > vecAllBranches;
m_pOpcCtrl->BrowserBranches(vecAllBranches);
for (vector<OpcItem>::iterator it = vecAllBranches.begin(); it != vecAllBranches.end(); it++)
{
QTreeWidgetItem *rootItem = new QTreeWidgetItem(ui.treeGroups);
wstring strGroup = (*it).sItem.GetBSTR();
rootItem->setText(0, QString::fromStdWString(strGroup));
rootItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
ui.treeGroups->addTopLevelItem(rootItem);
}
}
示例7: QString
QTreeWidgetItem *CollectionTreeWidget::addAlbum(QString artist, QString album, unsigned int albumId) {
// Find id in database if we don't have it
if (albumId == 0) {
QSqlTableModel *model = service->collectionModel();
// SQLite used two single quotes to escape a single quote! :)
QString filter = "artist = '" + QString(artist).replace("'","''") + "' AND "
"album = '" + QString(album).replace("'","''") + "'";
model->setFilter(filter);
model->select();
while (model->canFetchMore()) model->fetchMore();
int total = model->rowCount();
if (total > 0) {
albumId = model->record(0).value(model->fieldIndex("id_album")).toInt();
}
else {
qDebug("ERROR: no album found! -- " + model->filter().toUtf8());
return NULL;
}
}
// Looks for the artist
QTreeWidgetItem *newAlbumNode; // The node with the album, whether it exists or not
QTreeWidgetItem *artistItem;
artistItem = addArtist(artist);
// Look for album
for (int i = 0; i < artistItem->childCount(); i++) {
if (artistItem->child(i)->text(0) == album) {
newAlbumNode = artistItem->child(i);
return newAlbumNode;
}
}
// Create our new album node and add it if it was not found
newAlbumNode = new CollectionTreeWidgetItem(LevelAlbum, albumId, (QTreeWidget*)0);
newAlbumNode->setText(0, album);
newAlbumNode->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
// Set icon
newAlbumNode->setIcon(0, IconFactory::fromTheme("media-cdrom"));
artistItem->addChild(newAlbumNode);
artistItem->sortChildren(0, Qt::AscendingOrder);
return newAlbumNode;
}
示例8: LoadTables
void ODBC_Connection::LoadTables()
{
// the table and field view
m_ui.TableTreeWidget->clear();
// populate the available tables
Logging::getInstance()->WriteLog(INFORMATION, QString("Retrieving database tables of connection \"%1\"...").arg(m_sConnectionName));
for (int i = 0, count = m_db.tables().count(); i < count; i++)
{
QString sTableName = m_db.tables().value(i);
QTreeWidgetItem *pItem = new QTreeWidgetItem(QStringList() << sTableName);
pItem->setIcon(0, QIcon(":/ODBC_Query/Resources/table.png"));
m_ui.TableTreeWidget->addTopLevelItem(pItem);
pItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
}
}
示例9: Insert
/**
* Inserts widget to be layed out.
*
* @param widget ContactWidget object to display.
* @param key Grouping object.
*/
void Insert(ContactWidget* widget, const T key){
if (!map_.contains(key)) {
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setData(0, Qt::DisplayRole, titler_(widget, key));
item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
items_[key] = item;
tree_->addTopLevelItem(item);
}
map_.insert(key, widget);
QTreeWidgetItem* item = new QTreeWidgetItem;
items_[key]->addChild(item);
items_[key]->setExpanded(true);
tree_->setItemWidget(item, 0, widget);
// sort childern, which causes them to recalculate stylesheet and hide indentation
items_[key]->sortChildren(0, Qt::AscendingOrder);
}
示例10: search
void medPacsWidget::search(QString query)
{
this->readSettings();
this->clear();
if (!d->find) d->find = medAbstractPacsFactory::instance()->createFindScu("dcmtkFindScu");
if(d->find)
{
d->find->clearAllQueryAttributes();
d->find->setQueryLevel(medAbstractPacsFindScu::STUDY);
d->find->addQueryAttribute(0x0010,0x0010, query.toAscii().constData()); // patient name
d->find->addQueryAttribute(0x0008,0x0030, "\0"); // study date
d->find->addQueryAttribute(0x0008,0x0050, "\0"); // accession no
d->find->addQueryAttribute(0x0008,0x0061, "\0"); // modalities in study
d->find->addQueryAttribute(0x0008,0x0090, "\0"); // ref physician
d->find->addQueryAttribute(0x0008,0x1030, "\0"); // study description
d->find->addQueryAttribute(0x0010,0x0020, "\0"); // patient ID
d->find->addQueryAttribute(0x0010,0x0030, "\0"); // patient BD
d->find->addQueryAttribute(0x0010,0x0040, "\0"); // sex
d->find->addQueryAttribute(0x0020,0x000D, "\0"); // studyInstanceUID
d->find->addQueryAttribute(0x0020,0x0010, "\0"); // study ID
foreach(QStringList node, d->selectedNodes)
d->find->sendFindRequest(node.at(0).toLatin1(), node.at(1).toLatin1(), tryToInt(node.at(2)),
d->hostTitle.toLatin1(), d->hostAddress.toLatin1(), tryToInt(d->hostPort));
QVector<medAbstractPacsNode *> nodes = d->find->getNodeContainer();
foreach(medAbstractPacsNode *node, nodes) {
QVector<medAbstractPacsResultDataset *> container = node->getResultDatasetContainer();
foreach(medAbstractPacsResultDataset *dataset, container) {
QTreeWidgetItem *item = new QTreeWidgetItem(this, QStringList()
<< QString(dataset->findKeyValue(0x0010,0x0010))
<< QString(dataset->findKeyValue(0x0008,0x1030))
<< QString(dataset->findKeyValue(0x0020,0x0010))
<< QString(dataset->findKeyValue(0x0008,0x0061)));
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
item->setData(0,Qt::UserRole, d->index(*node));
item->setData(1,Qt::UserRole, QPoint(0x0020,0x000D));
item->setData(2,Qt::UserRole, QString(dataset->getStudyInstanceUID()));
}
示例11: catalogItemExpanded
void MaterialBrowser::catalogItemExpanded( QTreeWidgetItem * item )
{
GetApp()->setOverrideCursor( Qt::WaitCursor );
std::vector<std::string> extensions = dp::fx::EffectLibrary::instance()->getRegisteredExtensions();
QStringList filterList;
for ( std::vector<std::string>::const_iterator it = extensions.begin() ; it != extensions.end() ; ++it )
{
filterList.push_back( QString( "*" ) + it->c_str() );
}
QString filePath = item->data( 0, Qt::UserRole ).toString();
QFileInfoList fil = QDir( filePath ).entryInfoList( filterList, QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot, QDir::DirsFirst );
for ( int i=0 ; i<fil.size() ; i++ )
{
QString filePath = fil[i].absoluteFilePath();
if ( fil[i].isDir() )
{
QTreeWidgetItem * childItem = new QTreeWidgetItem();
childItem->setData( 0, Qt::UserRole, filePath );
childItem->setText( 0, filePath.section( '/', -1 ) );
childItem->setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );
item->addChild( childItem );
}
else
{
std::string fp = filePath.toStdString();
dp::fx::EffectLibrary::instance()->loadEffects( fp, dp::util::FileFinder( GetApp()->getPreferences()->getSearchPathsAsStdVector() ) );
std::vector<std::string> materialNames;
dp::fx::EffectLibrary::instance()->getEffectNames( fp, dp::fx::EffectSpec::EST_PIPELINE, materialNames );
for ( std::vector<std::string>::const_iterator it = materialNames.begin() ; it != materialNames.end() ; ++it )
{
QTreeWidgetItem * childItem = new QTreeWidgetItem();
childItem->setData( 0, Qt::UserRole, QString( it->c_str() ) );
childItem->setText( 0, QString( it->c_str() ) );
item->addChild( childItem );
}
}
}
GetApp()->restoreOverrideCursor();
}
示例12: populate
void ItemAdder::populate(QTreeWidgetItem *parent,
teasafe::SharedTeaSafe const &teaSafe,
std::string const &path)
{
if(teaSafe->folderExists(path)) {
teasafe::TeaSafeFolder f = teaSafe->getTeaSafeFolder(path);
std::vector<teasafe::EntryInfo> entryInfos = f.listAllEntries();
std::vector<teasafe::EntryInfo>::iterator it = entryInfos.begin();
for(; it != entryInfos.end(); ++it) {
QTreeWidgetItem *item = new QTreeWidgetItem(parent);
if(it->type() == teasafe::EntryType::FolderType) {
item->setChildIndicatorPolicy (QTreeWidgetItem::ShowIndicator);
}
item->setText(0, QString(it->filename().c_str()));
}
}
emit finished();
}
示例13: fillDateTreeWidget
void HistoryWindow::fillDateTreeWidget(int index)
{
if (ui.fromComboBox->count() == 0)
return;
auto contactInfo = ui.fromComboBox->itemData(index).value<History::ContactInfo>();
ui.dateTreeWidget->clear();
setWindowTitle(QStringLiteral("%1 (%2)").arg(ui.fromComboBox->currentText(), ui.accountComboBox->currentText()));
history()->months(contactInfo, m_search).connect(this, [this, contactInfo] (const QList<QDate> &months) {
int index = ui.fromComboBox->currentIndex();
auto currentContactInfo = ui.fromComboBox->itemData(index).value<History::ContactInfo>();
if (!(currentContactInfo == contactInfo))
return;
QTreeWidgetItem *year = nullptr;
QTreeWidgetItem *month = nullptr;
Icon yearIcon(QStringLiteral("view-calendar-year"));
for (const QDate &date : months) {
if (!year || year->data(0, Qt::UserRole).toInt() != date.year()) {
year = new QTreeWidgetItem(ui.dateTreeWidget);
year->setText(0, QString::number(date.year()));
year->setIcon(0, yearIcon);
year->setData(0, Qt::UserRole, date.year());
year->setExpanded(true);
}
month = new QTreeWidgetItem(year);
month->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
month->setText(0, QDate::longMonthName(date.month()));
month->setIcon(0, Icon("view-calendar-month"));
month->setData(0, Qt::UserRole, date);
month->setExpanded(false);
}
if (month)
ui.dateTreeWidget->setCurrentItem(month);
});
}
示例14: recursiveInsert
static void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path)
{
QFileIconProvider prov;
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
if (pathTrail.size() == 0) {
if (path.endsWith('/')) {
path.chop(1);
}
parent->setToolTip(0, path);
parent->setData(0, Qt::UserRole, path);
} else {
QTreeWidgetItem *item = findFirstChild(parent, pathTrail.first());
if (!item) {
item = new QTreeWidgetItem(parent);
item->setIcon(0, folderIcon);
item->setText(0, pathTrail.first());
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
}
pathTrail.removeFirst();
recursiveInsert(item, pathTrail, path);
}
}
示例15: setChildIndicatorPolicy
void QTreeWidgetItemProto::setChildIndicatorPolicy(int policy)
{
QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
if (item)
item->setChildIndicatorPolicy((QTreeWidgetItem::ChildIndicatorPolicy)policy);
}