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

C++ setDown函数代码示例

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

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



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

示例1: switch

 void PlayerInputStruct::fromGameEvent(const GameControl &control, bool state)
 {
     switch(control)
     {
         case GameControl::ACTION:
             setAction(state);
             break;
         case GameControl::UP:
             if(state)
                 setUp(100000);
             else
                 setUp(0);
             break;
         case GameControl::DOWN:
             if(state)
                 setDown(100000);
             else
                 setDown(0);
             break;
         case GameControl::LEFT:
             if(state)
                 setLeft(100000);
             else
                 setLeft(0);
             break;
         case GameControl::RIGHT:
             if(state)
                 setRight(100000);
             else
                 setRight(0);
             break;
         case GameControl::BUTTON1:
             setButton1(state);
             break;
         case GameControl::BUTTON2:
             setButton2(state);
             break;
         case GameControl::BUTTON3:
             setButton3(state);
             break;
         case GameControl::BUTTON4:
             setButton4(state);
             break;
         case GameControl::BUTTON5:
             setButton5(state);
             break;
         case GameControl::BUTTON6:
             setButton6(state);
             break;
         default:
             //Nothing to do; control is not handled by the automatic conversion.
             break;
     }
 }
开发者ID:maximaximal,项目名称:piga,代码行数:54,代码来源:PlayerInput.cpp


示例2: middleMouseClicked

void ToolButton::mouseReleaseEvent(QMouseEvent* e)
{
    m_pressTimer.stop();

    if (e->button() == Qt::MiddleButton && rect().contains(e->pos())) {
        emit middleMouseClicked();
        setDown(false);
    }
    else if (e->button() == Qt::LeftButton && rect().contains(e->pos()) && e->modifiers() == Qt::ControlModifier) {
        emit controlClicked();
        setDown(false);
    } else {
        QToolButton::mouseReleaseEvent(e);
    }
}
开发者ID:kkofler,项目名称:qupzilla,代码行数:15,代码来源:toolbutton.cpp


示例3: qDebug

Snake::Snake():AnimUT()
{
#ifdef debug
    qDebug("Snake launched");
#endif

    controls->addAnimationControl(animate, 200);

    cellSize = 15;
    nbCells = 20;

    // controls
    snakeItem = new SnakeItem(cellSize, nbCells);

    controls->addLabel("Movements");
    QPushButton *upBtn = controls->addButton("Up");
    connect(upBtn, SIGNAL(released()), snakeItem, SLOT(setUp()));
    QPushButton *downBtn = controls->addButton("Down");
    connect(downBtn, SIGNAL(released()), snakeItem, SLOT(setDown()));
    QPushButton *leftBtn = controls->addButton("Left");
    connect(leftBtn, SIGNAL(released()), snakeItem, SLOT(setLeft()));
    QPushButton *rightBtn = controls->addButton("Right");
    connect(rightBtn, SIGNAL(released()), snakeItem, SLOT(setRight()));

    controls->addDivider();

    score = controls->addLabel("Score : 0");
    connect(snakeItem, SIGNAL(updateScore(int)), this, SLOT(updateScore(int)));

    // viewer
    drawBorders();
    viewer->addItem(snakeItem);
}
开发者ID:christophe-r,项目名称:UTBM-QtFramework-AnimUT,代码行数:33,代码来源:Snake.cpp


示例4: QDrag

