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


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

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


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

示例1: addCategoryItem

void MainWindow::addCategoryItem(int i)
{
    QLineEdit *le = new QLineEdit(this);
    le->setStatusTip(tr("Type a name for category %1").arg(i + 1));
    QPalette palette;
    palette.setColor(QPalette::Active, QPalette::Base, backgroundColourForCategory(i));
    palette.setColor(QPalette::Active, QPalette::Text, foregroundColourForCategory(i));
    palette.setColor(QPalette::Inactive, QPalette::Base, backgroundColourForCategory(i));
    palette.setColor(QPalette::Inactive, QPalette::Text, foregroundColourForCategory(i));
    le->setPalette(palette);
    EFCategoryLineEdit << le;
    QTreeWidgetItem *item = new QTreeWidgetItem(EFTreeWidget);
    item->setText(0, QString::number(i + 1));
    item->setCheckState(0, Qt::Unchecked);
    item->setStatusTip(0, tr("Check or uncheck this checkbox to enable or disable category %1").arg(i + 1));
    EFTreeWidget->setItemWidget(item, 1, le);
    item->setText(2, "0");
}
开发者ID:gz818,项目名称:itest,代码行数:18,代码来源:categories.cpp

示例2: setStatusTip

void QTreeWidgetItemProto::setStatusTip(int column, const QString &statusTip)
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    item->setStatusTip(column, statusTip);
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例3: UpdateItems

void page_main::UpdateItems(QString search){
  ui->treeWidget->clear();
  ui->treeWidget->setColumnCount(2);
  //First create the categories
  QTreeWidgetItem *interface = new QTreeWidgetItem();
    interface->setIcon(0, LXDG::findIcon("preferences-desktop",""));
    interface->setText(0, tr("Interface Configuration"));
    interface->setFirstColumnSpanned(true);
  QTreeWidgetItem *appearance = new QTreeWidgetItem();
    appearance->setIcon(0, LXDG::findIcon("preferences-desktop-color",""));
    appearance->setText(0, tr("Appearance"));
    appearance->setFirstColumnSpanned(true);
  QTreeWidgetItem *session = new QTreeWidgetItem();
    session->setIcon(0, LXDG::findIcon("preferences-system-session-services",""));
    session->setText(0, tr("Desktop Defaults"));
    session->setFirstColumnSpanned(true);
  QTreeWidgetItem *user = new QTreeWidgetItem();
    user->setIcon(0, LXDG::findIcon("preferences-desktop-user",""));
    user->setText(0, tr("User Settings"));
    user->setFirstColumnSpanned(true);
  //Now go through and add in the known pages for each category
  QStringList SL = search.split(" "); //search list
  for(int i=0; i<INFO.length(); i++){
    if(!search.isEmpty() ){
      //See if this item needs to be included or not
      QStringList info; info << INFO[i].name.split(" ") << INFO[i].title.split(" ") << INFO[i].comment.split(" ") << INFO[i].search_tags;
      info.removeDuplicates(); //remove any duplicate terms/info first
      bool ok = true;
      for(int s=0; s<SL.length() && ok; s++){
	ok = !info.filter(SL[s]).isEmpty();
      }
      if(!ok){ continue; } //no duplicates between search terms and available info
    }
    //qDebug() << "Item Found:" << INFO[i].id << INFO[i].title;
    int col = 0;
    QTreeWidgetItem *lastIt = 0;
    if(INFO[i].category=="interface" && interface->childCount()>0 ){ 
      if( interface->child( interface->childCount()-1)->text(1).isEmpty() ){ lastIt = interface->child(interface->childCount()-1); }
   }else if(INFO[i].category=="appearance"  && appearance->childCount()>0 ){
      if( appearance->child(appearance->childCount()-1)->text(1).isEmpty() ){ lastIt = appearance->child(appearance->childCount()-1); }
    }else if(INFO[i].category=="session"  && session->childCount()>0 ){ 
      if( session->child( session->childCount()-1)->text(1).isEmpty() ){ lastIt = session->child(session->childCount()-1); }
    }else if(INFO[i].category=="user"  && user->childCount()>0 ){ 
      if( user->child( user->childCount()-1)->text(1).isEmpty() ){ lastIt = user->child(user->childCount()-1); }
    }
    if(lastIt==0){ lastIt = new QTreeWidgetItem();  col = 0;}
    else{ col = 1; }
    lastIt->setIcon(col, LXDG::findIcon(INFO[i].icon,"") );
    lastIt->setText(col, INFO[i].name);
    lastIt->setStatusTip(col, INFO[i].comment);
    lastIt->setToolTip(col, INFO[i].comment);
    lastIt->setWhatsThis(col, INFO[i].id);
    if(col==0){
      if(INFO[i].category=="interface"){ interface->addChild(lastIt); }
      else if(INFO[i].category=="appearance"){ appearance->addChild(lastIt); }
      else if(INFO[i].category=="session"){ session->addChild(lastIt); }
      else if(INFO[i].category=="user"){ user->addChild(lastIt); }
      else{ ui->treeWidget->addTopLevelItem(lastIt); }
    }
  }
  //Now add the categories to the tree widget if they are non-empty
  if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); }
  if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); }
  if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); }
  if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); }
  ui->treeWidget->sortItems(0, Qt::AscendingOrder);
  ui->treeWidget->resizeColumnToContents(0);
  ui->treeWidget->resizeColumnToContents(1);
}
开发者ID:Nanolx,项目名称:lumina,代码行数:69,代码来源:page_main.cpp


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