当前位置: 首页>>代码示例>>C++>>正文


C++ QStandardItem::setToolTip方法代码示例

本文整理汇总了C++中QStandardItem::setToolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItem::setToolTip方法的具体用法?C++ QStandardItem::setToolTip怎么用?C++ QStandardItem::setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStandardItem的用法示例。


在下文中一共展示了QStandardItem::setToolTip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateBlogListOther

void BlogsDialog::updateBlogListOther(std::list<std::string> &ids)
{
	std::list<std::string>::iterator iit;

	/* remove rows with groups before adding new ones */
	model->item(OTHER)->removeRows(0, model->item(OTHER)->rowCount());

	for (iit = ids.begin(); iit != ids.end(); iit ++) {
#ifdef BLOG_DEBUG
		std::cerr << "BlogsDialog::updateBlogListOther(): " << *iit << std::endl;
#endif
		QStandardItem *ownGroup = model->item(OTHER);
		QList<QStandardItem *> blog;
		QStandardItem *blogNameitem = new QStandardItem();
		QStandardItem *blogIditem = new QStandardItem();

		BlogInfo bi;
		if (rsBlogs && rsBlogs->getBlogInfo(*iit, bi)) {
			blogNameitem->setData(QVariant(QString::fromStdWString(bi.blogName)), Qt::DisplayRole);
			blogIditem->setData(QVariant(QString::fromStdString(bi.blogId)), Qt::DisplayRole);
			blogNameitem->setToolTip(tr("Popularity: %1\nFetches: %2\nAvailable: %3"
					).arg(QString::number(bi.pop)).arg(9999).arg(9999));
		} else {
			blogNameitem->setData(QVariant(QString("Unknown Blog")), Qt::DisplayRole);
			blogIditem->setData(QVariant(QString::fromStdString(*iit)), Qt::DisplayRole);
			blogNameitem->setToolTip("Unknown Blog\nNo Description");
		}

		blog.append(blogNameitem);
		blog.append(blogIditem);
		ownGroup->appendRow(blog);
	}
}
开发者ID:RedCraig,项目名称:retroshare,代码行数:33,代码来源:BlogsDialog.cpp

示例2: populateTable

void RouteMapDock::populateTable(int /*flag*/)/*{{{*/
{
	_listModel->clear();
	QDir routes;
	routes.setFilter(QDir::Files | QDir::NoSymLinks);
	if(!routes.cd(routePath))
		return;
	QFileInfoList files = routes.entryInfoList();
	for(int it = 0; it < files.size(); ++it)
	{
		QFileInfo f = files.at(it);
		QString note = oom->noteForRouteMapping(f.filePath());
		QList<QStandardItem*> rowData;
		QStandardItem *chk = new QStandardItem(f.filePath());
		QStandardItem *tname = new QStandardItem(f.baseName());
		tname->setToolTip(note);
		chk->setToolTip(note);
		rowData.append(chk);
		rowData.append(tname);
		_listModel->blockSignals(true);
		_listModel->insertRow(_listModel->rowCount(), rowData);
		_listModel->blockSignals(false);
		routeList->setRowHeight(_listModel->rowCount(), 25);
	}
	updateTableHeader();
	//routeList->resizeRowsToContents();
}/*}}}*/
开发者ID:87maxi,项目名称:oom,代码行数:27,代码来源:rmap.cpp

示例3: if