void QgsFontButton::mouseMoveEvent( QMouseEvent *e )
{
  //handle dragging fonts from button

  if ( !( e->buttons() & Qt::LeftButton ) )
  {
    //left button not depressed, so not a drag
    QToolButton::mouseMoveEvent( e );
    return;
  }

  if ( ( e->pos() - mDragStartPosition ).manhattanLength() < QApplication::startDragDistance() )
  {
    //mouse not moved, so not a drag
    QToolButton::mouseMoveEvent( e );
    return;
  }

  //user is dragging font
  QDrag *drag = new QDrag( this );
  switch ( mMode )
  {
    case ModeTextRenderer:
      drag->setMimeData( mFormat.toMimeData() );
      break;

    case ModeQFont:
      drag->setMimeData( QgsFontUtils::toMimeData( mFont ) );
      break;
  }
  drag->setPixmap( createDragIcon() );
  drag->exec( Qt::CopyAction );
  setDown( false );
}
开发者ID:cz172638,项目名称:QGIS,代码行数:34,代码来源:qgsfontbutton.cpp


示例5: setButtonBackground

void QgsColorButton::mouseMoveEvent( QMouseEvent *e )
{
  if ( mPickingColor )
  {
    setButtonBackground( sampleColor( e->globalPos() ) );
    e->accept();
    return;
  }

  //handle dragging colors from button
  QColor c = linkedProjectColor();
  if ( !c.isValid() )
    c = mColor;

  if ( !( e->buttons() & Qt::LeftButton ) || !c.isValid() )
  {
    //left button not depressed or no color set, so not a drag
    QToolButton::mouseMoveEvent( e );
    return;
  }

  if ( ( e->pos() - mDragStartPosition ).manhattanLength() < QApplication::startDragDistance() )
  {
    //mouse not moved, so not a drag
    QToolButton::mouseMoveEvent( e );
    return;
  }

  //user is dragging color
  QDrag *drag = new QDrag( this );
  drag->setMimeData( QgsSymbolLayerUtils::colorToMimeData( c ) );
  drag->setPixmap( QgsColorWidget::createDragIcon( c ) );
  drag->exec( Qt::CopyAction );
  setDown( false );
}
开发者ID:dmarteau,项目名称:QGIS,代码行数:35,代码来源:qgscolorbutton.cpp


示例6: p

