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


C++ wt::WModelIndex类代码示例

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


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

示例1: hash_value

std::size_t hash_value(const Wt::WModelIndex& index) {
  boost::hash<int> intHasher;
  boost::hash< ::uint64_t > longHasher;

  return intHasher(index.row()) + intHasher(index.column())
    + longHasher(index.internalId());
}
开发者ID:913862627,项目名称:wt,代码行数:7,代码来源:WModelIndex.C

示例2: data

 boost::any data(const Wt::WModelIndex& index,
                 int role=Wt::DisplayRole) const {
     dbo::Transaction t(fApp->session());
     const CommentPtr& o = resultRow(index.row());
     if (index.column() == deleted_column) {
         if (role == Wt::DisplayRole) {
             return "";
         } else if (role == Wt::CheckStateRole) {
             return o->deleted();
         }
     } else if (index.column() == index_column) {
         if (role == Wt::LinkRole) {
             return Wt::WLink(Wt::WLink::InternalPath, fApp->comment_path(o));
         } else if (role == Wt::DisplayRole) {
             return tr("facts.common.id_format").arg(o.id().index);
         }
     } else if (index.column() == ip_column && role == Wt::LinkRole) {
         return  Wt::WLink(Wt::WLink::InternalPath, fApp->ip_path(o->ip()));
     } else if (index.column() == text_column && role == Wt::DisplayRole) {
         if (o->deleted()) {
             return tr("facts.comment.deleted");
         } else {
             return tr("facts.comment.format").arg(o->username()).arg(o->email())
                    .arg(o->when_added().toString()).arg(o->text());
         }
     }
     return BaseQM::data(index, role);
 }
开发者ID:starius,项目名称:facts,代码行数:28,代码来源:CommentsWidget.cpp

示例3: tableClicked

