本文整理汇总了C++中QTreeWidgetItem::setToolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setToolTip方法的具体用法?C++ QTreeWidgetItem::setToolTip怎么用?C++ QTreeWidgetItem::setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setToolTip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addError
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);
}
示例2: prefs_modules_foreach_submodules
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;
}
示例3: visit
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);
}
示例4: setAreaWidget
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);
}
示例5: findShapes
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);
}
}
}
示例6: findShapes
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);
}
}
}
示例7: loadFileBrowser
/*
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);
}
示例8: addMusicToList
//添加音乐
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);
}
示例9: findShapes
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);
}
}
}
示例10: populateDiskTree
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();
}
示例11: on_mColorInterpolationComboBox_currentIndexChanged
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();
}
示例12: addHistoryItems
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);
}
}
}
示例13: onModifyMacroAction
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;
}
}
}
}
示例14: childAt
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;
}
示例15: setEditors
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;
}
}