QStandardItem *FlagColumn::build_cell(Dwarf *d) {
        QStandardItem *item = init_cell(d);

        item->setData(CT_FLAGS, DwarfModel::DR_COL_TYPE);
        item->setData(false,DwarfModel::DR_SPECIAL_FLAG); //default

        short rating = 0;
        if(d->get_flag_value(m_bit_pos))
            rating = 1;      
        //check to fix butchering pets. currently this will cause the butchered parts to still be recognized as a pet
        //and they'll put them into a burial recepticle, but won't use them as a food source
        if(m_bit_pos == 49){
            if(d->is_pet()){
                item->setToolTip(tr("<b>Please turn off pet availability first.</b><br/><br/>Sorry, pets cannot be butchered due to technical limitations!"));
                item->setData(QBrush(QColor(187,34,34,200)),Qt::BackgroundColorRole);
                item->setData(true,DwarfModel::DR_SPECIAL_FLAG); //indicates that the cell is disabled
                rating = -1;
            }else if(!d->get_caste()->can_butcher()){
                item->setToolTip(tr("<b>This creature cannot be butchered!</b>"));
                item->setData(QBrush(QColor(187,34,34,200)),Qt::BackgroundColorRole);
                item->setData(true,DwarfModel::DR_SPECIAL_FLAG); //indicates that the cell is disabled
                rating = -1;
            }

        }

        item->setData(rating, DwarfModel::DR_SORT_VALUE);
        item->setData(m_bit_pos, DwarfModel::DR_LABOR_ID);
        item->setData(m_set->name(), DwarfModel::DR_SET_NAME);
        return item;
}
开发者ID:Cerbsen,项目名称:Dwarf-Therapist,代码行数:31,代码来源:flagcolumn.cpp

示例4: fillModel

void SoundThemeSelector::fillModel(const SoundTheme &theme)
{
	QStringList headers;
	headers.append(QT_TRANSLATE_NOOP("Notifications", "Type"));
	headers.append(QT_TRANSLATE_NOOP("SoundTheme", "Preview"));
	m_model->setHorizontalHeaderLabels(headers);

	for (int i = 0; i <= Notification::LastType; ++i) {
		Notification::Type type = static_cast<Notification::Type>(i);
		QList<QStandardItem *> items;

		QStandardItem *item = new QStandardItem(Notification::typeString(type));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Type"));
		item->setSelectable(false);
		items << item;

		item = new QStandardItem();
		item->setEditable(false);
		item->setIcon(Icon("media-playback-start"));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Play"));
		item->setEnabled(!theme.path(type).isNull());
		item->setSelectable(false);
		items << item;

		m_model->appendRow(items);
	}
	ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
}
开发者ID:Anderty,项目名称:qutim,代码行数:28,代码来源:soundthemeselector.cpp

示例5: addDocument

// private slot
void FilesWidget::addDocument(Document *document)
{
    Q_ASSERT(document != NULL);
    Q_ASSERT(document != DocumentManager::current());

    const Location &location = document->location();
    const QString &filePath = location.filePath("unnamed");
    const QString &directoryPath = location.directoryPath("unnamed");
    const QString &fileName = location.fileName("unnamed");

    // Find or create parent item
    const QModelIndexList &parents = m_model.match(m_model.index(0, 0, QModelIndex()), DirectoryPathRole,
                                                   directoryPath, 1, Qt::MatchExactly);
    QStandardItem *parent;

    if (parents.isEmpty()) {
        parent = new QStandardItem(QIcon(":/icons/16x16/folder.png"), directoryPath);

        parent->setToolTip(directoryPath);
        parent->setData(directoryPath, DirectoryPathRole);
        parent->setData(location.isEmpty() ? "" : directoryPath.toLower(), LowerCaseNameRole);

        m_model.appendRow(parent);
        m_model.sort(0);
    } else {
        parent = m_model.itemFromIndex(parents.first());
    }

    // Create child item
    QStandardItem *child = new QStandardItem(QIcon(":/icons/16x16/file.png"), fileName);

    child->setToolTip(filePath);
    child->setData(qVariantFromValue((void *)document), DocumentPointerRole);
    child->setData(fileName, FileNameRole);
    child->setData(location.isEmpty() ? "" : fileName.toLower(), LowerCaseNameRole);

    m_children.insert(document, child);

    parent->appendRow(child);
    parent->sortChildren(0);

    connect(document, &Document::locationChanged, this, &FilesWidget::updateLocationOfSender);
    connect(document, &Document::modificationChanged, this, &FilesWidget::updateModificationMarkerOfSender);

    // Apply current filter
    if (!filterAcceptsChild(child->index())) {
        m_treeFiles->setRowHidden(child->row(), parent->index(), true);

        if (parent->rowCount() == 1) {
            m_treeFiles->setRowHidden(parent->row(), m_model.invisibleRootItem()->index(), true);
        }
    }

    // Show modification marker, if necessary
    updateModificationMarker(document);
    updateParentItemMarkers(parent);
}
开发者ID:photron,项目名称:zero-editor,代码行数:58,代码来源:fileswidget.cpp