void RSWappSearchFilesPage::tableClicked()
{
	//_tableView->selectedIndexes().begin().
	Wt::WModelIndex index;
	std::list<int> jobList;
	const Wt::WModelIndexSet selectedRows = _tableView->selectedIndexes();
	for (Wt::WModelIndexSet::iterator i = selectedRows.begin();
		i != selectedRows.end(); ++i) {
			index = *i;
			jobList.push_back(index.row());
	}
	DirDetails dd;
	std::list<DirDetails> items = _shared_files_model->getItems(jobList);
	for (std::list<DirDetails>::iterator i = items.begin();
		i != items.end(); ++i) {
			dd = *i;

			FileInfo finfo ;
		    rsFiles->FileDetails(dd.hash, RS_FILE_HINTS_REMOTE, finfo) ;

		    std::list<std::string> srcIds;
		    for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
		    {
		        srcIds.push_back((*it).peerId) ;
		    }

		    if (rsFiles->FileRequest(dd.name, dd.hash, dd.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
				std::cerr << "\n\n DOWNLOADING: " << dd.name << ", " << dd.hash << ", " << dd.count <<std::endl;
		    } else {
				std::cerr << "\n\n SKIPDL: " << dd.name << ", " << dd.hash << ", " << dd.count <<std::endl;
		        //fileExist.append(link.name());
		    }
	}
	//dryRunSignal().emit(jobList);
}
开发者ID:RetroShare,项目名称:RSWebUI,代码行数:35,代码来源:RSWappSearchFilesPage.cpp

示例4: data

 boost::any data(const Wt::WModelIndex& index,
                 int role=Wt::DisplayRole) const {
     dbo::Transaction t(fApp->session());
     if (role == Wt::LinkRole && index.column() == N_COLUMN) {
         const FactPtr& o = resultRow(index.row());
         return Wt::WLink(Wt::WLink::InternalPath, fApp->fact_path(o));
     }
     return BaseQM::data(index, role);
 }
开发者ID:starius,项目名称:facts,代码行数:9,代码来源:AdminWidget.cpp

示例5: mtx

		virtual boost::any data(const Wt::WModelIndex& index, int role = Wt::DisplayRole) const
		{
			RsStackMutex mtx(_mtx) ;
			std::cerr << "data row: " << index.row() << std::endl;
			if(index.column() >= 6 || index.row() >= (int)_searchResults.size())
				return boost::any();

			//DirDetails dd;
			//dd.count;
			switch (role) 
			{
				case Wt::DisplayRole:
					switch(index.column())
					{
						case COLUMN_FILENAME  : return Wt::WString(_searchResults[index.row()].name) ;
						case COLUMN_SIZE  : return make_big_number(_searchResults[index.row()].count) ;
						case COLUMN_AGE: return make_big_number(_searchResults[index.row()].age);
						default:
														return boost::any();
					}
				case Wt::UserRole:
					switch(index.column())
					{

					default: return Wt::WString(_searchResults[index.row()].hash) ;
					}
				case Wt::ToolTipRole:
						Wt::WString(_searchResults[index.row()].hash) ;
				default:
					return boost::any();
			}
		}
开发者ID:RetroShare,项目名称:RSWebUI,代码行数:32,代码来源:RSWappSearchFilesPage.cpp

示例6: WString

boost::any
InstructionListModel::data(const Wt::WModelIndex &index, int role) const {
    ASSERT_require(index.isValid());
    ASSERT_require(index.row()>=0 && (size_t)index.row() < insns_.size());
    SgAsmInstruction *insn = insns_[index.row()];
    if (Wt::DisplayRole == role) {
        switch (index.column()) {
            case C_ADDR: {
                return Wt::WString(StringUtility::addrToString(insn->get_address()));
            }
            case C_BYTES: {
                std::string s;
                for (size_t i=0; i<insn->get_raw_bytes().size(); ++i) {
                    uint8_t byte = insn->get_raw_bytes()[i];
                    char buf[32];
                    sprintf(buf, "%02x", byte);
                    s += std::string(i?" ":"") + buf;
                }
                return Wt::WString(s);
            }
            case C_CHARS: {
                std::string s;
                for (size_t i=0; i<insn->get_raw_bytes().size(); ++i) {
                    char ch = insn->get_raw_bytes()[i];
                    s += std::string(i?" ":"") + (isgraph(ch) ? std::string(1, ch) : std::string(" "));
                }
                return Wt::WString(s);
            }
            case C_STACKDELTA: {
                int64_t delta = insn->get_stackDelta();
                if (delta == SgAsmInstruction::INVALID_STACK_DELTA)
                    return Wt::WString("");
                std::string s = (delta >= 0 ? "+" : "") + boost::lexical_cast<std::string>(delta);
                return Wt::WString(s);
            }
            case C_NAME: {
                return Wt::WString(unparseMnemonic(insn));
            }
            case C_ARGS: {
                std::string s;
                const RegisterDictionary *regs = ctx_.partitioner.instructionProvider().registerDictionary();
                const SgAsmExpressionPtrList &operands = insn->get_operandList()->get_operands();
                for (size_t i=0; i<operands.size(); ++i)
                    s += (i?", ":"") + unparseExpression(operands[i], NULL, regs);
                return Wt::WString(s);
            }
            case C_COMMENT: {
                return Wt::WString(insn->get_comment());
            }
            default:
                ASSERT_not_reachable("invalid column number");
        }
    }
    return boost::any();
}
开发者ID:GoblinInventor,项目名称:rose-develop,代码行数:55,代码来源:InstructionListModel.C

示例7: setData

 bool setData(const Wt::WModelIndex& index, const boost::any& value,
              int role=Wt::EditRole) {
     if (role == Wt::CheckStateRole && value.type() == typeid(bool)) {
         dbo::Transaction t(fApp->session());
         const CommentPtr& o = resultRow(index.row());
         o.modify()->set_deleted(boost::any_cast<bool>(value));
         t.commit();
         dataChanged().emit(index, this->index(index.row(), text_column));
         return true;
     }
     return BaseQM::setData(index, value, Wt::EditRole);
 }
开发者ID:starius,项目名称:facts,代码行数:12,代码来源:CommentsWidget.cpp

示例8: data

boost::any PlaneData::data(const Wt::WModelIndex& index,
			   int role) const
{
  if (role != DisplayRole) {
    return boost::any();
  }

  double x, y;
  y = yStart_ + index.column() * yDelta_;
  x = xStart_ + index.row() * xDelta_;
  return 0.5*y;
}
开发者ID:Unss,项目名称:wt,代码行数:12,代码来源:DataModels.cpp

示例9: WString

 virtual boost::any data(const Wt::WModelIndex& index, int role = Wt::DisplayRole) const
 {
   switch (role) {
     case Wt::DisplayRole:
       if(index.column()==0)
         return Wt::WString(_profiles[index.row()].uuid);
       if(index.column()==1)
         return Wt::WString(_profiles[index.row()].name);
     default:
       return boost::any();
   }
 }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:12,代码来源:ProfileList.cpp

示例10: Nothing

Sawyer::Optional<rose_addr_t>
HexDumpModel::cellAddress(const Wt::WModelIndex &idx) const {
    if (!idx.isValid())
        return Sawyer::Nothing();
    size_t column = idx.column();
    size_t row = idx.row();

    if (column >= bytesColumn && column < bytesColumn + bytesPerRow)
        return cellAddress(row, column - bytesColumn);
    if (column >= asciiColumn && column < asciiColumn + bytesPerRow)
        return cellAddress(row, column - asciiColumn);
    return Sawyer::Nothing();
}
开发者ID:ian-bertolacci,项目名称:rose-develop,代码行数:13,代码来源:WHexDump.C

示例11: data

Wt::cpp17::any PlaneData::data(const Wt::WModelIndex& index, Wt::ItemDataRole role) const
{
  if (role != Wt::ItemDataRole::Display) {
    return WStandardItemModel::data(index, role);
  }

  double delta_x = (xEnd_ - xStart_)/(rowCount()-2);
  double delta_y = (yEnd_ - yStart_)/(columnCount()-2);
  double x = xStart_ + index.row() * delta_x;
  double y = yStart_ + index.column() * delta_y;

  return 0.2*x - 0.2*y;
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:13,代码来源:DataModels.cpp

示例12: WString

  virtual boost::any data(const Wt::WModelIndex& index, int role = Wt::DisplayRole) const
  {
    switch (role) {
    case Wt::DisplayRole:
      if (index.column() == 0)
	return Wt::WString("Row {1}").arg(index.row());
      else
	return Wt::WString("Item row {1}, col {2}")
	  .arg(index.row()).arg(index.column());
    default:
      return boost::any();
    }
  }
开发者ID:913862627,项目名称:wt,代码行数:13,代码来源:VirtualModel.cpp

示例13: doubleClicked

void ProfileList::doubleClicked(Wt::WModelIndex index, Wt::WMouseEvent event)
{
  LOGDEBUG("cell double clicked:"<< boost::any_cast<Wt::WString>(tableView->model()->data(index.row(),index.column())));
  tableView->select(index);
  db::Preset preset=((ProfileTableModel*)tableView->model())->getPresetAtIndex(index.row());
  openEditDialog(preset);
}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:7,代码来源:ProfileList.cpp

示例14: rowCount

		virtual int rowCount(const Wt::WModelIndex& parent = Wt::WModelIndex()) const
		{
			if (!parent.isValid())
				return _friends.size() ;
			else
				return 0;
		}
开发者ID:RetroShare,项目名称:RSWebUI,代码行数:7,代码来源:RSWappFriendsPage.cpp

示例15: columnCount

		virtual int columnCount(const Wt::WModelIndex& parent = Wt::WModelIndex()) const
		{
			if (!parent.isValid())
				return 6;
			else
				return 0;
		}
开发者ID:RetroShare,项目名称:RSWebUI,代码行数:7,代码来源:RSWappSearchFilesPage.cpp


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