void IssuesWidget::addError(const QString &folderAlias, const QString &message, ErrorCategory category) { auto folder = FolderMan::instance()->folder(folderAlias); if (!folder) return; QStringList columns; QDateTime timestamp = QDateTime::currentDateTime(); const QString timeStr = ProtocolItem::timeString(timestamp); const QString longTimeStr = ProtocolItem::timeString(timestamp, QLocale::LongFormat); columns << timeStr; columns << ""; // no "File" entry columns << folder->shortGuiLocalPath(); columns << message; QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Error); QTreeWidgetItem *twitem = new ProtocolItem(columns); twitem->setData(0, Qt::SizeHintRole, QSize(0, ActivityItemDelegate::rowHeight())); twitem->setData(0, Qt::UserRole, timestamp); twitem->setIcon(0, icon); twitem->setToolTip(0, longTimeStr); twitem->setData(2, Qt::UserRole, folderAlias); twitem->setToolTip(3, message); twitem->setData(3, Qt::UserRole, SyncFileItem::NormalError); addItem(twitem); addErrorWidget(twitem, message, category); }
guint fill_advanced_prefs(module_t *module, gpointer root_ptr) { QTreeWidgetItem *root_item = static_cast<QTreeWidgetItem *>(root_ptr); if (!module || !root_item) return 1; if (module->numprefs < 1 && !prefs_module_has_submodules(module)) return 0; QString module_title = module->title; QTreeWidgetItem *tl_item = new QTreeWidgetItem(root_item); tl_item->setText(0, module_title); tl_item->setToolTip(0, QString("<span>%1</span>").arg(module->description)); tl_item->setFirstColumnSpanned(true); QList<QTreeWidgetItem *>tl_children; for (GList *pref_l = module->prefs; pref_l && pref_l->data; pref_l = g_list_next(pref_l)) { pref_t *pref = (pref_t *) pref_l->data; if (pref->type == PREF_OBSOLETE || pref->type == PREF_STATIC_TEXT) continue; const char *type_name = prefs_pref_type_name(pref); if (!type_name) continue; pref_stash(pref, NULL); QTreeWidgetItem *item = new QTreeWidgetItem(); QString full_name = QString(module->name ? module->name : module->parent->name) + "." + pref->name; QString type_desc = gchar_free_to_qstring(prefs_pref_type_description(pref)); QString default_value = gchar_free_to_qstring(prefs_pref_to_str(pref, pref_stashed)); item->setData(0, Qt::UserRole, qVariantFromValue(pref)); item->setText(0, full_name); item->setToolTip(0, QString("<span>%1</span>").arg(pref->description)); item->setToolTip(1, QObject::tr("Has this preference been changed?")); item->setText(2, type_name); item->setToolTip(2, QString("<span>%1</span>").arg(type_desc)); item->setToolTip(3, QString("<span>%1</span>").arg( default_value.isEmpty() ? default_value : QObject::tr("Default value is empty"))); tl_children << item; // .uat is a void * so it wins the "useful key value" prize. if (pref->varp.uat) { pref_ptr_to_pref_[pref->varp.uat] = pref; } } tl_item->addChildren(tl_children); if(prefs_module_has_submodules(module)) return prefs_modules_foreach_submodules(module, fill_advanced_prefs, tl_item); return 0; }
void visit(const char* name, const boost::array<T, N>& val, const char* desc, E e) { QTreeWidgetItem* item = new QTreeWidgetItem(); item->setText(0, QString(name)); item->setText(1, toString(val)); item->setToolTip(0, toString(desc)); item->setToolTip(1, enumstoString(e)); if(root == NULL) _sw._ui.treeWidget->addTopLevelItem(item); else root->addChild(item); }
void QJDMainWindow::setAreaWidget(QString areaString, QString areaPath, QStringList lineStringList, QStringList linePathList, QVector<QStringList> flowStringList, QVector<QStringList> flowPathList,QVector<QVector<QStringList> > dataStringList, QVector<QVector<QStringList> > dataPathList) { // qDebug()<<"setAreaWidget::"<<flowStringList<<flowPathList; QTreeWidgetItem *areaItem = new QTreeWidgetItem; areaItem->setText(0,areaString); areaItem->setToolTip(0,areaPath); areaItem->setIcon(0,QIcon(":/src/images/area.png")); for(int j=0; j<lineStringList.count(); j++) { QTreeWidgetItem *lineItem = new QTreeWidgetItem; lineItem->setText(0,lineStringList.at(j)); lineItem->setToolTip(0,linePathList.at(j)); lineItem->setIcon(0,QIcon(":/src/images/line.png")); for(int k=0; k<flowStringList[j].size(); k++) { QTreeWidgetItem *flowItem = new QTreeWidgetItem; flowItem->setText(0,flowStringList[j].at(k)); flowItem->setToolTip(0,flowPathList[j].at(k)); if(flowStringList[j].at(k)=="Data") { flowItem->setIcon(0,QIcon(":/src/images/data.png")); } else { flowItem->setIcon(0,QIcon(":/src/images/flow.png")); } lineItem->addChild(flowItem); // Scan/Pick for(int l=0; l<dataStringList[j][k].size(); l++) { QTreeWidgetItem *dataItem = new QTreeWidgetItem; dataItem->setText(0,dataStringList[j][k].at(l)); dataItem->setToolTip(0,dataPathList[j][k].at(l)); // dataItem->setIcon(0,QIcon(":/src/images/flow.png")); flowItem->addChild(dataItem); // qDebug()<<lineStringList.count()<<j<<flowStringList[j].size()<<k<<dataStringList[k].size()<<l; } } areaItem->addChild(lineItem); } areaWidget->addTopLevelItem(areaItem); }
void Mirroring::findShapes() { App::Document* activeDoc = App::GetApplication().getActiveDocument(); if (!activeDoc) return; Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc); if (!activeGui) return; this->document = QString::fromLatin1(activeDoc->getName()); std::vector<App::DocumentObject*> objs = activeDoc->getObjectsOfType (Part::Feature::getClassTypeId()); for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it!=objs.end(); ++it) { const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getValue(); if (!shape.IsNull()) { QString label = QString::fromUtf8((*it)->Label.getValue()); QString name = QString::fromLatin1((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); child->setToolTip(0, label); child->setData(0, Qt::UserRole, name); Gui::ViewProvider* vp = activeGui->getViewProvider(*it); if (vp) child->setIcon(0, vp->getIcon()); ui->shapes->addTopLevelItem(child); } } }
void Tessellation::findShapes() { App::Document* activeDoc = App::GetApplication().getActiveDocument(); if (!activeDoc) return; Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc); if (!activeGui) return; this->document = QString::fromAscii(activeDoc->getName()); std::vector<Part::Feature*> objs = activeDoc->getObjectsOfType<Part::Feature>(); for (std::vector<Part::Feature*>::iterator it = objs.begin(); it!=objs.end(); ++it) { const TopoDS_Shape& shape = (*it)->Shape.getValue(); if (shape.IsNull()) continue; bool hasfaces = false; TopExp_Explorer xp(shape,TopAbs_FACE); while (xp.More()) { hasfaces = true; break; } if (hasfaces) { QString label = QString::fromUtf8((*it)->Label.getValue()); QString name = QString::fromAscii((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); child->setToolTip(0, label); child->setData(0, Qt::UserRole, name); Gui::ViewProvider* vp = activeGui->getViewProvider(*it); if (vp) child->setIcon(0, vp->getIcon()); ui->treeWidget->addTopLevelItem(child); } } }
/* Update the file browser to show files in the project. Read these from the project's project file. */ void ProjectInfo::loadFileBrowser(QDir *projectDir, QDomDocument *projectFile) { // setup the file browser fileBrowser->clear(); // get rid of anything previously in there QDomNodeList allFiles = projectFile->elementsByTagName("files").at(0).childNodes(); QTreeWidgetItem *top = new QTreeWidgetItem(QStringList() << projectDir->dirName()); top->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_DirIcon)); fileBrowser->addTopLevelItem(top); // only deals with files in the top level directory at the moment QFileIconProvider ip; for(int i = 0; i < allFiles.count(); i++) { QFileInfo fi(projectDir->filePath(allFiles.at(i).toElement().text())); if(!fi.fileName().isEmpty()) { if(projectDir->exists(fi.fileName())) { QString buildtype = allFiles.at(i).toElement().attribute("type"); QTreeWidgetItem *child = new QTreeWidgetItem(QStringList() << fi.fileName() << buildtype); child->setData(FILENAME_COLUMN, FULLPATH_ROLE, fi.filePath()); child->setToolTip(FILENAME_COLUMN, fi.filePath()); child->setIcon(FILENAME_COLUMN, ip.icon(fi)); top->addChild(child); } } } top->setExpanded(true); }
//添加音乐 void MusicList::addMusicToList(QString topLevelName, QList<QMap<QString, QString> > musicUrlsAndNames) { int topLevelIndex = -1; for (int i=0; i<this->topLevelItemCount(); ++i) { if (this->topLevelItem(i)->text(0) == topLevelName) { topLevelIndex = i; break; } } Q_ASSERT_X(topLevelIndex > -1, "adMusicToList()", "topLevel is not exists"); for (int i=0; i<musicUrlsAndNames.length(); ++i) { QString musicUrl = musicUrlsAndNames.at(i).firstKey(); QString musicName = musicUrlsAndNames.at(i).first(); QTreeWidgetItem *createItem = new QTreeWidgetItem(QStringList(musicName)); this->topLevelItem(topLevelIndex)->addChild(createItem); this->playlistVector[topLevelIndex]->addMedia(QUrl(musicUrl)); createItem->setToolTip(topLevelIndex, musicName); completerList.append(musicName); //添加到自动补全列表 } //设置自动补全 stringListModel->setStringList(completerList); }
void SweepWidget::findShapes() { App::Document* activeDoc = App::GetApplication().getActiveDocument(); Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc); if (!activeGui) return; d->document = activeDoc->getName(); std::vector<Part::Feature*> objs = activeDoc->getObjectsOfType<Part::Feature>(); for (std::vector<Part::Feature*>::iterator it = objs.begin(); it!=objs.end(); ++it) { const TopoDS_Shape& shape = (*it)->Shape.getValue(); if (shape.IsNull()) continue; if (shape.ShapeType() == TopAbs_FACE || shape.ShapeType() == TopAbs_WIRE || shape.ShapeType() == TopAbs_EDGE || shape.ShapeType() == TopAbs_VERTEX) { QString label = QString::fromUtf8((*it)->Label.getValue()); QString name = QString::fromAscii((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); child->setToolTip(0, label); child->setData(0, Qt::UserRole, name); Gui::ViewProvider* vp = activeGui->getViewProvider(*it); if (vp) child->setIcon(0, vp->getIcon()); d->ui.selector->availableTreeWidget()->addTopLevelItem(child); } } }
void wizardDisk::populateDiskTree() { QStringList tmpList, zMnts; QString tmp, opts; treeMounts->clear(); treeMounts->setHeaderLabels(QStringList() << "ID" << tr("ZFS Mounts") << tr("ZFS Options") ); treeMounts->setColumnCount(3); labelFreeSpace->setVisible(false); lineFreeMB->setVisible(false); pushSizeMount->setVisible(false); treeMounts->header()->setSectionHidden(0, true); treeMounts->header()->setDefaultSectionSize(150); zMnts = sysFinalDiskLayout.at(0).at(2).split(","); // Now loop through ZFS mounts for (int i=0; i < zMnts.count(); ++i) { tmpList.clear(); opts = zMnts.at(i).section("(", 1, 1).section(")", 0, 0); tmpList << tmp.setNum(i+1) << zMnts.at(i).split("(").at(0) << opts ; QTreeWidgetItem *mItem = new QTreeWidgetItem(treeMounts, tmpList); mItem->setToolTip(2, opts); } treeMounts->setCurrentItem(treeMounts->findItems("0", Qt::MatchFixedString).at(0)); slotTreeDiskChanged(); }
void QgsSingleBandPseudoColorRendererWidget::on_mColorInterpolationComboBox_currentIndexChanged( int index ) { QgsColorRampShader::ColorRamp_TYPE interpolation = static_cast< QgsColorRampShader::ColorRamp_TYPE >( mColorInterpolationComboBox->itemData( index ).toInt() ); mClipCheckBox->setEnabled( interpolation == QgsColorRampShader::INTERPOLATED ); QString valueLabel; QString valueToolTip; switch ( interpolation ) { case QgsColorRampShader::INTERPOLATED: valueLabel = tr( "Value" ); valueToolTip = tr( "Value for color stop" ); break; case QgsColorRampShader::DISCRETE: valueLabel = tr( "Value <=" ); valueToolTip = tr( "Maximum value for class" ); break; case QgsColorRampShader::EXACT: valueLabel = tr( "Value =" ); valueToolTip = tr( "Value for color" ); break; } QTreeWidgetItem* header = mColormapTreeWidget->headerItem(); header->setText( ValueColumn, valueLabel ); header->setToolTip( ValueColumn, valueToolTip ); autoLabel(); emit widgetChanged(); }
void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, EditorView *view, OpenEditorsModel *model, QSet<IDocument *> &documentsDone) { foreach (const EditLocation &hi, history) { if (hi.document.isNull() || documentsDone.contains(hi.document)) continue; documentsDone.insert(hi.document.data()); QString title = model->displayNameForDocument(hi.document); QTC_ASSERT(!title.isEmpty(), continue); QTreeWidgetItem *item = new QTreeWidgetItem(); if (hi.document->isModified()) title += tr("*"); item->setIcon(0, !hi.document->fileName().isEmpty() && hi.document->isFileReadOnly() ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.document->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.document.data())); item->setData(0, Qt::UserRole+1, QVariant::fromValue(view)); item->setTextAlignment(0, Qt::AlignLeft); m_editorList->addTopLevelItem(item); if (m_editorList->topLevelItemCount() == 1){ m_editorList->setCurrentItem(item); } } }
void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro) { QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole); QString group = data.toString(); if (group == QLatin1String("Macros")) { CommandManager & cCmdMgr = Application::Instance->commandManager(); Command* pCmd = cCmdMgr.getCommandByName(macro); for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) { QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i); QByteArray command = item->data(1, Qt::UserRole).toByteArray(); if (command == macro) { item->setText(1, QString::fromUtf8(pCmd->getMenuText())); item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText())); item->setData(1, Qt::UserRole, macro); item->setSizeHint(0, QSize(32, 32)); item->setBackgroundColor(0, Qt::lightGray); if (pCmd->getPixmap()) item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap())); if (commandTreeWidget->isItemSelected(item)) textLabelDescription->setText(item->toolTip(1)); break; } } } }
QTreeWidgetItem *QgsSettingsTree::createItem( const QString &text, QTreeWidgetItem *parent, int index ) { QTreeWidgetItem *after = 0; if ( index != 0 ) after = childAt( parent, index - 1 ); QTreeWidgetItem *item; if ( parent ) item = new QTreeWidgetItem( parent, after ); else item = new QTreeWidgetItem( this, after ); item->setText( 0, text ); item->setFlags( item->flags() | Qt::ItemIsEditable ); QString key = itemKey( item ); QgsDebugMsg( key ); if ( settingsMap.contains( key ) ) { QgsDebugMsg( "contains!!!!" ); QStringList values = settingsMap[ key ]; item->setText( 3, values.at( 0 ) ); item->setToolTip( 0, values.at( 1 ) ); item->setToolTip( 2, values.at( 1 ) ); } // if ( settingsMap.contains( return item; }
void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenEditorsModel *model) { m_editorList->clear(); bool first = true; QSet<IFile*> filesDone; foreach (const EditLocation &hi, view->editorHistory()) { if (hi.file.isNull() || filesDone.contains(hi.file)) continue; QString title = model->displayNameForFile(hi.file); QTC_ASSERT(!title.isEmpty(), continue;) filesDone.insert(hi.file.data()); QTreeWidgetItem *item = new QTreeWidgetItem(); if (hi.file->isModified()) title += tr("*"); item->setIcon(0, hi.file->isReadOnly() ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.file->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); item->setData(0, Qt::UserRole+1, QVariant::fromValue(view)); item->setTextAlignment(0, Qt::AlignLeft); m_editorList->addTopLevelItem(item); if (first){ m_editorList->setCurrentItem(item); first = false; } }
void ccPluginDlg::populateTreeWidget(QObject *plugin, const QString &name, const QString &path) { QTreeWidgetItem *pluginItem = new QTreeWidgetItem(treeWidget); pluginItem->setText(0, name); treeWidget->setItemExpanded(pluginItem, true); QFont boldFont = pluginItem->font(0); boldFont.setBold(true); pluginItem->setFont(0, boldFont); if ( !path.isEmpty() ) { pluginItem->setToolTip( 0, path ); } if ( plugin == nullptr ) return; ccPluginInterface *ccPlugin = qobject_cast<ccPluginInterface*>(plugin); if ( ccPlugin == nullptr ) return; QStringList features; features += QString("name: %1").arg(ccPlugin->getName()); addItems(pluginItem, "CloudCompare Plugin", features); }
void PaletteTreeWidget::addGroups(QMap<QString, QList<PaletteElement> > &groups , QMap<QString, QString> const &descriptions , bool hideIfEmpty , QString const &diagramFriendlyName) { if (groups.isEmpty() && hideIfEmpty) { hide(); return; } clear(); show(); int expandedCount = 0; foreach (QString const &group, groups.keys()) { QTreeWidgetItem *item = new QTreeWidgetItem; item->setText(0, group); item->setToolTip(0, descriptions[group]); sortByFriendlyName(groups[group]); addItemsRow(groups[group], item); addTopLevelItem(item); if (SettingsManager::value(diagramFriendlyName + group, 0).toBool()) { ++expandedCount; expandItem(item); } } if (expandedCount == 0) { expand(); } }
ColorDialog::ColorDialog(QWidget *parent, LPlugins *plugs, QString colorFilePath) : QDialog(parent), ui(new Ui::ColorDialog){ ui->setupUi(this); //load the designer file filepath = colorFilePath; this->setWindowIcon( LXDG::findIcon("format-stroke-color","") ); ui->line_name->setText( colorFilePath.section("/",-1).section(".qss",0,0) ); //Load the icons for the window ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") ); ui->push_save->setIcon( LXDG::findIcon("document-save","") ); ui->tool_getcolor->setIcon( LXDG::findIcon("color-picker","") ); ui->tool_editcolor->setIcon( LXDG::findIcon("edit-rename","") ); //Now create entries for the available colors in the database ui->tree_color->clear(); QStringList colors = plugs->colorItems(); colors.sort(); for(int i=0; i<colors.length(); i++){ LPI info = plugs->colorInfo(colors[i]); QTreeWidgetItem *it = new QTreeWidgetItem(QStringList() << info.name); it->setWhatsThis(0,info.ID); it->setToolTip(0,info.description); ui->tree_color->addTopLevelItem(it); } //Now load the given file loadColors(); //Now center the window on the parent QPoint cen = parent->geometry().center(); this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) ); }
void ImportedBookmarksPreviewDialog::AddItems() { const int rootFolderIntId = (elist->importSource == ImportedEntityList::Source_Firefox ? 1 : 0); ui->chkRemoveImportedFile->setVisible(elist->importSource == ImportedEntityList::Source_Files); ui->chkRemoveImportedFile->setChecked(elist->removeImportedFiles); int index = 0; foreach (const ImportedBookmarkFolder& ibf, elist->ibflist) { QTreeWidgetItem* twi = new QTreeWidgetItem(); twi->setText(0, ibf.title); twi->setIcon(0, icon_folder); twi->setData(0, TWID_IsFolder, true); twi->setData(0, TWID_Index, index); folderItems[ibf.intId] = twi; index++; //On Firefox, files and Urls, don't add or show the root folder. if (ibf.intId == rootFolderIntId && (elist->importSource == ImportedEntityList::Source_Firefox || elist->importSource == ImportedEntityList::Source_Files || elist->importSource == ImportedEntityList::Source_Urls)) continue; if (ibf.parentId <= rootFolderIntId) ui->twBookmarks->addTopLevelItem(twi); else folderItems[ibf.parentId]->addChild(twi); } index = 0; foreach (const ImportedBookmark& ib, elist->iblist) { QTreeWidgetItem* twi = new QTreeWidgetItem(); twi->setText(0, ib.title); SetBookmarkItemIcon(twi, ib); twi->setToolTip(0, ib.uri); twi->setData(0, TWID_IsFolder, false); twi->setData(0, TWID_Index, index); bookmarkItems[ib.intId] = twi; index++; if (ib.title.trimmed().isEmpty()) { //For [title-less bookmarks] show their url in a different formatting. twi->setText(0, Util::FullyPercentDecodedUrl(ib.uri)); twi->setTextColor(0, QColor(192, 128, 0)); QFont italicFont = twi->font(0); italicFont.setItalic(true); twi->setFont(0, italicFont); } if (ib.parentId <= 0) ui->twBookmarks->addTopLevelItem(twi); else folderItems[ib.parentId]->addChild(twi); } ui->twBookmarks->expandAll(); ui->twBookmarks->setCurrentItem(ui->twBookmarks->topLevelItem(0)); }
//Display the booklist in the given QTreeWidget void BookList::displayInTree(QTreeWidget *tree, bool showCheck, bool isSearchTree) { tree->setIconSize(QSize(100,100)); //Add treeItems for each book to the treeWidget for(unsigned int i=0;i<size();i++) { if (this->at(i)->IsHidden() != true) { QTreeWidgetItem *twi; if(this->at(i)->getParent() == NULL) twi = new QTreeWidgetItem(tree); else if(isSearchTree) twi = new QTreeWidgetItem(this->at(i)->getParent()->getSearchTreeItemPtr()); else twi = new QTreeWidgetItem(this->at(i)->getParent()->getTreeItemPtr()); if(isSearchTree) this->at(i)->setSearchTreeItemPtr(twi); else this->at(i)->setTreeItemPtr(twi); QString dn; if(!this->at(i)->getTreeDisplayName().simplified().isEmpty()) dn = this->at(i)->getTreeDisplayName().simplified(); else if (!this->at(i)->getNormallDisplayName().simplified().isEmpty()) dn = this->at(i)->getNormallDisplayName().simplified(); else { vector<QString> name_parts; splittotwo(this->at(i)->getName(), name_parts, "_"); dn = name_parts[1]; } dn.replace("שס", "ש\"ס"); twi->setText(0, dn); //set the icon: QIcon *icon = bookIcon(this->at(i), this->at(i)->mIconState); twi->setIcon(0, *icon); delete icon; twi->setToolTip(1, this->at(i)->getName()); if ( showCheck && ( this->at(i)->fileType() == Book::Dir || this->at(i)->fileType() == Book::Normal || this->at(i)->fileType() == Book::Html ) ) { twi->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ); twi->setCheckState(0,Qt::Unchecked); } else { twi->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); } } } }
void QSceneTreeWidget::UpdateScene(c4g::scene::ISceneImpl* const& rpScene) { clear(); scene::IPanel* const& panel_ptr = rpScene->GetPanel(); QTreeWidgetItem* item = new QTreeWidgetItem(this); item->setData(0, Qt::UserRole, qVariantFromValue((void*)panel_ptr)); item->setText(0, panel_ptr->id.c_str()); item->setToolTip(0, item->text(0)); item->setText(1, panel_ptr->class_name.c_str()); item->setToolTip(1, item->text(1)); addTopLevelItem(item); m_vItemPtr.push_back(item); panel_ptr->Visit(this); }
HolidayRegionSelector::HolidayRegionSelector( QWidget *parent ) : QWidget( parent ), d( new Private( this ) ) { d->m_ui.setupUi( this ); // Setup the columns d->m_ui.regionTreeWidget->setColumnCount( 5 ); QTreeWidgetItem *headerItem = d->m_ui.regionTreeWidget->headerItem(); QString header = i18nc( "Header for Select column", "Select" ); QString text = i18n( "<p>This column selects to use the Holiday Region</p>" ); headerItem->setText( Private::SelectColumn, header ); headerItem->setToolTip( Private::SelectColumn, text ); headerItem->setWhatsThis( Private::SelectColumn, text ); headerItem->setText( Private::ComboColumn, header ); headerItem->setToolTip( Private::ComboColumn, text ); headerItem->setWhatsThis( Private::ComboColumn, text ); header = i18nc( "Header for Holiday Region column", "Region" ); text = i18n( "<p>This column displays the name of the Holiday Region</p>" ); headerItem->setText( Private::RegionColumn, header ); headerItem->setToolTip( Private::RegionColumn, text ); headerItem->setWhatsThis( Private::RegionColumn, text ); header = i18nc( "Header for Language column", "Language" ); text = i18n( "<p>This column displays the language of the Holiday Region</p>" ); headerItem->setText( Private::LanguageColumn, header ); headerItem->setToolTip( Private::LanguageColumn, text ); headerItem->setWhatsThis( Private::LanguageColumn, text ); header = i18nc( "Header for Description column", "Description" ); text = i18n( "<p>This column displays the description of the Holiday Region</p>" ); headerItem->setText( Private::DescriptionColumn, header ); headerItem->setToolTip( Private::DescriptionColumn, text ); headerItem->setWhatsThis( Private::DescriptionColumn, text ); d->m_ui.regionTreeWidget->setSelectionMode( QAbstractItemView::NoSelection ); d->m_ui.regionTreeWidget->setItemsExpandable( true ); //per bug 271628 d->m_ui.regionTreeWidget->setUniformRowHeights( true ); d->m_ui.regionTreeWidget->setAllColumnsShowFocus( true ); connect( d->m_ui.regionTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int)) ); QMap<QString, QStringList> regionCodeMap; QMap<QString, HolidayRegion*> regionMap; foreach ( const QString ®ionCode, HolidayRegion::regionCodes() ) { regionMap[regionCode] = new HolidayRegion( regionCode ); QString country = regionMap[regionCode]->countryCode().split( '-' ).at( 0 ); regionCodeMap[country].append( regionCode ); }
void MotionPlanningFrame::populatePlanningSceneTreeView() { moveit_warehouse::PlanningSceneStoragePtr planning_scene_storage = planning_scene_storage_; if (!planning_scene_storage) return; ui_->planning_scene_tree->setUpdatesEnabled(false); // remember which items were expanded std::set<std::string> expanded; for (int i = 0; i < ui_->planning_scene_tree->topLevelItemCount(); ++i) { QTreeWidgetItem* it = ui_->planning_scene_tree->topLevelItem(i); if (it->isExpanded()) expanded.insert(it->text(0).toStdString()); } ui_->planning_scene_tree->clear(); std::vector<std::string> names; planning_scene_storage->getPlanningSceneNames(names); for (const std::string& name : names) { std::vector<std::string> query_names; planning_scene_storage->getPlanningQueriesNames(query_names, name); QTreeWidgetItem* item = new QTreeWidgetItem(ui_->planning_scene_tree, QStringList(QString::fromStdString(name)), ITEM_TYPE_SCENE); item->setFlags(item->flags() | Qt::ItemIsEditable); item->setToolTip(0, item->text(0)); // we use the tool tip as a backup of the old name when renaming for (const std::string& query_name : query_names) { QTreeWidgetItem* subitem = new QTreeWidgetItem(item, QStringList(QString::fromStdString(query_name)), ITEM_TYPE_QUERY); subitem->setFlags(subitem->flags() | Qt::ItemIsEditable); subitem->setToolTip(0, subitem->text(0)); item->addChild(subitem); } ui_->planning_scene_tree->insertTopLevelItem(ui_->planning_scene_tree->topLevelItemCount(), item); if (expanded.find(name) != expanded.end()) ui_->planning_scene_tree->expandItem(item); } ui_->planning_scene_tree->sortItems(0, Qt::AscendingOrder); ui_->planning_scene_tree->setUpdatesEnabled(true); checkPlanningSceneTreeEnabledButtons(); }
AEResult GameAssetTreeWidget::CreateAudioAssetGameAssetBranch(AudioAsset* gameAsset) { //////////////////////////////////////////// //No need to lock this function as it is internal //and calling function should lock it //////////////////////////////////////////// if (!m_IsReady) { return AEResult::NotReady; } AEAssert(m_EngineViewer != nullptr); if (m_EngineViewer == nullptr) { AETODO("Add new error GameAppNull"); return AEResult::NullObj; } AEAssert(gameAsset != nullptr); if (gameAsset == nullptr) { return AEResult::NullParameter; } //////////////////////////////////////// //Create Branch QTreeWidgetItem* branch = new QTreeWidgetItem(); branch->setData(0, Qt::ItemDataRole::DisplayRole, QString::fromStdWString(gameAsset->GetName())); branch->setData(0, AE_QT_ITEM_DATA_ROLE_GAME_ASSET_UNIQUE_ID, QVariant(gameAsset->GetUniqueAssetID())); //////////////////////////////////////// //Add to Main Tree this->addTopLevelItem(branch); //////////////////////////////////////// //Set background as red if it not loaded if (!gameAsset->IsLoaded()) { branch->setBackgroundColor(0, QColor(255, 0, 0)); branch->setBackgroundColor(1, QColor(255, 0, 0)); } //////////////////////////////////////// //Game Content Type QTreeWidgetItem* gameContentTypeChild = new QTreeWidgetItem(); gameContentTypeChild->setData(0, Qt::ItemDataRole::DisplayRole, "GCT"); gameContentTypeChild->setData(1, Qt::ItemDataRole::DisplayRole, "Audio"); gameContentTypeChild->setToolTip(0, "Game Content Type"); //////////////////////////////////////// //Add Child to Model Branch branch->addChild(gameContentTypeChild); //////////////////////////////////////// //Finish return AEResult::Ok; }
void users_dialog::init() { m_user_list = users_repository::get_list(); m_ulist->setHeaderLabels(QStringList() << tr("Login") << tr("Can connect") << tr("Operator name")); QTreeWidgetItem* h = m_ulist->headerItem(); h->setToolTip(0, tr("Database login")); h->setToolTip(1, tr("Checked if allowed to connect to this database")); h->setToolTip(2, tr("Name as a Manitou-Mail operator in this database")); QFontMetrics m(m_ulist->font()); m_ulist->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); setMinimumWidth(m.width("a")*60); refresh_list(); refresh_role_list(); m_ulist->adjustSize(); m_glist->setHeaderLabels(QStringList() << tr("Role")); }
void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStringList &articles) { // Turn off sorting while inserting m_ui->treeMatchingArticles->setSortingEnabled(false); // Check if this feed is already in the tree QTreeWidgetItem *treeFeedItem = nullptr; for (int i = 0; i < m_ui->treeMatchingArticles->topLevelItemCount(); ++i) { QTreeWidgetItem *item = m_ui->treeMatchingArticles->topLevelItem(i); if (item->data(0, Qt::UserRole).toString() == feed->url()) { treeFeedItem = item; break; } } // If there is none, create it if (!treeFeedItem) { treeFeedItem = new QTreeWidgetItem(QStringList() << feed->name()); treeFeedItem->setToolTip(0, feed->name()); QFont f = treeFeedItem->font(0); f.setBold(true); treeFeedItem->setFont(0, f); treeFeedItem->setData(0, Qt::DecorationRole, GuiIconProvider::instance()->getIcon("inode-directory")); treeFeedItem->setData(0, Qt::UserRole, feed->url()); m_ui->treeMatchingArticles->addTopLevelItem(treeFeedItem); } // Insert the articles for (const QString &article : articles) { QPair<QString, QString> key(feed->name(), article); if (!m_treeListEntries.contains(key)) { m_treeListEntries << key; QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() << article); item->setToolTip(0, article); treeFeedItem->addChild(item); } } m_ui->treeMatchingArticles->expandItem(treeFeedItem); m_ui->treeMatchingArticles->sortItems(0, Qt::AscendingOrder); m_ui->treeMatchingArticles->setSortingEnabled(true); }
void LFileDialog::generateAppList(bool shownetwork){ //Now load the preferred applications PREFAPPS = getPreferredApplications(); ui->combo_rec->clear(); //Now get the application mimetype for the file extension (if available) QString mimetype = fileEXT; //Now add all the detected applications QHash< QString, QList<XDGDesktop> > hash = LXDG::sortDesktopCats( LXDG::systemDesktopFiles() ); QStringList cat = hash.keys(); cat.sort(); //sort alphabetically ui->tree_apps->clear(); for(int c=0; c<cat.length(); c++){ QList<XDGDesktop> app = hash[cat[c]]; QTreeWidgetItem *ci = new QTreeWidgetItem(ui->tree_apps, QStringList() << translateCat(cat[c])); for(int a=0; a<app.length(); a++){ if(shownetwork && (cat[c].toLower()=="network" || cat[c].toLower()=="utility") ){ //Need to show preferred internet applications - look for ones that handle URL's if(app[a].exec.contains("%u") || app[a].exec.contains("%U")){ PREFAPPS << app[a].filePath; } } QTreeWidgetItem *ti = new QTreeWidgetItem(ci, QStringList() << app[a].name); ti->setWhatsThis(0, app[a].filePath); ti->setIcon(0, LXDG::findIcon(app[a].icon, "application-x-desktop")); ti->setToolTip(0, app[a].comment); ci->addChild(ti); //Check to see if this app matches the mime type if(app[a].mimeList.contains(mimetype) && !mimetype.isEmpty()){ // also put this app in the preferred list PREFAPPS.append(app[a].filePath); } } ui->tree_apps->addTopLevelItem(ci); } //Now add all the preferred applications PREFAPPS.removeDuplicates(); for(int i=0; i<PREFAPPS.length(); i++){ bool ok = false; XDGDesktop dFile = LXDG::loadDesktopFile(PREFAPPS[i], ok); if( LXDG::checkValidity(dFile) && ok ){ ui->combo_rec->addItem( LXDG::findIcon(dFile.icon, "application-x-desktop"), dFile.name); if(i==0){ ui->combo_rec->setCurrentIndex(0); } //make sure the first item is selected }else{ PREFAPPS.removeAt(i); //invalid app i--; } } //Update the UI if(PREFAPPS.isEmpty()){ ui->radio_rec->setEnabled(false); //no preferred apps ui->radio_avail->setChecked(true); }else{ ui->radio_rec->setChecked(true); } }
void VarUnit::buildVarTree( QTreeWidgetItem * p, TVar * var, bool showHidden ){ QList< QTreeWidgetItem * > cList; QListIterator<TVar *> it(var->getChildren(1)); while(it.hasNext()){ TVar * child = it.next(); if ( showHidden || !isHidden( child ) ){ QStringList s1; s1 << child->getName(); QTreeWidgetItem * pItem = new QTreeWidgetItem(s1); pItem->setText( 0, child->getName() ); pItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsTristate|Qt::ItemIsUserCheckable); pItem->setToolTip(0, "Checked variables will be saved and loaded with your profile."); pItem->setCheckState(0, Qt::Unchecked); if ( isSaved( child ) ) pItem->setCheckState(0, Qt::Checked); if ( ! shouldSave( child ) ){ // 6 is lua_tfunction, parent must be saveable as well if not global pItem->setFlags(pItem->flags() & ~(Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable)); pItem->setForeground(0, QBrush(QColor("grey"))); pItem->setToolTip(0, ""); } pItem->setData( 0, Qt::UserRole, child->getValueType() ); QIcon icon; switch (child->getValueType()){ case 5: icon.addPixmap( QPixmap( QStringLiteral( ":/icons/table.png" ) ), QIcon::Normal, QIcon::Off ); break; case 6: icon.addPixmap( QPixmap( QStringLiteral( ":/icons/function.png" ) ), QIcon::Normal, QIcon::Off ); break; default: icon.addPixmap( QPixmap( QStringLiteral( ":/icons/variable.png" ) ), QIcon::Normal, QIcon::Off ); break; } pItem->setIcon( 0, icon ); wVars.insert( pItem, child ); cList.append( pItem ); if ( child->getValueType() == 5 ) buildVarTree( (QTreeWidgetItem *)pItem, child, showHidden ); } } p->addChildren( cList ); }
QTreeWidgetItem* VideoEditorWidget::addimageitem(int imagecount,const sensor_msgs::Image& image) { QTreeWidgetItem * item; item = new QTreeWidgetItem(); item->setText(0,"Image"+QString::number(imagecount)); item->setText(1,timeFromMsg(image.header.stamp)); item->setToolTip(1,QString::number((int)image.header.stamp.toSec())); ui->treeWidget->insertTopLevelItem(0,item); return item; }
void Cookie::on_CopyToCustomCookieRules_pushButton_clicked() { qDebug() << __PRETTY_FUNCTION__ << " called ..."; MyTreeWidget* widget = qobject_cast<MyTreeWidget*>(this->ui->CookieList_stackedWidget->currentWidget()); if(widget) { if(widget->topLevelItemCount() > 0) { QList<QTreeWidgetItem*> items = widget->selectedItems(); /* Copy only selected cookies to custom cookie rule. * Otherwise, copy all */ if(items.count() > 0){ /* First, remove duplicates from source */ QSet<QStringList> cookiesFrom; register size_t n = items.count(); for(register unsigned int i = 0;i < n;++i) { QStringList data; data << items.at(i)->text(1) << items.at(i)->text(2) << items.at(i)->text(3) << items.at(i)->text(4).replace(QRegularExpression(QLatin1String("(^.[^=]*=)(.*)")),QLatin1String("\\1.*")); cookiesFrom.insert(data); } /* Then make a target to compare to. Also remove duplicates althought there should be any. (Not possible for user to enter duplicate) */ QSet<QStringList> cookiesTo; register size_t n2 = this->ui->CustomCookieRules_treeWidget->topLevelItemCount(); for(register unsigned int i = 0;i < n2;++i) { QStringList data; QTreeWidgetItem* item = this->ui->CustomCookieRules_treeWidget->topLevelItem(i); data << item->text(0) << item->text(1) << item->text(2) << item->text(3).replace(QRegularExpression(QLatin1String("(^.[^=]*=)(.*)")),QLatin1String("\\1.*")); cookiesTo.insert(data); } /* Now, iterate throught cookiesFrom set and any item that is not * contained in cookiesTo set is inserted to CustomCookie_treeWidget */ foreach(const QStringList& data,cookiesFrom) { if(!cookiesTo.contains(data)) { QTreeWidgetItem* item = new QTreeWidgetItem(this->ui->CustomCookieRules_treeWidget); item->setText(0,data.at(0)); // Action item->setToolTip(0,data.at(0)); QString domain = data.at(1); domain.replace(QLatin1String("."),QLatin1String("\\.")); item->setText(1,domain); // Domain item->setText(2,data.at(2)); // Path item->setText(3,data.at(3)); // Name-Value item->setFlags(item->flags() | Qt::ItemIsEditable); this->ui->CustomCookieRules_treeWidget->addTopLevelItem(item); this->ui->CustomCookieRules_treeWidget->resizeColumnToContents(3); } } } else {