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


C++ QListWidgetItem::setStatusTip方法代码示例

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


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

示例1: insertItem

void MainWindow::insertItem()
{
    if (!listWidget->currentItem())
        return;

    QString itemText = QInputDialog::getText(this, tr("Insert Item"),
        tr("Input text for the new item:"));

    if (itemText.isNull())
        return;

//! [6]
    QListWidgetItem *newItem = new QListWidgetItem;
    newItem->setText(itemText);
//! [6]
    int row = listWidget->row(listWidget->currentItem());
//! [7]
    listWidget->insertItem(row, newItem);
//! [7]

    QString toolTipText = tr("Tooltip:") + itemText;
    QString statusTipText = tr("Status tip:") + itemText;
    QString whatsThisText = tr("What's This?:") + itemText;
//! [8]
    newItem->setToolTip(toolTipText);
    newItem->setStatusTip(toolTipText);
    newItem->setWhatsThis(whatsThisText);
//! [8]
}
开发者ID:bailsoftware,项目名称:qt-embedded,代码行数:29,代码来源:mainwindow.cpp

示例2: QListWidget

FunctionListWidget::FunctionListWidget(QWidget *parent)
  : QListWidget(parent)
{

  QString skeleton;
  QString statusTip;

  QHashIterator<enum FunctionNames, QString> i(presetFunctions.fcnNames());
  while (i.hasNext()) {

    i.next();
    QListWidgetItem *functionItem = new QListWidgetItem(this);
    functionItem->setText(i.value());
    skeleton = presetFunctions.fcnSkeleton(i.key());
    statusTip = presetFunctions.fcnStatusTip(i.key());
    functionItem->setStatusTip(skeleton + statusTip);
    functionItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

  }

  sortItems();
  setMouseTracking(true);

  // add connections
  connect(this, SIGNAL(itemActivated(QListWidgetItem*)),
          this, SLOT(itemSkeleton(QListWidgetItem*)));

}
开发者ID:clay-matt,项目名称:Fn,代码行数:28,代码来源:FunctionListWidget.cpp

示例3: addProcessItem

void IPProcessList::addProcessItem(QString processID, QString text, QString keywords, IPLProcess::IPLProcessCategory category)
{
    // load icon from png file and add background color based on the process category

    QFileInfo iconFile(_mainWindow->processIconPath(processID));

    if(!iconFile.exists())
    {
        iconFile = QFileInfo(_mainWindow->processIconPath("Plugin"));
    }

    QPixmap transparentIcon(iconFile.absoluteFilePath());
    QPixmap finalIcon(25,25);

    QPainter painter(&finalIcon);
    painter.fillRect(0,0,25,25,_categoryColors.at(category));
    painter.drawPixmap(0,0,25,25,transparentIcon);

    QListWidgetItem* newItem = new QListWidgetItem(finalIcon, text);
    newItem->setToolTip(processID);
    newItem->setStatusTip(keywords);
    newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);

    addItem(newItem);
}
开发者ID:MazharLakhani,项目名称:ImagePlay,代码行数:25,代码来源:IPProcessList.cpp

示例4: prepareView

