【问题标题】:QtConcurrent trying to run a function in threadQtConcurrent 试图在线程中运行一个函数
【发布时间】:2012-06-24 12:41:11
【问题描述】:

我在其他一些包含的 .cc 中有这个功能:

void MakeMeshStructure(MeshStructureLayers layers,
  Handle_AIS_InteractiveContext theContext,
  Handle_TDocStd_Document aDoc,
  MyMesh & mesh, 
  int detail_vertex,
  double insulation_thickness,
  OpenMesh::VPropHandleT<MyMesh::Scalar> _max_beam_offset)

在 MainWindow 中我试图在一个线程中运行这个函数:

QFuture<void> future = QtConcurrent::run(MeshStructure3::MakeMeshStructure,
  layers, 
  myCadFrame->getWidget()->getContext(),
  myController->getDocument()->getOcafDoc(), 
  mesh, 
  detail_vertex, 
  toolBox->insulation_thickness_SpinBox->value(), 
  max_beam_offset_);

编译器说它有太多参数。

【问题讨论】:

    标签: c++ qt concurrency


    【解决方案1】:

    超过 5 个参数需要使用 Boost::bind,见Using Bound Function Arguments

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-25
      • 2021-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多