示例6: setData

bool QgsPgTableModel::setData( const QModelIndex &idx, const QVariant &value, int role )
{
  if ( !QStandardItemModel::setData( idx, value, role ) )
    return false;

  if ( idx.column() == dbtmType || idx.column() == dbtmSrid || idx.column() == dbtmPkCol )
  {
    QGis::WkbType wkbType = ( QGis::WkbType ) idx.sibling( idx.row(), dbtmType ).data( Qt::UserRole + 2 ).toInt();

    QString tip;
    if ( wkbType == QGis::WKBUnknown )
    {
      tip = tr( "Specify a geometry type" );
    }
    else if ( wkbType != QGis::WKBNoGeometry )
    {
      bool ok;
      int srid = idx.sibling( idx.row(), dbtmSrid ).data().toInt( &ok );

      if ( !ok || srid == INT_MIN )
        tip = tr( "Enter a SRID" );
    }

    QStringList pkCols = idx.sibling( idx.row(), dbtmPkCol ).data( Qt::UserRole + 1 ).toStringList();
    if ( tip.isEmpty() && pkCols.size() > 0 )
    {
      if ( !pkCols.contains( idx.sibling( idx.row(), dbtmPkCol ).data().toString() ) )
        tip = tr( "Select a primary key" );
    }

    for ( int i = 0; i < dbtmColumns; i++ )
    {
      QStandardItem *item = itemFromIndex( idx.sibling( idx.row(), i ) );
      if ( tip.isEmpty() )
      {
        item->setFlags( item->flags() | Qt::ItemIsSelectable | Qt::ItemIsEnabled );
        item->setToolTip( "" );
      }
      else
      {
        item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
        if ( i == dbtmSchema || i == dbtmTable || i == dbtmGeomCol )
        {
          item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
          item->setToolTip( tip );
        }
      }
    }
  }

  return true;
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:52,代码来源:qgspgtablemodel.cpp

示例7: setData

bool QgsOracleTableModel::setData( const QModelIndex &idx, const QVariant &value, int role )
{
  if ( !QStandardItemModel::setData( idx, value, role ) )
    return false;

  if ( idx.column() == DbtmType || idx.column() == DbtmSrid || idx.column() == DbtmPkCol )
  {
    QgsWkbTypes::Type wkbType = ( QgsWkbTypes::Type ) idx.sibling( idx.row(), DbtmType ).data( Qt::UserRole + 2 ).toInt();

    QString tip;
    if ( wkbType == QgsWkbTypes::Unknown )
    {
      tip = tr( "Specify a geometry type" );
    }
    else if ( wkbType != QgsWkbTypes::NoGeometry )
    {
      bool ok;
      int srid = idx.sibling( idx.row(), DbtmSrid ).data().toInt( &ok );

      if ( !ok || srid == 0 )
        tip = tr( "Enter a SRID" );
    }

    if ( tip.isEmpty() && idx.sibling( idx.row(), DbtmPkCol ).data( Qt::UserRole + 1 ).toBool() )
    {
      if ( !idx.sibling( idx.row(), DbtmPkCol ).data( Qt::UserRole + 2 ).toBool() )
        tip = tr( "Select a primary key" );
    }

    for ( int i = 0; i < DbtmColumns; i++ )
    {
      QStandardItem *item = itemFromIndex( idx.sibling( idx.row(), i ) );
      if ( tip.isEmpty() )
      {
        item->setFlags( item->flags() | Qt::ItemIsSelectable | Qt::ItemIsEnabled );
        item->setToolTip( "" );
      }
      else
      {
        item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
        if ( i == DbtmOwner || i == DbtmTable || i == DbtmGeomCol )
        {
          item->setFlags( item->flags() & ~Qt::ItemIsEnabled );
          item->setToolTip( tip );
        }
      }
    }
  }

  return true;
}
开发者ID:wongjimsan,项目名称:QGIS,代码行数:51,代码来源:qgsoracletablemodel.cpp

示例8: QStandardItem

void repo::gui::RepoFederationDialog::addAvailableProject(const QString &project)
{
    QStandardItem *item = new QStandardItem(project);
    item->setEditable(false);
    item->setToolTip(project);
    ui->availableWidget->addTopLevelRow(item);
}
开发者ID:jmbertinat,项目名称:3drepogui,代码行数:7,代码来源:repofederationdialog.cpp

示例9: QColor

QStandardItem *EquipmentColumn::build_cell(Dwarf *d){
    QStandardItem *item = init_cell(d);

    QColor rating_color = QColor(69,148,21);
    float rating =  d->get_uniform_rating();
    float coverage = d->get_coverage_rating();

    if(coverage < 100){ //prioritize coverage
        rating = coverage;
        rating_color = Item::color_uncovered();
    }else{
        if(rating < 100) //missing uniform items
            rating_color = Item::color_missing();
    }

    float sort_val = rating - d->get_inventory_wear();
    item->setData(d->get_inventory_wear(),DwarfModel::DR_SPECIAL_FLAG);
    item->setBackground(QBrush(rating_color));
    item->setData(CT_EQUIPMENT, DwarfModel::DR_COL_TYPE);
    item->setData(rating, DwarfModel::DR_RATING); //other drawing 0-100
    item->setData(sort_val, DwarfModel::DR_SORT_VALUE);
    set_export_role(DwarfModel::DR_RATING);

    QString tooltip = QString("<center><h3>%1</h3></center>%2%3")
            .arg(m_title)
            .arg(build_tooltip_desc(d))
            .arg(tooltip_name_footer(d));

    item->setToolTip(tooltip);
    return item;
}
开发者ID:perturbation,项目名称:Dwarf-Therapist,代码行数:31,代码来源:equipmentcolumn.cpp

示例10: QDockWidget

RecentDock::RecentDock(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::RecentDock)
{
    LOG_DEBUG() << "begin";
    ui->setupUi(this);
    toggleViewAction()->setIcon(windowIcon());
    m_recent = Settings.recent();

#ifdef Q_OS_WIN
    // Remove bad entries on Windows due to bug in v17.01.
    QStringList newList;
    bool isRepaired = false;
    foreach (QString s, m_recent) {
        if (s.size() >=3 && s[0] == '/' && s[2] == ':') {
            s.remove(0, 1);
            isRepaired = true;
        }
        newList << s;
    }
    if (isRepaired) {
        m_recent = newList;
        Settings.setRecent(m_recent);
        Settings.sync();
    }
#endif

    ui->listWidget->setDragEnabled(true);
    ui->listWidget->setDragDropMode(QAbstractItemView::DragOnly);
    foreach (QString s, m_recent) {
        QStandardItem* item = new QStandardItem(Util::baseName(s));
        item->setToolTip(QDir::toNativeSeparators(s));
        m_model.appendRow(item);
    }
开发者ID:mltframework,项目名称:shotcut,代码行数:34,代码来源:recentdock.cpp

示例11: populatePatchModel

void SynthPluginDevice::populatePatchModel(QStandardItemModel* model, int, MType, bool)
{
	if(debugMsg)
    	qWarning("SynthPluginDevice::populatePatchModel();");
    model->clear();

    if (m_plugin)
    {
        QStandardItem* root = model->invisibleRootItem();

        for (uint32_t i=0; i < m_plugin->getProgramCount(); i++)
        {
            QList<QStandardItem*> row;
            QString strId = QString::number(i);
            QStandardItem* idItem = new QStandardItem(strId);
            QStandardItem* nItem = new QStandardItem(m_plugin->getProgramName(i));
            nItem->setToolTip(m_plugin->getProgramName(i));
            row.append(nItem);
            row.append(idItem);
            root->appendRow(row);
            //QAction *act = menu->addAction(QString(mp->name));
            //act->setData(id);
            //mp = _mess->getPatchInfo(ch, mp);
        }
    }
}
开发者ID:87maxi,项目名称:oom,代码行数:26,代码来源:plugin.cpp

示例12: addProject

void ProjectChangesModel::addProject(IProject* p)
{
    QStandardItem* it = new QStandardItem(p->name());
    it->setData(p->name(), ProjectChangesModel::ProjectNameRole);
    IPlugin* plugin = p->versionControlPlugin();
    if(plugin) {
        IBasicVersionControl* vcs = plugin->extension<IBasicVersionControl>();

        auto info = ICore::self()->pluginController()->pluginInfo(plugin);

        it->setIcon(QIcon::fromTheme(info.iconName()));
        it->setToolTip(vcs->name());

        IBranchingVersionControl* branchingExtension = plugin->extension<KDevelop::IBranchingVersionControl>();
        if(branchingExtension) {
            const auto pathUrl = p->path().toUrl();
            branchingExtension->registerRepositoryForCurrentBranchChanges(pathUrl);
            // can't use new signal slot syntax here, IBranchingVersionControl is not a QObject
            connect(plugin, SIGNAL(repositoryBranchChanged(QUrl)), this, SLOT(repositoryBranchChanged(QUrl)));
            repositoryBranchChanged(pathUrl);
        } else
            reload(QList<IProject*>() << p);
    } else {
        it->setEnabled(false);
    }
    
    appendRow(it);
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:28,代码来源:projectchangesmodel.cpp

示例13: findApiOut

void FindApiWidget::findApiOut(QString api, QString text, QStringList url)
{
    QStandardItem *item = new QStandardItem(api);
    item->setToolTip(text);
    item->setData(url,Qt::UserRole+1);
    m_model->appendRow(item);
}
开发者ID:AChinaProgrammer,项目名称:liteide,代码行数:7,代码来源:findapiwidget.cpp

示例14: AddProgram

bool ProgramsModel::AddProgram(int groupNum, QModelIndex &index, int row)
{
    QStandardItem *groupItem = item(groupNum);

    //if the group was disabled re-enable it
    if(groupItem->rowCount()==0) {
        groupItem->setBackground(Qt::transparent);
        groupItem->setToolTip("");
    }

    int progId = myHost->programsModel->GetNextProgId();

    QString name("New prog");

    //create the program item
    QStandardItem *prgItem = new QStandardItem( name );
    prgItem->setData(ProgramNode,NodeType);
    prgItem->setData(progId,ProgramId);
#ifndef QT_NO_DEBUG
    prgItem->setData(progId,Qt::ToolTipRole);
#endif
    prgItem->setDragEnabled(true);
    prgItem->setDropEnabled(false);
    prgItem->setEditable(true);

    if(row==-1)
        row=groupItem->rowCount();
    groupItem->insertRow(row, prgItem);

    index = prgItem->index();

//    ValidateProgChange(index);

    return true;
}
开发者ID:eriser,项目名称:vstboard-1,代码行数:35,代码来源:programsmodel.cpp

示例15: resetModel

 void resetModel()
 {
     q->clear();
     QFont bold;
     bold.setBold(true);
     // Create one item for each day of week
     for(int day = Qt::Monday; day <= Qt::Sunday; ++day) {
         QStandardItem *dayItem = new QStandardItem(QDate::longDayName(day));
         dayItem->setFont(bold);
         dayItem->setData(day, WeekDayRole);
         // Add availabilities to items
         const QVector<DayAvailability> &avail = m_UserCalendar->availabilities(day);
         for(int availabilityId = 0; availabilityId < avail.count(); ++availabilityId) {
             for(int timeRangeId = 0; timeRangeId < avail.at(availabilityId).timeRangeCount(); ++timeRangeId) {
                 TimeRange range = avail.at(availabilityId).timeRangeAt(timeRangeId);
                 QStandardItem *time = new QStandardItem(tkTr(Trans::Constants::FROM_1_TO_2).arg(range.from.toString()).arg(range.to.toString()));
                 time->setData(day, WeekDayRole);
                 time->setData(range.from, HourFromRole);
                 time->setData(range.to, HourToRole);
                 time->setData(timeRangeId, TimeRangeIdRole);
                 time->setData(availabilityId, AvailIdRole);
                 time->setToolTip(time->text());
                 dayItem->appendRow(time);
             }
         }
         if (dayItem->rowCount() > 0) {
             dayItem->sortChildren(0);
         }
         q->invisibleRootItem()->appendRow(dayItem);
     }
 }
开发者ID:Dinesh-Ramakrishnan,项目名称:freemedforms,代码行数:31,代码来源:dayavailability.cpp


注:本文中的QStandardItem::setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。