//----------------------------------------------------------------------------------------
void ZoneListWidget::prepareView()
{
    _createImages(mIcons);

    listWidget->clear();

    Ogre::String filename;
    Ogre::String itemname;
    ImageMap::iterator it = mIcons.begin();

    ModularZoneFactory* factory = dynamic_cast<ModularZoneFactory*>(OgitorsRoot::getSingletonPtr()->GetEditorObjectFactory("Modular Zone Object"));
    if(!factory)return;

    while(it != mIcons.end())
    {

        QImage pImg(it->second, 96, 96, QImage::Format_ARGB32);
        QPixmap pmap = QPixmap::fromImage(pImg);
        QListWidgetItem *item = new QListWidgetItem(QIcon(pmap),(factory->getZoneTemplate(it->first))->mName.c_str() , listWidget);
        item->setData(Qt::UserRole,QVariant(it->first));//key to ZoneTemplatesMap
        item->setToolTip((factory->getZoneTemplate(it->first))->mShortDesc.c_str());// a short description of the zone
        item->setStatusTip((factory->getZoneTemplate(it->first))->mLongDesc.c_str());//a detailed description

        listWidget->addItem(item);
        delete [] it->second;
        it++;
    }
    mIcons.clear();
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:30,代码来源:ZoneListWidget.cpp

示例5: addItemFromNet

//添加网络item
int PlaylistWindow::addItemFromNet(const QString &additem, const QString &link,int id, bool playNow)
{

    QListWidgetItem *item = new QListWidgetItem(additem,listWidget);
    int row = listWidget->row(item);
    //添加索引字符
    QString index = "";
    if(row<9) {
        index.append("0").append(QString::number(row+1,10).append(". "));
    } else {
          index = QString::number(row+1,10).append(". ");
    }
    item->setText(index.append(item->text()));
    //设置item高度
    item->setSizeHint(QSize(100,30));
    item->setIcon(QIcon(":/image/net.ico"));
    item->setWhatsThis(QString::number(id,10));
    item->setToolTip(additem);
    //设置media的类型
    item->setStatusTip(QString::number(MEDIA_TYPE_MUSIC,10));
    this->setItemNormalView(item);

    //添加到playlist 并将第一条设置为当前播放item
    playlist->addMedia(QUrl(link));
//	this->setItemPlay(row);
	if (playNow){
		this->doubleClicked = false;
		playlist->setCurrentIndex(row);
	}
    //qDebug("%d",playlist->currentIndex());
    return MEDIA_TYPE_MUSIC;

}
开发者ID:macinchang,项目名称:NoPlayer,代码行数:34,代码来源:playlistwindow.cpp

示例6: addItemFromLocal

//从本地添加items
int PlaylistWindow::addItemFromLocal(const QStringList &addList,bool playNow)
{

    int mediaType;
    bool flag=true;
    for(int i=0;i<addList.length();i++) {

        QString label = addList.at(i);
        QFileInfo fileInfo(label);
        if(fileInfo.exists()) {
            QStringList list = label.split("/");
            QListWidgetItem *item = new QListWidgetItem(list.last(),listWidget);
            int row = listWidget->row(item);

            //添加索引字符
            QString index = "";
            if(row<9) {
                index.append("0").append(QString::number(row+1,10).append(". "));
            } else {
                  index = QString::number(row+1,10).append(". ");
            }
            item->setText(index.append(item->text()));
            //设置item高度
            item->setSizeHint(QSize(100,30));
            item->setToolTip(label);
            //设置media的类型
            int type = getMediaType(label);

            if(type != -1){
                if(type == MEDIA_TYPE_MUSIC){
                    item->setIcon(QIcon(":/image/music.gif"));
                }
                else{
                    item->setIcon(QIcon(":/image/video.ico"));
                }
                item->setStatusTip(QString::number(type,10));
            }
            this->setItemNormalView(item);
            //添加到playlist 并将第一条设置为当前播放item
			qDebug() << playlist->mediaCount();
            playlist->addMedia(QUrl::fromLocalFile(label));
            if(flag){
                flag=false;
                mediaType = type;
                if(playNow){
                    //this->setItemPlay(row);
					playlist->setCurrentIndex(row);

                }else{
                    listWidget->setCurrentItem(item);
                }
            }
        } else {
            continue;
        }
    }

	return mediaType;
}
开发者ID:macinchang,项目名称:NoPlayer,代码行数:60,代码来源:playlistwindow.cpp

示例7: updateZoneInfo

//----------------------------------------------------------------------------------------
void ZoneListWidget::updateZoneInfo(int key)
{
    //TODO: there's gotta be a better way to do this...

    //update zone description
    ModularZoneFactory* factory = dynamic_cast<ModularZoneFactory*>(OgitorsRoot::getSingletonPtr()->GetEditorObjectFactory("Modular Zone Object"));
    if(!factory)return;
    ZoneInfo* zone = factory->getZoneTemplate(key);

    for(int i=0;i<listWidget->count();i++)
    {
        QListWidgetItem *item = listWidget->item(i);
        if(item->data(Qt::UserRole).toInt()==key)
        {
            item->setToolTip(zone->mShortDesc.c_str());// a short description of the zone
            item->setStatusTip(zone->mLongDesc.c_str());//a detailed description
        }
    }
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:20,代码来源:ZoneListWidget.cpp

示例8: addZone

//----------------------------------------------------------------------------------------
void ZoneListWidget::addZone(int key)
{
    ModularZoneFactory* factory = dynamic_cast<ModularZoneFactory*>(OgitorsRoot::getSingletonPtr()->GetEditorObjectFactory("Modular Zone Object"));
    if(!factory)return;
    ZoneInfo* zone = factory->getZoneTemplate(key);
    if(zone)
    {

#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
        QIcon icon("/usr/share/qtOgitor/Plugins/Icons/zone.svg");
#else
        QIcon icon("../Plugins/Icons/zone.svg");
#endif
        QListWidgetItem *item = new QListWidgetItem(icon,zone->mName.c_str() , listWidget);
        item->setData(Qt::UserRole,QVariant(key));//key to ZoneTemplatesMap
        item->setToolTip(zone->mShortDesc.c_str());// a short description of the zone
        item->setStatusTip(zone->mLongDesc.c_str());//a detailed description

        listWidget->addItem(item);
    }
}
开发者ID:ZelconGames,项目名称:Ogitor-Facade,代码行数:22,代码来源:ZoneListWidget.cpp

示例9: sipReleaseType

static PyObject *meth_QListWidgetItem_setStatusTip(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        const QString* a0;
        int a0State = 0;
        QListWidgetItem *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QListWidgetItem, &sipCpp, sipType_QString,&a0, &a0State))
        {
            sipCpp->setStatusTip(*a0);
            sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QListWidgetItem, sipName_setStatusTip, doc_QListWidgetItem_setStatusTip);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:24,代码来源:sipQtWidgetsQListWidgetItem.cpp

示例10: LoadDir


//.........这里部分代码省略.........
  /*QTimer updatetime;
    updatetime.setInterval(1000); //1 second updates
    updatetime.setSingleShot(true);
    updatetime.start();*/
  QTime updatetime = QTime::currentTime().addMSecs(500);
  if(DEBUG){ qDebug() << "Start Loop over items:" << time.elapsed(); }
  for(int i=0; i<list.length(); i++){
    if(stopload){ ui->actionStopLoad->setVisible(false); return; } //stop right now
    if(!hasimages && list[i].isImage()){ hasimages = true;  ui->tool_goToImages->setVisible(true); }
    else if(!hasmultimedia && list[i].isAVFile()){ hasmultimedia = true;  ui->tool_goToPlayer->setVisible(true); }
    //Update statistics
    if(list[i].isDir()){ numdirs++; }
    else{ filebytes += list[i].size(); }
    watcher->addPath(list[i].absoluteFilePath());
    if(showDetails){
      //Now create all the individual items for the details tree
      CQTreeWidgetItem *it;
      bool addnew = false;
	//See if an item already exists for this file
	QList<QTreeWidgetItem*> items = treeWidget->findItems(list[i].fileName(),Qt::MatchExactly,0); //NOTE: This requires column 0 to be the name
	if(items.isEmpty()){
        it = new CQTreeWidgetItem();
	    addnew = true;
	}else{
        // Safe downcasting because CQTreeWidgetItem only redefines the virtual function bool opearot<. Not new methos added.
        it = static_cast<CQTreeWidgetItem *> (items.first());
	}
	//Now update the entry contents
	it->setWhatsThis(0, QString(canmodify ? "cut": "copy")+"::::"+list[i].absoluteFilePath());
      for(int t=0; t<listDetails.length(); t++){
        switch(listDetails[t]){
	  case NAME:
	    it->setText(t,list[i].fileName());
	    it->setStatusTip(t, list[i].fileName());
	      //Since the icon/image is based on the filename - only update this for a new item
	      // (This is the slowest part of the routine)
	      if(list[i].isImage()&& (addnew || updateThumbs)){
	        if(showThumbs){ 
		  it->setIcon(t, LXDG::findIcon("fileview-preview","image-x-generic") );
		  needThumbs << list[i].fileName();	
		}else{ it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"image-x-generic") ); }
	      }else if(addnew){
	        it->setIcon(t, LXDG::findIcon(list[i].iconfile(),"unknown") );
	      }
	    break;
	  case SIZE:
	    if(!list[i].isDir()){
	      it->setText(t, LUtils::BytesToDisplaySize(list[i].size()) );
	    }
	    break;
	  case TYPE:
	    it->setText(t, list[i].mimetype());
	    break;
      case DATEMOD:
        {
          QStringList datetime_format = getDateFormat();
          // Save datetime in WhatThis value. Lately will be used by CQTreeWidgetItem for sorting by date
          it->setWhatsThis(t, list[i].lastModified().toString("yyyyMMddhhmmsszzz"));
          // Default configurition. Fallback to Qt::DefaultLocaleShortDate for formats
          if(datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty())
            it->setText(t, list[i].lastModified().toString(Qt::DefaultLocaleShortDate) );
          // Date is setted but time not. Time goes to default
          else if(!datetime_format.at(0).isEmpty() && datetime_format.at(1).isEmpty())
            it->setText(t, list[i].lastModified().date().toString(datetime_format.at(0)) + " " + list[i].lastModified().time().toString(Qt::DefaultLocaleShortDate));
          // Time is setted but date not. Date goes to default
          else if(datetime_format.at(0).isEmpty() && !datetime_format.at(1).isEmpty())
开发者ID:abishai,项目名称:lumina,代码行数:67,代码来源:DirWidget.cpp

示例11: describePlanet

void Details :: describePlanet()
 {
  fileIndex = qBound(0, fileIndex, filesCount() - 1);

  bool exists = planet != A::Planet_None;
  positionLabel -> setVisible(exists);
  aspectsList   -> setVisible(exists);
  powerLabel    -> setVisible(exists);
  if (!exists) return;

  const A::Planet& p = file(fileIndex)->horoscope().planets[planet];


  QString powerText = A::describePowerInHtml(p, file(fileIndex)->horoscope());
  if (!powerText.isEmpty())
    powerText = "<p align='center'><b><i>" +
                QString("<font color='#71aeec' size='+2'>+%1</font> | "
                        "<font color='#dfb096' size='+2'>%2</font>")
                         .arg(p.power.dignity)
                         .arg(p.power.deficient) +
                "</i></b></p>" + powerText;

  positionLabel -> setText(A::describePlanetCoordInHtml(p));
  powerLabel    -> setText(powerText);


  aspectsList->clear();
  A::AspectList list;
  QString tag1, tag2;

  if (filesCount() == 1)
   {
    list = file()->horoscope().aspects;
    aspects->setTitle(tr("Aspects"));
   }
  else
   {
    list = calculateSynastryAspects();
    aspects->setTitle(tr("Synastry aspects"));
    tag1 = "#1";
    tag2 = "#2";
   }

  foreach (const A::Aspect& asp, list)
   {
    if (*asp.planet1 != p && *asp.planet2 != p) continue;

    QListWidgetItem* item = new QListWidgetItem;
    item->setIcon(QIcon(asp.d->userData["icon"].toString()));
    item->setText(A::describeAspect(asp));
    item->setToolTip(A::describeAspectFull(asp, tag1, tag2));
    item->setStatusTip(QString("%1+%2+%3").arg(asp.d->name)
                                          .arg(asp.planet1->name)
                                          .arg(asp.planet2->name));
    aspectsList->addItem(item);
   }

  QListWidgetItem* item = new QListWidgetItem("...");
  item->setToolTip(tr("more"));
  item->setWhatsThis("more");
  item->setTextAlignment(Qt::AlignCenter);
  aspectsList->addItem(item);

  if (expandedAspects)
    expandAspects();
  else
    updateListHeight(aspectsList);
 }
开发者ID:ChezRD,项目名称:zodiac,代码行数:68,代码来源:details.cpp


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