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


C++ buttons函数代码示例

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


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

示例1: buttonIndex

/*
 *   displays a dialog with text and a close button
 */
void WebDialogProvider::showInfoDialog(QWidget *parent, const QString &label)
{
    int buttonIndex(-1);
    QStringList buttons(tr("Close"));
    WebDialogProvider dlg(label, parent, buttons, &buttonIndex);
    dlg.exec();
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:10,代码来源:WebDialogProvider.cpp

示例2: dumpMouseRelatedParams

    void dumpMouseRelatedParams(QTextStream &s, const Event &ev)
{
    s << "btn: " << button(ev) << " ";
    s << "btns: " << buttons(ev) << " ";
    s << "pos: " << qSetFieldWidth(4) << ev.x() << qSetFieldWidth(0) << "," << qSetFieldWidth(4) << ev.y() << qSetFieldWidth(0) << " ";
    s << "gpos: "  << qSetFieldWidth(4) << ev.globalX() << qSetFieldWidth(0) << "," << qSetFieldWidth(4) << ev.globalY() << qSetFieldWidth(0) << " ";
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:7,代码来源:kis_tablet_debugger.cpp

示例3: main

void main()                                  // Main function
{
  badge_setup();                             // Call badge setup

  oledprint("BUTTONS");                      // Large display heading
  text_size(SMALL);                          // Switch to small text
  cursor(0, 4);                              // Small cursor row 4
  oledprint("PAD:   6543210");               // Display bit index
  cursor(0, 5);                              // Next line
  oledprint("STATE:");                       // Display state 
  cursor(0, 7);                              // Next line
  oledprint("EXIT: Press OSH");              // User prompt to exit
  
  while(1)                                   // States loop
  {
    states = buttons();                      // Load buttons output to states
    leds(states);                            // Light up corresponding LEDs
    
    cursor(7, 5);                            // Position cursor
    oledprint("%07b", states);               // Display states as binary number
    if(states == 0b1000000) break;           // If OSH pressed, exit loop
  }
  
  pause(400);                                 // Wait for 4/10 s

  text_size(LARGE);                           // Large text
  clear();                                    // Clear display
  oledprint("ALL DONE");                      // Done message
}
开发者ID:MatzElectronics,项目名称:Simple-Libraries,代码行数:29,代码来源:03+Check+All+Buttons.c

示例4: switch

bool GlobalEventFilter::eventFilter(QObject *obj, QEvent *event) {
    switch (event->type()) {
        case QEvent::MouseButtonPress: {
            manager_.beginInteraction();
            break;
        }
        case QEvent::MouseButtonRelease: {
            auto me = static_cast<QMouseEvent *>(event);
            if (me->buttons() == Qt::NoButton) {
                manager_.endInteraction();
            }
            break;
        }
        case QEvent::TouchBegin: {
            manager_.beginInteraction();
            break;
        }
        case QEvent::TouchEnd: {
            auto te = static_cast<QTouchEvent *>(event);
            if (util::all_of(te->touchPoints(), [](const QTouchEvent::TouchPoint &tp) {
                    return tp.state() == Qt::TouchPointReleased;
                })) {
                manager_.endInteraction();
            }
            break;
        }
        default:
            break;
    }
    return QObject::eventFilter(obj, event);
}
开发者ID:ResearchDaniel,项目名称:inviwo,代码行数:31,代码来源:globaleventfilter.cpp

示例5: main

int main ()
{
    CreateMyWindow ();           //

    pictures_t pictures;         //
    LoadPictures (pictures);     //

    array_t <dyn, button_t> buttons (0);  //
    SetButtons (buttons, pictures);       //

    int buttonPressed = NothingPressed;   //

    txBegin (); //

    while (!Exit ())
    {
        DrawBackground (pictures);      //

        DoOperationsWithButtons (buttons, &buttonPressed);  //

        txSleep (1);
    }

    txEnd ();

    DeletePictures (pictures);

    _txExit = true;
    return 0;
}
开发者ID:olegsmirnov2001,项目名称:Optics-in-MGU,代码行数:30,代码来源:maintest.cpp

示例6: l

void
Gui::warningDialog(const std::string & title,
                   const std::string & text,
                   bool useHtml)
{
    ///don't show dialogs when about to close, otherwise we could enter in a deadlock situation
    {
        QMutexLocker l(&_imp->aboutToCloseMutex);
        if (_imp->_aboutToClose) {
            return;
        }
    }

    StandardButtons buttons(eStandardButtonYes | eStandardButtonNo);

    if ( QThread::currentThread() != QCoreApplication::instance()->thread() ) {
        QMutexLocker locker(&_imp->_uiUsingMainThreadMutex);
        while (_imp->_uiUsingMainThread) {
            _imp->_uiUsingMainThreadCond.wait(&_imp->_uiUsingMainThreadMutex);
        }
        ++_imp->_uiUsingMainThread;
        locker.unlock();
        Q_EMIT doDialog(1, QString::fromUtf8( title.c_str() ), QString::fromUtf8( text.c_str() ), useHtml, buttons, (int)eStandardButtonYes);
        locker.relock();
        while (_imp->_uiUsingMainThread) {
            _imp->_uiUsingMainThreadCond.wait(&_imp->_uiUsingMainThreadMutex);
        }
    } else {
        {
            QMutexLocker locker(&_imp->_uiUsingMainThreadMutex);
            ++_imp->_uiUsingMainThread;
        }
        Q_EMIT doDialog(1, QString::fromUtf8( title.c_str() ), QString::fromUtf8( text.c_str() ), useHtml, buttons, (int)eStandardButtonYes);
    }
}
开发者ID:MrKepzie,项目名称:Natron,代码行数:35,代码来源:Gui30.cpp

示例7: dialog

void MetavoxelEditor::createNewAttribute() {
    QDialog dialog(this);
    dialog.setWindowTitle("New Attribute");
    
    QVBoxLayout layout;
    dialog.setLayout(&layout);
    
    QFormLayout form;
    layout.addLayout(&form);
    
    QLineEdit name;
    form.addRow("Name:", &name);
    
    SharedObjectEditor editor(&Attribute::staticMetaObject, false);
    editor.setObject(new QRgbAttribute());
    layout.addWidget(&editor);
    
    QDialogButtonBox buttons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    dialog.connect(&buttons, SIGNAL(accepted()), SLOT(accept()));
    dialog.connect(&buttons, SIGNAL(rejected()), SLOT(reject()));
    
    layout.addWidget(&buttons);
    
    if (!dialog.exec()) {
        return;
    }
    QString nameText = name.text().trimmed();
    SharedObjectPointer attribute = editor.getObject();
    attribute->setObjectName(nameText);
    AttributeRegistry::getInstance()->registerAttribute(attribute.staticCast<Attribute>());
    
    updateAttributes(nameText);
}
开发者ID:noirsoft,项目名称:hifi,代码行数:33,代码来源:MetavoxelEditor.cpp

示例8: Play

// Get player input, rotate the ship, fire shots, move active shots
void Play(void)
{
  int But = buttons();
  
  if( But & (1<<2) )
  {
    led(2,1);
    ShipAng = (ShipAng + RotSpeed) & 0x1fff;
  }
  else
    led(2,0);

  if( But & (1<<0) )
  {
    led(0,1);
    ShipAng = (ShipAng - RotSpeed) & 0x1fff;
  }
  else
    led(0,0);


  if( ShotTimer > 0 ) {
    ShotTimer--;
  }    

  if( But & ((1<<1) | (1<<4)) ) {
    Shoot();
  }

  MoveShots();
}
开发者ID:MatzElectronics,项目名称:Simple-Libraries,代码行数:32,代码来源:Shooter.c

示例9: SetupButton

logical pc_ADK_Button :: SetupButton ( )
{
  PropertyHandle         *pbc   = GetParentProperty();
  char                   *names = NULL;
  logical                 term = NO;
  DBObjectHandle          dbo;
  names = strdup(GPH("sys_ident")->GetString());

  SetupFromParent();
  *GPH("auto_open") = YES;
  dbo = GetObjectHandle();
  PropertyHandle   buttons(dbo,"ADK_EventActionControl",PI_Read);  
  PropertyHandle   ph_default("_default");
  if ( buttons(*GPH("sys_ident")) || buttons.Get(ph_default) )
    GPH("button_control")->Add(buttons.ExtractKey());
  return(term);
}
开发者ID:BackupTheBerlios,项目名称:openaqua-svn,代码行数:17,代码来源:pc_ADK_Button.cpp

示例10: apply

void
apply(void (*f)(Icon*))
{
	Icon *icon;

	esetcursor(&sight);
	buttons(Down);
	if(mouse.buttons == 4)
		for(icon = h.first; icon; icon = icon->next)
			if(ptinrect(mouse.xy, icon->sr)){
				buttons(Up);
				f(icon);
				break;
			}
	buttons(Up);
	esetcursor(0);
}
开发者ID:dancrossnyc,项目名称:harvey,代码行数:17,代码来源:ico.c

示例11: Buttons

// ----------------------------------------------------------------------
void EventInputQueue::push_RelativePointerEventCallback(OSObject* target,
                                                        int buttons_raw,
                                                        int dx,
                                                        int dy,
                                                        AbsoluteTime ts,
                                                        OSObject* sender,
                                                        void* refcon) {
  GlobalLock::ScopedLock lk;
  if (!lk) return;

  Params_RelativePointerEventCallback::log(true, Buttons(buttons_raw), dx, dy);

  // ------------------------------------------------------------
  Buttons buttons(buttons_raw);
  Buttons justPressed;
  Buttons justReleased;

  IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
  if (!device) return;

  ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get(device));
  if (!item) return;

  // ------------------------------------------------------------
  CommonData::setcurrent_ts(ts);

  // ------------------------------------------------------------
  justPressed = buttons.justPressed(item->get_previousbuttons());
  justReleased = buttons.justReleased(item->get_previousbuttons());
  item->set_previousbuttons(buttons);

  // ------------------------------------------------------------
  // divide an event into button and cursormove events.
  for (int i = 0; i < ButtonStatus::MAXNUM; ++i) {
    PointingButton btn(1 << i);
    if (justPressed.isOn(btn)) {
      Params_RelativePointerEventCallback params(buttons, 0, 0, btn, true);
      bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
      enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
    }
    if (justReleased.isOn(btn)) {
      Params_RelativePointerEventCallback params(buttons, 0, 0, btn, false);
      bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
      enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
    }
  }
  // If (dx == 0 && dy == 0), the event is either needless event or just pressing/releasing buttons event.
  // About just pressing/releasing buttons event, we handled these in the above processes.
  // So, we can drop (dx == 0 && dy == 0) events in here.
  if (dx != 0 || dy != 0) {
    Params_RelativePointerEventCallback params(buttons, dx, dy, PointingButton::NONE, false);
    bool retainFlagStatusTemporaryCount = true;
    enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
  }

  setTimer();
}
开发者ID:piaowenjie,项目名称:Karabiner,代码行数:58,代码来源:EventInputQueue.cpp

示例12: buttons

void FEHWONKA::InitializeMenu()
{
	ButtonBoard buttons( FEHIO::Bank3 );

	char region = 'A';

	LCD.Clear();
	LCD.WriteLine( "Use LEFT / RIGHT to change region" );
	LCD.WriteLine( "Use MIDDLE to select" );
	LCD.Write( "Region: " );
	LCD.WriteLine( region );

	// wait for user to press middle button
	while( !buttons.MiddlePressed() )
	{
		if( buttons.LeftPressed() )
		{
			region--;
			if( region < 'A' )
			{
				region = 'L';
			}
			LCD.Clear();
			LCD.WriteLine( "Use LEFT / RIGHT to change region" );
			LCD.WriteLine( "Use MIDDLE to select" );
			LCD.Write( "Region: " );
			LCD.WriteLine( region );

			while( buttons.LeftPressed() );
			Sleep( 100 );
		}

		if( buttons.RightPressed() )
		{
			region++;
			if( region > 'L' )
			{
				region = 'A';
			}
			LCD.Clear();
			LCD.WriteLine( "Use LEFT / RIGHT to change region" );
			LCD.WriteLine( "Use MIDDLE to select" );
			LCD.Write( "Region: " );
			LCD.WriteLine( region );

			while( buttons.RightPressed() );
			Sleep( 100 );
		}
	}

	Initialize( region );

	while( buttons.MiddlePressed() );
	Sleep( 1000 );
}
开发者ID:reynoldsbd3,项目名称:robot-d5,代码行数:55,代码来源:FEHWONKA.cpp

示例13: buttons

void AboutDialog::enableButtons(void)
{
    const QList<QAbstractButton*> buttonList = buttons();

    for(int i = 0; i < buttonList.count(); i++)
    {
        buttonList.at(i)->setEnabled(true);
    }

    setCursor(QCursor(Qt::ArrowCursor));
}
开发者ID:arestarh,项目名称:LameXP,代码行数:11,代码来源:Dialog_About.cpp

示例14: KCModule

Module::Module(QWidget *parent, const QVariantList &args)
    : KCModule(parent, args)
    , ui(new Ui::Module)
    , m_manager(new DriverManager(this))
{
    KAboutData *aboutData = new KAboutData("kcm-driver-manager",
                                    i18n("Driver Manager"),
                                    global_s_versionStringFull,
                                    QStringLiteral(""),
                                    KAboutLicense::LicenseKey::GPL_V3,
                                    i18n("Copyright 2013 Rohan Garg"));

    aboutData->addAuthor(i18n("Rohan Garg"), i18n("Author"), QStringLiteral("[email protected]"));
    aboutData->addAuthor(i18n("Harald Sitter"), i18n("Qt 5 port"), QStringLiteral("[email protected]"));

    setAboutData(aboutData);

    // We have no help so remove the button from the buttons.
    setButtons(buttons() ^ KCModule::Help);

    ui->setupUi(this);
    ui->progressBar->setVisible(false);
    connect(ui->reloadButton, SIGNAL(clicked(bool)), SLOT(load()));

    m_overlay = new KPixmapSequenceOverlayPainter(this);
    m_overlay->setWidget(this);

#warning variable name
    QString label = xi18nc("@title/rich", "<title>Your computer requires no proprietary drivers</title>");
    m_label = new QLabel(label, this);
    m_label->hide();
    ui->driverOptionsVLayout->addWidget(m_label);

    //Debconf handling
    QString uuid = QUuid::createUuid().toString();
    uuid.remove('{').remove('}').remove('-');
    m_pipe = QDir::tempPath() % QLatin1String("/qapt-sock-") % uuid;
    m_debconfGui = new DebconfKde::DebconfGui(m_pipe, this);
    m_debconfGui->connect(m_debconfGui, SIGNAL(activated()), this, SLOT(showDebconf()));
    m_debconfGui->connect(m_debconfGui, SIGNAL(deactivated()), this, SLOT(hideDebconf()));
    m_debconfGui->hide();

    connect(m_manager, SIGNAL(refreshFailed()),
            this, SLOT(onRefreshFailed()));
    connect(m_manager, SIGNAL(devicesReady(DeviceList)),
            this, SLOT(onDevicesReady(DeviceList)));

    connect(m_manager, SIGNAL(changeProgressChanged(int)),
            this, SLOT(progressChanged(int)));
    connect(m_manager, SIGNAL(changeFinished()),
            this, SLOT(finished()));
    connect(m_manager, SIGNAL(changeFailed(QString)),
            this, SLOT(failed(QString)));
}
开发者ID:KDE,项目名称:kubuntu-driver-kcm,代码行数:54,代码来源:Module.cpp

示例15: ManageFlarmDialog

void
ManageFlarmDialog(Device &_device)
{
  device = (FlarmDevice *)&_device;

  /* create the dialog */

  WindowStyle dialog_style;
  dialog_style.Hide();
  dialog_style.ControlParent();

  SingleWindow &parent = UIGlobals::GetMainWindow();
  const DialogLook &look = UIGlobals::GetDialogLook();

  dialog = new WndForm(parent, look, parent.get_client_rect(),
                       _T("FLARM"), dialog_style);

  ContainerWindow &client_area = dialog->GetClientAreaWindow();

  /* create buttons */

  ButtonPanel buttons(client_area, look);
  buttons.Add(_("Close"), OnCloseClicked);

  const PixelRect rc = buttons.UpdateLayout();

  /* create the command buttons */

  const UPixelScalar margin = 0;
  const UPixelScalar height = Layout::Scale(30);

  ButtonWindowStyle button_style;
  button_style.TabStop();

  WndButton *button;

  PixelRect brc = rc;
  brc.left += margin;
  brc.top += margin;
  brc.right -= margin;
  brc.bottom = brc.top + height;

  button = new WndButton(client_area, look, _("Reboot"),
                         brc,
                         button_style,
                         OnRebootClicked);
  dialog->AddDestruct(button);

  /* run it */

  dialog->ShowModal();

  delete dialog;
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:54,代码来源:ManageFlarmDialog.cpp


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