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


C++ QBitArray::clearBit方法代码示例

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


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

示例1: deserialize

quint32 CBerBitStringStorage::deserialize(CBerByteArrayInputStream& iStream, QObject* obj, CBerLength& length, quint32 codeLength)
{
	length.decode(iStream);
	qDebug() << "CBerBitStringStorage::deserialize, length extracted: " << length.getVal();

	qint32 lenVal = length.getVal();

	QByteArray data(lenVal, Qt::Initialization::Uninitialized);

	if (data.size() > 0)
	{
		QBitArray val;

		qint32 rdLength = iStream.read(data, 0, lenVal);
		if (rdLength == lenVal)
		{
			val.resize(rdLength);
			for (qint32 i=0; i<rdLength; ++i)
			{
				if (data[i]) val.setBit(i);
				else val.clearBit(i);
			}

			codeLength += rdLength + 1;

			QBitArray* pVal = &val;
			QVariant wrvar(PtrMetaTypes::s_QBitArrayPtrMetaType, &pVal);
			obj->metaObject()->property(3).write(obj, wrvar);
		}
	}

	return codeLength;
}
开发者ID:Saotomych,项目名称:ASN1,代码行数:33,代码来源:berBitStringStorage.cpp

示例2: process

void KisConvolutionFilter::process(KisConstProcessingInformation srcInfo,
                                   KisProcessingInformation dstInfo,
                                   const QSize& size,
                                   const KisFilterConfiguration* config,
                                   KoUpdater* progressUpdater
                                  ) const
{
    Q_UNUSED(config);

    const KisPaintDeviceSP src = srcInfo.paintDevice();
    KisPaintDeviceSP dst = dstInfo.paintDevice();
    QPoint dstTopLeft = dstInfo.topLeft();
    QPoint srcTopLeft = srcInfo.topLeft();
    Q_ASSERT(src != 0);
    Q_ASSERT(dst != 0);

    KisConvolutionPainter painter(dst, dstInfo.selection());

    QBitArray channelFlags;
    if (config) {
        channelFlags = config->channelFlags();
    }
    if (channelFlags.isEmpty() || !config) {
        channelFlags = QBitArray(src->colorSpace()->channelCount(), true);
    }
 
    // disable alpha channel
    channelFlags.clearBit(1);

    painter.setChannelFlags(channelFlags);
    painter.setProgress(progressUpdater);
    painter.applyMatrix(m_matrix, src, srcTopLeft, dstTopLeft, size, BORDER_REPEAT);

}
开发者ID:KDE,项目名称:calligra-history,代码行数:34,代码来源:kis_convolution_filter.cpp

示例3: mergeHoles

void HoleFinderPrivate::mergeHoles()
{
  // Make copy, clear original, add merged holes back into original
  QVector<Hole> holeCopy (this->holes);
  const int numHoles = this->holes.size();
  this->holes.clear();
  this->holes.reserve(numHoles);

  // If the bit is on, it has not been merged. If off, it has been.
  QBitArray mask (holeCopy.size(), true);

  // Check each pair of unmerged holes. If one contains the other, merge them.
  QVector<Hole*> toMerge;
  toMerge.reserve(256); // Way bigger than we need, but certainly sufficient

  // Temp vars
  Eigen::Vector3d diffVec;

  // "i" indexes the "base" hole
  for (int i = 0; i < numHoles; ++i) {
    if (!mask.testBit(i))
      continue;

    mask.clearBit(i);
    Hole &hole_i = holeCopy[i];

    toMerge.clear();
    toMerge.reserve(256);
    toMerge.push_back(&hole_i);

    // "j" indexes the compared holes
    for (int j = i+1; j < numHoles; ++j) {
      if (!mask.testBit(j))
        continue;

      Hole &hole_j = holeCopy[j];

      diffVec = hole_j.center - hole_i.center;

      // Use the greater of the two radii
      const double rad = (hole_i.radius > hole_j.radius)
          ? hole_i.radius : hole_j.radius;
      const double radSq = rad * rad;

      // Check periodic conditions
      // Convert diffVec to fractional units
      this->cartToFrac(&diffVec);
      // Adjust each component to range [-0.5, 0.5] (shortest representation)
      while (diffVec.x() < -0.5) ++diffVec.x();
      while (diffVec.y() < -0.5) ++diffVec.y();
      while (diffVec.z() < -0.5) ++diffVec.z();
      while (diffVec.x() > 0.5) --diffVec.x();
      while (diffVec.y() > 0.5) --diffVec.y();
      while (diffVec.z() > 0.5) --diffVec.z();
      // Back to cartesian
      this->fracToCart(&diffVec);

      // if j is within i's radius, add "j" to the merge list
      // and mark "j" as merged
      if (fabs(diffVec.x()) > rad ||
          fabs(diffVec.y()) > rad ||
          fabs(diffVec.z()) > rad ||
          fabs(diffVec.squaredNorm()) > radSq)
        continue; // no match

      // match:
      // Reset j's position to account for periodic wrap-around
      hole_j.center = hole_i.center + diffVec;
      mask.clearBit(j);
      toMerge.push_back(&hole_j);
    }

    if (toMerge.size() == 1)
      this->holes.push_back(hole_i);
    else
      this->holes.push_back(reduceHoles(toMerge));
  }
}
开发者ID:ajshamp,项目名称:XtalOpt-ajs,代码行数:78,代码来源:holefinder.cpp


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