• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ WStandardItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WStandardItem的典型用法代码示例。如果您正苦于以下问题:C++ WStandardItem类的具体用法?C++ WStandardItem怎么用?C++ WStandardItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: WStandardItem

std::vector<WStandardItem *>
TreeViewExample::cityItems(const std::string& city,
			   WeatherIcon weather,
			   const std::string& drink,
			   bool useInternalPath, bool visited)
{
  std::vector<WStandardItem *> result;
  WStandardItem *item;
  
  // column 0: country
  item = new WStandardItem(WString::fromUTF8(city));
  result.push_back(item);
  
  // column 1: weather
  item = new WStandardItem();
  item->setIcon(std::string("icons/") + weatherIcons[weather]);
  result.push_back(item);
  
  // column 2: drink
  item = new WStandardItem(drink);
  if (useInternalPath)
    item->setLink(WLink(WLink::InternalPath, "/drinks/" + drink));
  result.push_back(item);
  
  // column 3: visited
  item = new WStandardItem();
  item->setCheckable(true);
  item->setChecked(visited);
  result.push_back(item);
  
  return result;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:32,代码来源:TreeViewExample.C


示例2: doCheck

void gdContainerBar::doCheck()
{
  WStandardItemModel*  model = dynamic_cast<WStandardItemModel*>(view()->model());
  for (int row = 0; row < model->rowCount(); row++) {
    WStandardItem* wsi = model->invisibleRootItem()->child(row, 0);
    wsi->setChecked(m_pWCb->isChecked());
  }
}
开发者ID:Wittyshare,项目名称:gdwtcore,代码行数:8,代码来源:gdContainerBar.cpp


示例3: WStandardItem

void FormWidgets::addColorElement(WStandardItemModel* model,
				  std::string name, 
				  std::string style)
{
  WStandardItem* item = new WStandardItem(name);
  item->setStyleClass(style);
  model->appendRow(item);
}
开发者ID:StevenFarley,项目名称:wt,代码行数:8,代码来源:FormWidgets.C


示例4: itemFromIndex

bool WStandardItemModel::removeRows(int row, int count,
				    const WModelIndex& parent)
{
  WStandardItem *parentItem = itemFromIndex(parent, false);

  if (parentItem)
    parentItem->removeRows(row, count);

  return parentItem;  
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:10,代码来源:WStandardItemModel.C


示例5: WStandardItem

///
//  Create a file entry
//
WStandardItem* FileBrowser::createEntry(const std::string& baseName, int index)
{
    WStandardItem *result = new WStandardItem(baseName);

    result->setIcon("icons/file.gif");

    // Set the data for the entry index in the user roles
    result->setData(index, UserRole);

    return result;
}
开发者ID:FNNDSC,项目名称:web,代码行数:14,代码来源:FileBrowser.cpp


示例6: WStandardItem

Wt::WStandardItem* VanetSpModelDump::treeNode(list< Node >& nodes)
{
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.spmodeldump"));
    result->setData(VanetSpatialModelDump);
    
    Node extNode("extension");
    Attribute classAttr("class", "de.uni_stuttgart.informatik.canu.spatialmodel.extensions.DumpSpatialModel");
    extNode.addAttribute(classAttr);
    Attribute outAttr("output", output_->valueText().toUTF8());
    extNode.addAttribute(outAttr);
    result->appendRow(propertyRow(string("output="), tr("mappropertyeditor.group.spmodeldump.output").toUTF8(), output_->valueText().toUTF8()));
    
    nodes.push_back(extNode);
    return result;
}
开发者ID:flaviu-toader,项目名称:vanetizer-c--,代码行数:15,代码来源:vanetspmodeldump.cpp


示例7: WStandardItem

WStandardItem* VanetRoutingProtocolPropertyForm::treeNode(list< Node >& nodes)
{
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.glomosim"));
    result->setData(VanetGlomoSimProperties);

    Node routing("routingprotocol");
    routing.value(routingCombo_->currentText().toUTF8());
    result->appendRow(propertyRow(string("routingprotocol"), tr("mappropertyeditor.group.glomosim.routingprotocol").toUTF8(), routingCombo_->currentText().toUTF8()));
//     Node count("number_of_nodes");
//     count.value(nodesCount_->valueText().toUTF8());
//     result->appendRow(propertyRow(string("number_of_nodes"), tr("mappropertyeditor.group.glomosim.nodesnumber").toUTF8(), nodesCount_->valueText().toUTF8()));
    nodes.push_back(routing);
//     nodes.push_back(count);

    return result;
}
开发者ID:flaviu-toader,项目名称:vanetizer-c--,代码行数:16,代码来源:vanetroutingprotocolpropertyform.cpp


示例8: WStandardItem

WStandardItem *VanetAreaPropertyForm::treeNode(std::list< Node >& nodes)
{
    WStandardItem *result = new WStandardItem(tr("mappropertyeditor.group.general"));
    result->setData(VanetArea);

    Node xNode = Node("dimx");
    xNode.value(boost::lexical_cast<std::string>(dimx_->value()));
    nodes.push_back(xNode);
    result->appendRow(propertyRow(std::string("dimx"), tr("mappropertyeditor.group.general.dimx").toUTF8(), boost::lexical_cast<std::string>(dimx_->value())));
    Node yNode = Node("dimy");
    yNode.value(boost::lexical_cast<std::string>(dimy_->value()));
    nodes.push_back(yNode);
    result->appendRow(propertyRow(std::string("dimy"), tr("mappropertyeditor.group.general.dimy").toUTF8(), boost::lexical_cast<std::string>(dimy_->value())));

    return result;
}
开发者ID:flaviu-toader,项目名称:vanetizer-c--,代码行数:16,代码来源:vanetareapropertyform.cpp


示例9: itemPrototype

WStandardItem *WStandardItemModel::itemFromIndex(const WModelIndex& index,
						 bool lazyCreate) const
{
  if (!index.isValid())
    return invisibleRootItem_;
  else
    if (index.model() != this)
      return 0;
    else {
      WStandardItem *parent
	= static_cast<WStandardItem *>(index.internalPointer());
      WStandardItem *c = parent->child(index.row(), index.column());

      if (lazyCreate && !c) {
	c = itemPrototype()->clone();
	parent->setChild(index.row(), index.column(), c);
      }
      
      return c;
    }
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:21,代码来源:WStandardItemModel.C


示例10: WStandardItem

Wt::WStandardItem* VanetNodeForm::treeNode(std::list< Node >& nodes)
{
    
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.node").arg(id_->valueText()));
    result->setData(VanetNode);
    
    Node n("node");
    Attribute idAttr("id", id_->valueText().toUTF8());
    n.addAttribute(idAttr);
    Node posNode("position");
    Attribute rndAttr("random", "true");
    posNode.addAttribute(rndAttr);
    n.addChild(posNode);
    result->appendRow(propertyRow(string("id="), tr("mappropertyeditor.group.node.id").toUTF8(), id_->valueText().toUTF8()));;
    //result->appendRow(form_->treeNode(nodes));
    // Here we place the mobility model on the same level as everything else. Just a quick fix so we can properly persist the model in the PersistenceManager.
    form_->appendPropertyRows(result, nodes);
    Node extNode = nodes.back();
    nodes.pop_back();
    n.addChild(extNode);
    nodes.push_back(n);
    return result;

}
开发者ID:flaviu-toader,项目名称:vanetizer-c--,代码行数:24,代码来源:vanetnodeform.cpp


示例11: WStandardItem

  /*! \brief Create a folder item.
   *
   * Configures flags for drag and drop support.
   */
  WStandardItem *createFolderItem(const WString& location,
				  const std::string& folderId = std::string())
  {
    WStandardItem *result = new WStandardItem(location);

    if (!folderId.empty()) {
      result->setData(boost::any(folderId));
      result->setFlags(result->flags() | ItemIsDropEnabled);
      folderNameMap_[folderId] = location;
    } else
      result->setFlags(result->flags().clear(ItemIsSelectable));

    result->setIcon("icons/folder.gif");

    return result;
  }
开发者ID:USP,项目名称:wtcpp,代码行数:20,代码来源:TreeViewDragDrop.C


示例12: populateFiles

  /*! \brief Populate the files model.
   *
   * Data (and headers) is read from the CSV file data/files.csv. We
   * add icons to the first column, resolve the folder id to the
   * actual folder name, and configure item flags, and parse date
   * values.
   */
  void populateFiles() {
    fileModel_->invisibleRootItem()->setRowCount(0);

    std::ifstream f((appRoot() + "data/files.csv").c_str());

    if (!f)
      throw std::runtime_error("Could not read: data/files.csv");

    readFromCsv(f, fileModel_);

    for (int i = 0; i < fileModel_->rowCount(); ++i) {
      WStandardItem *item = fileModel_->item(i, 0);
      item->setFlags(item->flags() | ItemIsDragEnabled);
      item->setIcon("icons/file.gif");

      std::string folderId = item->text().toUTF8();

      item->setData(boost::any(folderId), UserRole);
      item->setText(folderNameMap_[folderId]);

      convertToDate(fileModel_->item(i, 4));
      convertToDate(fileModel_->item(i, 5));
    }
  }
开发者ID:USP,项目名称:wtcpp,代码行数:31,代码来源:TreeViewDragDrop.C


示例13: path

///
//  Add an entry to the browser
//
bool FileBrowser::addEntry(bool rootDir, int entryDepth,
                           const std::string &baseDir,
                           const std::string &baseName,
                           int index)
{
    //
    //  The code below adds an entry into the tree such as follows:
    //
    //  + tract_meta.bash
    //  + dicom_seriesCollect.bash
    //  + tract_meta-stage-2-dcm2trk.bash
    //    |
    //    + stage-1-mri_convert
    //      |
    //      + diff_unpack
    //
    //   ...
    //
    //  The relatively convoluted logic below is responsible for
    //  adding a new item to this tree structure.

    // If it's not a root directory, add the unique folder names as
    // root folder entries
    if (!rootDir)
    {
        bool addEntry = true;

        int modelRow;

        // Iterate over all the rows in the root
        for (modelRow = 0; modelRow < mModel->rowCount(); modelRow++)
        {
            WStandardItem *item = mModel->item(modelRow);
            bool match = true;

            // For the depth of the folder, attempt to match as many folders
            // as possible.
            for (int depth = 0; depth <= entryDepth && item != NULL; depth++)
            {
                path dirPath = path(baseDir);
                for (int d = 0; d < (entryDepth - depth); d++)
                {
                    dirPath = dirPath.branch_path();
                }
                std::string folderLeafName = path(dirPath).leaf().string();

                boost::any displayData = item->data(DisplayRole);
                if (!displayData.empty())
                {
                    WString folderName = boost::any_cast<WString>(displayData);

                    // Folder did not match, this means we need to add it
                    // to the tree
                    if (folderName.toUTF8() != folderLeafName)
                    {
                        match = false;
                        break;
                    }
                }
            }

            // All folders matched, we do not need a new folder
            if (match)
            {
                addEntry = false;
            }
        }

        // Add all of the necessary folder entries to the tree
        if (addEntry)
        {
            WStandardItem *lastItem = mModel->invisibleRootItem();

            for (int depth = 0; depth <= entryDepth; depth++)
            {
                path dirPath = path(baseDir);
                for (int d = 0; d < (entryDepth - depth); d++)
                {
                    dirPath = dirPath.branch_path();
                }
                std::string folderLeafName = path(dirPath).leaf().string();

                bool addFolder = true;
                for (int row = 0; row < lastItem->rowCount(); row++)
                {
                    WStandardItem *item = lastItem->child(row);
                    std::string folderLeafName = path(dirPath).leaf().string();

                    boost::any displayData = item->data(DisplayRole);
                    if (!displayData.empty())
                    {
                        WString folderName = boost::any_cast<WString>(displayData);

                        if (folderName.toUTF8() == folderLeafName)
                        {
                           addFolder = false;
                           lastItem = item;
//.........这里部分代码省略.........
开发者ID:FNNDSC,项目名称:web,代码行数:101,代码来源:FileBrowser.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WStatus类代码示例发布时间:2022-05-31
下一篇:
C++ WSlider类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap