本文整理汇总了C++中buttonPressed函数的典型用法代码示例。如果您正苦于以下问题:C++ buttonPressed函数的具体用法?C++ buttonPressed怎么用?C++ buttonPressed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buttonPressed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onRotateRight
void RadioMMI::readInput()
{
long newPos;
newPos = mEncoder->read();
if (newPos != mEncoderPosition) {
if (0 == newPos % 4) {
if (newPos > mEncoderPosition) {
mEncoderPosition = newPos;
onRotateRight();
} else if(newPos < mEncoderPosition) {
mEncoderPosition = newPos;
onRotateLeft();
}
}
}
if (!buttonPressed()) {
mButtonState = NOT_PRESSED;
} else if (buttonPressed()
&& mButtonState == NOT_PRESSED) {
mButtonState = PRESSED;
mButtonDownSince = millis();
onPressed();
} else if (buttonPressed()
&& mButtonState == PRESSED
&& ((millis() - mButtonDownSince) > 1000)) {
mButtonState = LONG_PRESSED;
onLongPressed();
}
}
示例2: connect
void TopBoardConnectors_Controller::setConmutadorPuestaServicio(SingleButton *conmutador,SingleButton *luzLlaveDes,SingleButton *luzLlaveCon, SingleButton *arranqueDes,SingleButton *arranqueCon){
m_conmutador = conmutador;
m_conmutador->setButtonImage(QUrl("qrc:/resources/techo_manual_up.png"),QUrl("qrc:/resources/techo_manual_down.png"));
m_luzLlaveDes = luzLlaveDes;
m_luzLlaveDes->setButtonImage(QUrl("qrc:/resources/greenON_DES_techo.png"),QUrl("qrc:/resources/green_DES_techo.png"));
m_luzLlaveDes->setClickeable(false);
m_luzLlaveCon = luzLlaveCon;
m_luzLlaveCon->setButtonImage(QUrl("qrc:/resources/redON_CON_techo.png"),QUrl("qrc:/resources/red_CON_techo.png"));
m_luzLlaveCon->setClickeable(false);
m_arranqueDes = arranqueDes;
m_arranqueDes->setButtonImage(QUrl("qrc:/resources/greenON_DES_techo.png"),QUrl("qrc:/resources/green_DES_techo.png"));
m_arranqueDes->setClickeable(false);
m_arranqueCon = arranqueCon;
m_arranqueCon->setButtonImage(QUrl("qrc:/resources/redON_CON_techo.png"),QUrl("qrc:/resources/red_CON_techo.png"));
m_arranqueCon->setClickeable(false);
m_conmutadorPuestaServicioStatus = false;
m_subte->setConmutadorPuestaServicio(m_conmutadorPuestaServicioStatus);
connect(m_conmutador,SIGNAL(buttonPressed()),this,SLOT(conmutadorPuestaServicioPressed()));
connect(m_arranqueCon,SIGNAL(buttonPressed()),this,SLOT(conmutadorPuestaServicioAutomaticaConPressed()));
connect(m_arranqueDes,SIGNAL(buttonPressed()),this,SLOT(conmutadorPuestaServicioAutomaticaDesPressed()));
}
示例3: button_callback
void button_callback(void) {
if (buttonPressed()) {
delayMilliseconds(50); // wait 50ms for debounce
if(buttonPressed())
{
change=1;
}
}
}
示例4: buttonPressed
void LircRemoteControl::commandReceived(const QString &remote, const QString &button, int repeatCounter){
if(remote == d->name){
if(lircButtonToRemoteControlButton(button) != RemoteControlButton::Unknown){
emit buttonPressed(RemoteControlButton(remote, lircButtonToRemoteControlButton(button), repeatCounter));
} else {
emit buttonPressed(RemoteControlButton(remote, formatNamespaceButton(button), repeatCounter));
}
}
}
示例5: readGrooveboxButtons
void readGrooveboxButtons() {
if (buttonPressedNew(BUTTON1) && (!buttonPressed(BUTTON4))) {
// start/stop live sequencer groovebox
if (!seqRunning) {
resetGroovebox();
seqSynchStart = true;
while ((buttonHeld(BUTTON1)) && (seqSynchStart)) {
// wait until the button is released or until a MIDI event triggers the start
if (buttonPressed(BUTTON4)) {
// save procedure
return;
}
#ifdef MIDI_ENABLE
MIDI.read();
#endif
#ifdef USBMIDI_ENABLE
USBMIDI.read();
#endif
}
}
seqSynchStart = false;
seqRunning = !seqRunning;
if (!seqRunning) {
stopSequencer();
}
}
if (buttonPressedNew(BUTTON2)) {
// clear the sequence notes on this track.
for(byte i=0;i<SEQ_LENGTH;i++) {
seq[i][currentTrack].midiVal = UNSET;
seq[i][currentTrack].transpose = 0;
}
}
if ((buttonPressedNew(BUTTON3)) && (seqRunning)) {
seqPreview = !seqPreview;
}
if (seqPreview) {
ledState[PREVIEW_LED] = HIGH;
}
if (buttonPressedNew(BUTTON4)) {
metronomeMode = (metronomeMode + 1) % 3;
if ((metronomeMode == METRONOME_MODE_OFF) && (metronomeNoteIndex != UNSET)) {
stopNote(metronomeNoteIndex);
metronomeNoteIndex = UNSET;
}
}
}
示例6: repaint
void ToolBarButton::mouseReleaseEvent(QMouseEvent *event)
{
event->ignore(); // Move event goes to ToolBarWidget
if (isToggleButton()) {
// Leave tool buttons pressed
}
else {
// Lift other buttons back to up
pressed = false;
repaint();
if (toolbarwidget->dockingDone) {
// User was only moving toolbar, do not open dialogs
}
else {
// Open dialogs
// Send button pressed signal for dialog and undo/new buttons
if (isDialogButton() || type == ToolBarButton::ENew || type != ToolBarButton::EMMS) {
emit buttonPressed(type);
}
}
}
QWidget::mouseReleaseEvent(event);
}
示例7: connect
void RaspiLcdWidget::registerKey(QAbstractButton *butt, keyType key)
{
m_butList.append(butt);
m_keyList.append(key);
connect(butt,SIGNAL(pressed()),this,SLOT(buttonPressed()));
connect(butt,SIGNAL(released()),this,SLOT(buttonReleased()));
}
示例8: Q_CHECK_PTR
int QButtonGroup::insert( QButton *button, int id )
{
if ( button->group() )
button->group()->remove( button );
static int seq_no = -2;
QButtonItem *bi = new QButtonItem;
Q_CHECK_PTR( bi );
if ( id < -1 )
bi->id = seq_no--;
else if ( id == -1 )
bi->id = buttons->count();
else
bi->id = id;
bi->button = button;
button->setGroup(this);
buttons->append( bi );
connect( button, SIGNAL(pressed()) , SLOT(buttonPressed()) );
connect( button, SIGNAL(released()), SLOT(buttonReleased()) );
connect( button, SIGNAL(clicked()) , SLOT(buttonClicked()) );
connect( button, SIGNAL(toggled(bool)) , SLOT(buttonToggled(bool)) );
if ( button->isToggleButton() && !button->isOn() &&
selected() && (selected()->focusPolicy() & TabFocus) != 0 )
button->setFocusPolicy( (FocusPolicy)(button->focusPolicy() &
~TabFocus) );
return bi->id;
}
示例9: moveBy
void Button::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
moveBy(0, -1);
mPressedEffect->setOffset(0, 2);
if (boundingRect().contains(event->pos()))
emit buttonPressed();
}
示例10: QDialog
encodingWindow::encodingWindow(QWidget *parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint)
{
ui.setupUi(this);
#ifndef _WIN32
//check for root privileges
if (getuid() == 0)
{
// set priority to normal, regardless of preferences
ui.comboBoxPriority->setCurrentIndex(2);
}
#endif
connect(ui.checkBoxShutdown, SIGNAL(stateChanged(int)), this, SLOT(shutdownChanged(int)));
connect(ui.pushButton, SIGNAL(pressed()), this, SLOT(buttonPressed()));
connect(ui.comboBoxPriority, SIGNAL(currentIndexChanged(int)), this, SLOT(priorityChanged(int)));
// set priority
uint32_t priority;
prefs->get(PRIORITY_ENCODING,&priority);
#ifndef _WIN32
// check for root privileges
if (getuid() == 0)
{
ui.comboBoxPriority->setCurrentIndex(priority);
}
#else
ui.comboBoxPriority->setCurrentIndex(priority);
#endif
}
示例11: switch
int WebcamWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QGLWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: sliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
case 1: buttonPressed((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
case 2: buttonPressed(); break;
default: ;
}
_id -= 3;
}
return _id;
}
示例12: updatePaddle1
void updatePaddle1(){
//check for UP button press
if (buttonPressed(64))
{
if (paddleY[1] > 10)
paddleY[1] -= PADDLE_SPEED;
}
//check for DOWN button press
if (buttonPressed(128))
{
if (paddleY[1] < SCREEN_H - PADDLE_HEIGHT - 1)
paddleY[1] += PADDLE_SPEED;
}
}
示例13: QDialog
KGncPriceSourceDlg::KGncPriceSourceDlg(const QString &stockName, const QString& gncSource, QWidget * parent) : QDialog(parent), d(new Private)
{
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Help);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
d->widget = new KGncPriceSourceDlgDecl();
mainLayout->addWidget(d->widget);
// signals and slots connections
connect(d->widget->buttonsSource, SIGNAL(buttonClicked(int)), this, SLOT(buttonPressed(int)));
connect(this, SIGNAL(helpClicked()), this, SLOT(slotHelp()));
// initialize data fields
d->widget->textStockName->setText(i18n("Investment: %1", stockName));
d->widget->textGncSource->setText(i18n("Quote source: %1", gncSource));
d->widget->listKnownSource->clear();
d->widget->listKnownSource->insertItems(0, WebPriceQuote::quoteSources());
d->widget->lineUserSource->setText(gncSource);
d->widget->checkAlwaysUse->setChecked(true);
d->widget->buttonsSource->setId(d->widget->buttonNoSource, 0);
d->widget->buttonsSource->setId(d->widget->buttonSelectSource, 1);
d->widget->buttonsSource->setId(d->widget->buttonUserSource, 2);
d->widget->buttonsSource->button(0)->setChecked(true);
mainLayout->addWidget(buttonBox);
buttonPressed(0);
return;
}
示例14: repaint
void ToolBarButton::mouseReleaseEvent(QMouseEvent *event)
{
event->accept(); // Event does not go to parent ToolBarWidget
if (isToolButton()) {
// Leave tool buttons pressed
}
else {
// Lift other buttons back to up
pressed = false;
repaint();
if (acceptMouseMove) {
// User was only moving toolbar, do not open dialogs
acceptMouseMove = false;
}
else {
// Open dialogs
// Send button pressed signal for dialog and undo/new buttons
if (isDialogButton() || type == ToolBarButton::EUndo || type == ToolBarButton::ENew) {
emit buttonPressed(type);
}
}
}
}
示例15: QWidget
AbstractEditableWidget::AbstractEditableWidget(QWidget *contentWidget, QWidget* parent)
: QWidget(parent),
m_contentWidget(contentWidget)
{
m_layout = new QHBoxLayout(this);
m_layout->setContentsMargins(0,0,0,0);
m_label = new KSqueezedTextLabel(this);
m_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
m_label->setTextElideMode(Qt::ElideRight);
m_layout->addWidget(m_label);
m_layout->addWidget(contentWidget);
m_button = new QToolButton(this);
m_button->setCheckable(false);
//m_button->setIconSize(QSize(10,10));
//m_button->setI (Qt::ToolButtonIconOnly);
connect(m_button, SIGNAL(pressed()), this, SLOT(buttonPressed()));
m_layout->addWidget(m_button);
m_layout->addStretch();
setLayout(m_layout);
display();
}