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


C++ setDown函数代码示例

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


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


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