void QuickButton::mouseMoveEvent(QMouseEvent *e)
{
    if((e->state() & LeftButton) == 0)
        return;
    QPoint p(e->pos() - _dragPos);
    if(p.manhattanLength() <= KGlobalSettings::dndEventDelay())
        return;
    DEBUGSTR << "dragstart" << endl << flush;
    setDown(false);
    if(_dragEnabled)
    {
        KURL::List uris;
        uris.append(_qurl->kurl());
        DEBUGSTR << "creating KURLDrag" << endl << flush;
        KURLDrag *dd = new KURLDrag(uris, this);
        dd->setPixmap(_icon); // PIX
        DEBUGSTR << "ready to drag" << endl << flush;
        grabKeyboard();
        dd->drag();
        releaseKeyboard();
    }
    else
    {
        setCursor(Qt::ForbiddenCursor);
    }
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:26,代码来源:quickbutton.cpp


示例7: setDown

void ToolButton::mousePressEvent(QMouseEvent* e)
{
    if (popupMode() == QToolButton::DelayedPopup)
        m_pressTimer.start();

    if (e->buttons() == Qt::LeftButton && menu() && popupMode() == QToolButton::InstantPopup) {
        setDown(true);
        showMenu();
    }
    else if (e->buttons() == Qt::RightButton && menu()) {
        setDown(true);
        showMenu();
    } else {
        QToolButton::mousePressEvent(e);
    }
}
开发者ID:kkofler,项目名称:qupzilla,代码行数:16,代码来源:toolbutton.cpp


示例8: Q_D

/*! \reimp */
void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
{
    Q_D(QAbstractButton);
    d->pressed = false;

    if (e->button() != Qt::LeftButton) {
        e->ignore();
        return;
    }

    if (!d->down) {
        // refresh is required by QMacStyle to resume the default button animation
        d->refresh();
        e->ignore();
        return;
    }

    if (hitButton(e->pos())) {
        d->repeatTimer.stop();
        d->click();
        e->accept();
    } else {
        setDown(false);
        e->ignore();
    }
}
开发者ID:ghjinlei,项目名称:qt5,代码行数:27,代码来源:qabstractbutton.cpp


示例9: QDrag

void SiteIcon::mouseMoveEvent(QMouseEvent* e)
{
    if (!m_locationBar || e->buttons() != Qt::LeftButton) {
        ToolButton::mouseMoveEvent(e);
        return;
    }

    int manhattanLength = (e->pos() - m_dragStartPosition).manhattanLength();
    if (manhattanLength <= QApplication::startDragDistance()) {
        ToolButton::mouseMoveEvent(e);
        return;
    }

    const QUrl url = m_locationBar->webView()->url();
    const QString title = m_locationBar->webView()->title();

    if (url.isEmpty() || title.isEmpty()) {
        ToolButton::mouseMoveEvent(e);
        return;
    }

    QDrag* drag = new QDrag(this);
    QMimeData* mime = new QMimeData;
    mime->setUrls(QList<QUrl>() << url);
    mime->setText(title);
    mime->setImageData(icon().pixmap(16).toImage());

    drag->setMimeData(mime);
    drag->setPixmap(QzTools::createPixmapForSite(icon(), title, url.toString()));
    drag->exec();

    // Restore Down state
    setDown(false);
}
开发者ID:Acidburn0zzz,项目名称:qupzilla,代码行数:34,代码来源:siteicon.cpp


示例10: keySequence

void KeySequenceWidget::startRecording()
{
	keySequence() = KeySequence();
	setDown(true);
	setFocus();
	grabKeyboard();
	setStatus(Recording);
}
开发者ID:335,项目名称:synergy,代码行数:8,代码来源:KeySequenceWidget.cpp


示例11: QPushButton

UWPButton::UWPButton(QWidget *parent)
: QPushButton(parent)
{
    setDown(false);
    setFocusPolicy(Qt::NoFocus);
    res = 0.9;
    //qDebug() << res;
}
开发者ID:FlyingRope,项目名称:Tomato,代码行数:8,代码来源:uwpbutton.cpp


示例12: Shows

/*!
    Shows (pops up) the associated popup menu. If there is no such
    menu, this function does nothing. This function does not return
    until the popup menu has been closed by the user.
*/
void QPushButton::showMenu()
{
    Q_D(QPushButton);
    if (!d || !d->menu)
        return;
    setDown(true);
    d->_q_popupPressed();
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:13,代码来源:qpushbutton.cpp


示例13: setDown

void MToolButton::setButtonPressed(bool press)
{
    if(!bCommon)
    {
        bPress = press;
        setDown(press);
    }
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:8,代码来源:mToolButton.cpp


示例14: setDown

void QgsRatioLockButton::buttonClicked()
{
  mLocked = !mLocked;
  setDown( mLocked );

  emit lockChanged( mLocked );

  drawButton();
}
开发者ID:giohappy,项目名称:QGIS,代码行数:9,代码来源:qgsratiolockbutton.cpp


示例15: setDown

void KColorButton::mouseMoveEvent( QMouseEvent *e)
{
  if( (e->buttons() & Qt::LeftButton) &&
    (e->pos()-d->mPos).manhattanLength() > KGlobalSettings::dndEventDelay() )
  {
    KColorMimeData::createDrag(color(),this)->start();
    setDown(false);
  }
}
开发者ID:aymara,项目名称:lima,代码行数:9,代码来源:kcolorbutton.cpp


示例16: setDown

void winlist::mousePressEvent(QMouseEvent *event)
{
	if(event->button() == QMouseEvent::RightButton)  // hidden to foreground
	{
		setDown(TRUE);
		hidden_win();
	}
	else if(event->button() == QMouseEvent::LeftButton)
		start_popup();
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:10,代码来源:winlist.cpp


示例17: wnm

void winlist::popup_list(void)
{
	xwindow *win;
	QString wname;
	Window rw,cw;
	int rx,ry,wx,wy;
	unsigned mr;

	for(win = clients.first(); win != NULL; win = clients.next())
	{
		if(win->iswithdrawn() || ((win->get_pflags() & qapp::WindowListSkip) && ! win->hidden_win()))
			continue;

		wname = "";
		QTextOStream wnm(&wname);
		
		if(! win->isVisible())
			wnm << '<';
			
		wnm << win->ccaption().left(100);

		if(! win->isVisible())
			wnm << '>';

	 	if(win->get_tnumber())
			wnm << '<' << win->get_tnumber() << '>';
		
		if(! win->getmachine().isNull())
			wnm << " (" << win->getmachine().left(20) << ')';
			
		wmenu->insertItem(wname, win, SLOT(focus_mouse_wlist()), 0, clients.at());
	}

	if(! defaults::show_winlist || qapp::smode)  // show at mouse position
	{
		XQueryPointer(qt_xdisplay(), qt_xrootwin(), &rw, &cw, &rx, &ry, &wx, &wy, &mr);
		wmenu->exec(QPoint(rx, ry));
	}
	else
	{
		if(! defaults::toolbar_top)   // menu above button
		{
			QPoint p = mapToGlobal(QPoint(0, 0));
			QSize s(wmenu->sizeHint());
			p.setY(p.y()-s.height());
			wmenu->exec(p);
		}
		else
			wmenu->exec(mapToGlobal(QPoint(0, height())));
	}		
		
	wmenu->clear();
	setDown(FALSE);
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:54,代码来源:winlist.cpp


示例18: switch

void QButton::keyPressEvent( QKeyEvent *e )
{
    switch ( e->key() ) {
    case Key_Enter:
    case Key_Return:
	if ( inherits("QPushButton") )
	    emit clicked();
	else
	    e->ignore();
	break;
    case Key_Space:
	if ( !e->isAutoRepeat() ) {
	    if ( got_a_release )
		setDown( TRUE );
	    else {
		buttonDown = TRUE;
		repaint( FALSE );
	    }
	    if ( inherits("QPushButton") )
		emit pressed();
	    else
		e->ignore();
	}
	break;
    case Key_Up:
    case Key_Left:
#ifndef QT_NO_BUTTONGROUP
	if ( group() )
	    group()->moveFocus( e->key() );
	else
#endif
	    focusNextPrevChild( FALSE );
	break;
    case Key_Right:
    case Key_Down:
#ifndef QT_NO_BUTTONGROUP
	if ( group() )
	    group()->moveFocus( e->key() );
	else
#endif
	    focusNextPrevChild( TRUE );
	break;
    case Key_Escape:
	if ( buttonDown ) {
	    buttonDown = FALSE;
	    update();
	    break;
	}
	// fall through
    default:
	e->ignore();
    }
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:53,代码来源:qbutton.cpp


示例19: setDown

void AMControlMoveButton::press(bool down)
{
	if(!isEnabled())
		return;

	// press
	if(down) {
		if(!isDown()) {
			setDown(true);
			emit pressed();
		}
	}
	// release, only if already pressed.
	else {
		if(isDown()) {
			setDown(false);
			emit released();
			emit clicked();
		}
	}
}
开发者ID:acquaman,项目名称:acquaman,代码行数:21,代码来源:AMControlMoveButton.cpp


示例20: setItemMode

/*!
    Check/Uncheck a the item

    \param on check/uncheck
    \sa setItemMode()
*/
void QwtLegendLabel::setChecked( bool on )
{
    if ( d_data->itemMode == QwtLegendData::Checkable )
    {
        const bool isBlocked = signalsBlocked();
        blockSignals( true );

        setDown( on );

        blockSignals( isBlocked );
    }
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:18,代码来源:qwt_legend_label.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setDragDropMode函数代码示例发布时间:2022-05-30
下一篇:
C++ setDoubleParam函数代码示例发布时间: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