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

C++ pick函数代码示例

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

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



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

示例1: pick

QSize QToolBarAreaLayoutLine::sizeHint() const
{
    int a = 0, b = 0;
    for (int i = 0; i < toolBarItems.count(); ++i) {
        const QToolBarAreaLayoutItem &item = toolBarItems.at(i);
        if (item.skip())
            continue;

        QSize sh = item.sizeHint();
        a += pick(o, sh);
        b = qMax(b, perp(o, sh));
    }

    QSize result;
    rpick(o, result) = a;
    rperp(o, result) = b;

    return result;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:19,代码来源:qtoolbararealayout.cpp


示例2: initStyleOption

void QxtSpanSliderPrivate::handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle)
{
    QStyleOptionSlider opt;
    initStyleOption(&opt, handle);
    QxtSpanSlider* p = &qxt_p();
    const QStyle::SubControl oldControl = control;
    control = p->style()->hitTestComplexControl(QStyle::CC_Slider, &opt, pos, p);
    const QRect sr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, p);
    if (control == QStyle::SC_SliderHandle)
    {
        position = value;
        offset = pick(pos - sr.topLeft());
        lastPressed = handle;
        p->setSliderDown(true);
        emit p->sliderPressed(handle);
    }
    if (control != oldControl)
        p->update(sr);
}
开发者ID:dshean,项目名称:trunk,代码行数:19,代码来源:qxtspanslider.cpp


示例3: pick

void pick(int i) {
  int valid;
  int j, n;
  if (i == 9) {
    n = -remain[i];
    if (n < 0 || n > 9) {
      return;
    }
    --remain[n];
    remain[i] += n;
    for (j = 0, valid = 1; j < 10; ++j) {
      if (remain[j] != 0) {
        valid = 0;
        break;
      }
    }
    if (valid) {
      num[i] = n;
      for (j = 0; j < 10; ++j) {
        printf("%d ", num[j]);
      }
      printf("\n");
    } else {
      ++invalid;
    }
    ++remain[n];
    remain[i] -= n;
  } else {
    for (n = 0; n < 10; ++n) {
      num[i] = n;
      --remain[n];
      remain[i] += n;
      if (remain[i] >= 0 && (n > i || remain[n] >= 0)) {
        pick(i + 1);
      }
      /* if (remain[i] >= 0) { */
      /*   pick(i + 1); */
      /* } */
      ++remain[n];
      remain[i] -= n;
    }
  }
}
开发者ID:Tim-Tom,项目名称:scratch,代码行数:43,代码来源:self-descriptive.c


示例4: CtrlLayoutOKCancel

