本文整理汇总了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;
}
}
示例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);
}
}
示例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);
}
示例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 );
}
示例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 );
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
示例10: keySequence
void KeySequenceWidget::startRecording()
{
keySequence() = KeySequence();
setDown(true);
setFocus();
grabKeyboard();
setStatus(Recording);
}
示例11: QPushButton
UWPButton::UWPButton(QWidget *parent)
: QPushButton(parent)
{
setDown(false);
setFocusPolicy(Qt::NoFocus);
res = 0.9;
//qDebug() << res;
}
示例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();
}
示例13: setDown
void MToolButton::setButtonPressed(bool press)
{
if(!bCommon)
{
bPress = press;
setDown(press);
}
}
示例14: setDown
void QgsRatioLockButton::buttonClicked()
{
mLocked = !mLocked;
setDown( mLocked );
emit lockChanged( mLocked );
drawButton();
}
示例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);
}
}