void RichEdit::InsertTable()
{
	if(IsSelection())
		return;
	WithCreateTableLayout<TopWindow> dlg;
	CtrlLayoutOKCancel(dlg, t_("Insert table"));
	dlg.header = false;
	dlg.columns <<= 2;
	dlg.columns.MinMax(1, 20);
	dlg.ActiveFocus(dlg.columns);
	if(dlg.Run() != IDOK)
		return;
	RichTable::Format fmt;
	int nx = minmax((int)~dlg.columns, 1, 20);
	for(int q = nx; q--;)
		fmt.column.Add(1);
	if(dlg.header)
		fmt.header = 1;
	RichTable table;
	table.SetFormat(fmt);
	for(int i = 0; i < (dlg.header ? 2 : 1); i++)
		for(int j = 0; j < nx; j++) {
			RichText h;
			h.SetStyles(text.GetStyles());
			RichPara p;
			p.format = formatinfo;
			p.format.newpage = false;
			p.format.label.Clear();
			h.Cat(p);
			table.SetPick(i, j, pick(h));
		}
	NextUndo();
	if(cursorp.posinpara)
		InsertLine();
	if(text.GetRichPos(cursor).paralen) {
		InsertLine();
		cursor = anchor = cursor - 1;
		begtabsel = false;
	}
	SaveFormat(cursor, 0);
	AddUndo(new UndoCreateTable(text.SetTable(cursor, table)));
	Finish();
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:43,代码来源:Table.cpp


示例5: qMax

QSize QToolBarAreaLayoutInfo::minimumSize() const
{
    int a = 0, b = 0;
    for (int i = 0; i < lines.count(); ++i) {
        const QToolBarAreaLayoutLine &l = lines.at(i);
        if (l.skip())
            continue;

        QSize m = l.minimumSize();
        a = qMax(a, pick(o, m));
        b += perp(o, m);
    }

    QSize result;
    rpick(o, result) = a;
    rperp(o, result) = b;

    return result;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:19,代码来源:qtoolbararealayout.cpp


示例6: Q_Q

void QSplitterPrivate::setGeo(QSplitterLayoutStruct *sls, int p, int s, bool allowCollapse)
{
    Q_Q(QSplitter);
    QWidget *w = sls->widget;
    QRect r;
    QRect contents = q->contentsRect();
    if (orient == Qt::Horizontal) {
        r.setRect(p, contents.y(), s, contents.height());
    } else {
        r.setRect(contents.x(), p, contents.width(), s);
    }
    sls->rect = r;

    int minSize = pick(qSmartMinSize(w));

    if (orient == Qt::Horizontal && q->isRightToLeft())
        r.moveRight(contents.width() - r.left());

    if (allowCollapse)
        sls->collapsed = s <= 0 && minSize > 0 && !w->isHidden();

    //   Hide the child widget, but without calling hide() so that
    //   the splitter handle is still shown.
    if (sls->collapsed)
        r.moveTopLeft(QPoint(-r.width()-1, -r.height()-1));

    w->setGeometry(r);

    if (!sls->handle->isHidden()) {
        QSplitterHandle *h = sls->handle;
        QSize hs = h->sizeHint();
        int left, top, right, bottom;
        h->getContentsMargins(&left, &top, &right, &bottom);
        if (orient==Qt::Horizontal) {
            if (q->isRightToLeft())
                p = contents.width() - p + hs.width();
            h->setGeometry(p-hs.width() - left, contents.y(), hs.width() + left + right, contents.height());
        } else {
            h->setGeometry(contents.x(), p-hs.height() - top, contents.width(), hs.height() + top + bottom);
        }
    }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:42,代码来源:qsplitter.cpp


示例7: while

void Ctrl::DefferedFocusSync()
{
	GuiLock __;
	while(defferedChildLostFocus.GetCount() || defferedSetFocus) {
		LLOG("Ctrl::DeferredFocusSync, defferedSetFocus = " << UPP::Name(defferedSetFocus));
		Vector< Ptr<Ctrl> > b = pick(defferedChildLostFocus);
		defferedChildLostFocus.Clear();
		for(int i = 0; i < b.GetCount(); i++)
			if(b[i]) {
				LLOG("Ctrl::DeferredFocusSync -> ChildLostFocus " << UPP::Name(b[i]));
				b[i]->ChildLostFocus();
			}
		if(defferedSetFocus) {
			LLOG("Ctrl::DeferredFocusSync -> SetFocus " << UPP::Name(defferedSetFocus));
			defferedSetFocus->SetFocus();
		}
		defferedSetFocus = NULL;
		SyncCaret();
	}
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:20,代码来源:CtrlKbd.cpp


示例8: AcquireTopic

bool HelpWindow::GoTo0(const String& link)
{
	if(IsNull(link) || current_link == link)
		return true;
	Topic t = AcquireTopic(link);
	SetBar();
	if(!IsNull(t.text)) {
		label = t.label;
		topic = t.link;
		Title(FromUtf8(t.title));
		RichText txt = ParseQTF(t.text);
		FinishText(txt);
		view.Pick(pick(txt), zoom);
		view.GotoLabel(label, true);
		current_link = link;
		tree.FindSetCursor(topic);
		return true;
	}
	return false;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:20,代码来源:Help.cpp


示例9: pick

//-----------------------------------------------------------------------------
// passive button event handler
//-----------------------------------------------------------------------------
void GlutDisplay::mouseEvent(const int button, const int state, const int x, const int y)
{
   if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
      Graphic* selected = pick();
      if (selected != nullptr) {
         selected->event(INPUT_LEFT_EDGE);
         if (picked != nullptr) picked->unref();
         picked = selected;
         picked->ref();
      }
   }
   if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
      if (picked != nullptr) {
         picked->event(ON_SINGLE_CLICK);
         picked->unref();
         picked = nullptr;
      }
   }
   setMouse(x,y);
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:23,代码来源:GlutDisplay.cpp


示例10: pick

  void PeakPickerSH::pickExperiment(const MSExperiment<> & input, MSExperiment<> & output)
  {
    // make sure that output is clear
    output.clear(true);

    // copy experimental settings
    static_cast<ExperimentalSettings &>(output) = input;

    // resize output with respect to input
    output.resize(input.size());

    std::cout << "Before loop, input size = " << input.size() << std::endl;
    Size progress = 0;
    for (Size scan_idx = 0; scan_idx != input.size(); ++scan_idx)
    {
      output[scan_idx].clear(true);
      output[scan_idx].SpectrumSettings::operator=(input[scan_idx]);
      output[scan_idx].MetaInfoInterface::operator=(input[scan_idx]);
      output[scan_idx].setRT(input[scan_idx].getRT());
      output[scan_idx].setMSLevel(input[scan_idx].getMSLevel());
      output[scan_idx].setName(input[scan_idx].getName());
      output[scan_idx].setType(SpectrumSettings::PEAKS);

      if (input[scan_idx].getMSLevel() != 1)
      {
        // When not considering MS2 data (MS2 fragment mass tracing=0), Lukas leaves out
        // the entire scan (instead of just copying it to the output as seen in
        // another plugin).
        // pick(input[scan_idx], output[scan_idx], 4.0);
      }
      else
      {
        // TODO: Read value 4.0 from parameters # PeakPickerSH.cpp
        pick(input[scan_idx], output[scan_idx], 5.0);
      }
      setProgress(++progress);
    }
    std::cout << "After loop" << std::endl;

    endProgress();
  }
开发者ID:BioinformaticsArchive,项目名称:OpenMS,代码行数:41,代码来源:PeakPickerSH.cpp


示例11: simulator

void * simulator(void * v) {
  uint32_t ngames = ((uint32_t *)v)[0];
  uint32_t * ohs = (uint32_t *)malloc(2*(np-1)*sizeof(uint32_t));
  uint32_t cs[7], myas[7], cs0, cs1, result, result1, i, j, k;
  uint32_t mycounters[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  // int mywins = 0, mydraws = 0;
  deck * d = newdeck();
  for (i=0; i<kc; i++) {
    pick(d, as[i]);
    myas[i] = as[i];
  }
  for (i=0; i<ngames; i++) {
    int64_t score;
    initdeck(d, 52-kc);
    for (j=0; j<2*(np-1); j++) ohs[j] = draw(d);
    for (j=kc; j<7; j++) myas[j] = draw(d);
    for (j=0; j<7; j++) cs[j] = myas[j];
    sort(cs);
    score = eval7(cs);
    result = WIN;
    for (j=0; j<np-1; j++) {
      cs[0] = ohs[2*j];
      cs[1] = ohs[2*j+1];
      for (k=2; k<7; k++) cs[k] = myas[k];
      sort(cs);
      result1 = comp7(cs, score);
      if (result1 < result) result = result1;
      if (result == LOSS) break;
    }
    mycounters[result]++;
    mycounters[hand(score)]++;
  }
  pthread_mutex_lock(&tlock);
  for (i=0; i<12; i++) {
    counters[i] += mycounters[i];
  }
  pthread_mutex_unlock(&tlock);
  free(ohs);
  free(d);
  return NULL;
}
开发者ID:lostella,项目名称:podds,代码行数:41,代码来源:podds.c


示例12: mouse

void Rigid_body_viewer:: mouse(int _button, int _state, int _x, int _y)
{
    // need points
    if (body_.points.empty())
        return;

    // mouse button release destroys current mouse spring
    if (_state == GLUT_UP)
    {
        mouse_spring_.active = false;
        return;
    }

    // mouse button press generates new mouse spring
    else if (_state == GLUT_DOWN)
    {
        // get point under mouse cursor
        vec2 p = pick(_x, _y);

        // find closest body point
        unsigned int i, imin;
        float dmin = FLT_MAX;
        for (i=0; i<body_.points.size(); ++i)
        {
            float d = distance(p, body_.points[i]);
            if (d < dmin)
            {
                dmin = d;
                imin = i;
            }
        }

        // setup the mouse spring
        mouse_spring_.active = true;
        mouse_spring_.particle_index = imin;
        mouse_spring_.mouse_position = p;
    }

    glutPostRedisplay();
}
开发者ID:zommerfelds,项目名称:exercises-acg-epfl,代码行数:40,代码来源:Rigid_body_viewer.cpp


示例13: if

void Mass_spring_viewer::mouse(int _button, int _state, int _x, int _y)
{
    // need particles to do interaction
    if (!body_.particles.empty())
    {
        // mouse button release destroys current mouse spring
        if (_state == GLUT_UP)
        {
            mouse_spring_.active = false;
        }

        // mouse button press generates new mouse spring
        else if (_state == GLUT_DOWN)
        {
            // get point under mouse cursor
            vec2 p = pick(_x, _y);

            // find closest particle
            int   pidx = -1;
            float dmin = FLT_MAX;
            for (unsigned int i=0; i<body_.particles.size(); ++i)
            {
                float d = norm(p - body_.particles[i].position);
                if (d < dmin)
                {
                    dmin = d;
                    pidx = i;
                }
            }

            // construct mouse spring
            mouse_spring_.mouse_position = p;
            mouse_spring_.particle_index = pidx;
            mouse_spring_.active = true;
        }
    }

    glutPostRedisplay();
}
开发者ID:AlexVeuthey,项目名称:acg15,代码行数:39,代码来源:Mass_spring_viewer.cpp


示例14: LLOG

void CoWork::Pool::DoJob(MJob& job)
{
	job.UnlinkAll();
	LLOG("DoJob (CoWork " << FormatIntHex(job.work) << ")");
	finlock = false;
	Function<void ()> fn = pick(job.fn);
	Free(job);
	CoWork *work = job.work;
	lock.Leave();
	fn();
	if(!finlock)
		lock.Enter();
	if(!work)
		return;
	if(--work->todo == 0) {
		LLOG("Releasing waitforfinish of (CoWork " << FormatIntHex(work) << ")");
		work->waitforfinish.Signal();
	}
	LLOG("DoJobA, todo: " << work->todo << " (CoWork " << FormatIntHex(work) << ")");
	ASSERT(work->todo >= 0);
	LLOG("Finished, remaining todo " << work->todo);
}
开发者ID:koz4k,项目名称:soccer,代码行数:22,代码来源:CoWork.cpp


示例15: initStyleOption

bool TTimeSlider::event(QEvent* event) {

	if (event->type() == QEvent::ToolTip) {
		QHelpEvent* help_event = static_cast<QHelpEvent*>(event);
		QStyleOptionSlider opt;
		initStyleOption(&opt);
        // Rect of handle/knob
        const QRect sliderRect = style()->subControlRect(
            QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
        // Center of handle
		const QPoint center = sliderRect.center() - sliderRect.topLeft();

		int val = pixelPosToRangeValue(pick(help_event->pos() - center));
        int time = qRound(val * _duration / maximum());
        QToolTip::showText(help_event->globalPos(), Helper::formatTime(time),
                           this);
		event->accept();
		return true;
	}

	return QWidget::event(event);
}
开发者ID:wilbert2000,项目名称:wzplayer,代码行数:22,代码来源:timeslider.cpp


示例16: switch

//事件处理函数
bool CPickHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
	switch(ea.getEventType())
	{
		//每一帧
	case(osgGA::GUIEventAdapter::FRAME):
		{
			osg::ref_ptr<osgViewer::Viewer> viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
			//得到视图矩阵
			viewer ->getCamera() ->getViewMatrixAsLookAt(position, center, up) ;
			if (viewer)
			{	
				//执行PICK动作
				pick(viewer.get(),ea);
			}
			return false;
		}    
	default:
		return false;
	}

}
开发者ID:KevinGuo0211,项目名称:OSG,代码行数:23,代码来源:PickHandler.cpp


示例17: pick

void GlWidget::mousePressEvent(QMouseEvent *event)
{
  _lastPos = event->pos();

  pick(event->pos());
  if (_selection >= 0)
  {
    if (event->button() == Qt::RightButton)
    {
      Cube *cube = _cubes[_selection];
      QColor color = QColorDialog::getColor(cube ->color(), this);
      if (color.isValid())
        cube->setColor(color);
    }
    if (event->button() == Qt::LeftButton)
    {
      Cube *cube = _cubes[_selection];
      RotationSelector selector(cube, this);
      selector.exec();
    }
  }
}
开发者ID:pol51,项目名称:openGL-picking,代码行数:22,代码来源:glWidget.cpp


示例18: Clear

int MIValue::ParseArray(String const &s, int i)
{
	Clear();
	type = MIArray;
	
	// drop opening delimiter
	if(!expect("ParseArray", '[', i, s))
		return s.GetCount();
	i++;
	while(s[i] && isspace(s[i]))
		i++;
	while(s[i] && s[i] != ']')
	{
		while(s[i] && isspace(s[i]))
			i++;
		String name;
		MIValue val;
		if(s[i] == '[')
			i = val.ParseArray(s, i);
		else if(s[i] == '{')
			i = val.ParseTuple(s, i);
		else if(s[i] == '"')
			i = val.ParseString(s, i);
		else if(s[i] == '<')
			i = val.ParseAngle(s, i);
		else
			i = ParsePair(name, val, s, i);
		array.Add() = pick(val);
		while(s[i] && isspace(s[i]))
			i++;
		if(s[i] == ']')
			break;
		if(!expect("ParseArray", ',', i, s))
			return s.GetCount();
		i++;
	}
	return i + 1;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:38,代码来源:MIValue.cpp


示例19: Q_ASSERT

bool QToolBarAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *item)
{
    Q_ASSERT(path.count() == 2);
    int j = path.first();
    if (j == lines.count())
        lines.append(QToolBarAreaLayoutLine(o));

    QToolBarAreaLayoutLine &line = lines[j];
    const int k = path.at(1);

    QToolBarAreaLayoutItem gap_item;
    gap_item.gap = true;
    gap_item.widgetItem = item;

    //update the previous item's preferred size
    for(int p = k - 1 ; p >= 0; --p) {
        QToolBarAreaLayoutItem &previous = line.toolBarItems[p];
        if (!previous.skip()) {
            //we found the previous one
            int previousSizeHint = pick(line.o, previous.sizeHint());
            int previousExtraSpace = previous.size - previousSizeHint;

            if (previousExtraSpace > 0) {
                //in this case we reset the space
                previous.preferredSize = -1;
                previous.size = previousSizeHint;

                gap_item.resize(o, previousExtraSpace);
            }

            break;
        }
    }

    line.toolBarItems.insert(k, gap_item);
    return true;

}
开发者ID:2011fuzhou,项目名称:vlc-2.1.0.subproject-2010,代码行数:38,代码来源:qtoolbararealayout.cpp


示例20: handle

    bool handle( const osgGA::GUIEventAdapter& ea,
            osgGA::GUIActionAdapter& aa )
    {
        osgViewer::Viewer* viewer =
                dynamic_cast<osgViewer::Viewer*>( &aa );
        if (!viewer)
            return false;

        switch( ea.getEventType() )
        {
            case osgGA::GUIEventAdapter::PUSH:
            case osgGA::GUIEventAdapter::MOVE:
            {
                // Record mouse location for the button press
                //   and move events.
                _mX = ea.getX();
                _mY = ea.getY();
                return false;
            }
            case osgGA::GUIEventAdapter::RELEASE:
            {
                // If the mouse hasn't moved since the last
                //   button press or move event, perform a
                //   pick. (Otherwise, the trackball
                //   manipulator will handle it.)
                if (_mX == ea.getX() && _mY == ea.getY())
                {
                    if (pick( ea.getXnormalized(),
                                ea.getYnormalized(), viewer ))
                        return true;
                }
                return false;
            }    

            default:
                return false;
        }
    }
开发者ID:amiri1981,项目名称:osgqsg,代码行数:38,代码来源:PickingMain.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pickBestPlan函数代码示例发布时间:2022-05-30
下一篇:
C++ pic_obj_value函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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