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


C++ btn函数代码示例

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


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

示例1: Scene

void VCButton_Test::copy()
{
    QWidget w;

    Scene* sc = new Scene(m_doc);
    m_doc->addFunction(sc);

    VCButton btn(&w, m_doc);
    btn.setCaption("Foobar");
    btn.setIconPath("../../../resources/icons/png/qlcplus.png");
    btn.setFunction(sc->id());
    btn.setAction(VCButton::Flash);
    btn.setKeySequence(QKeySequence(keySequenceB));
    btn.enableStartupIntensity(true);
    btn.setStartupIntensity(qreal(0.2));

    VCFrame parent(&w, m_doc);
    VCButton* copy = qobject_cast<VCButton*> (btn.createCopy(&parent));
    QVERIFY(copy != NULL);
    QCOMPARE(copy->caption(), QString("Foobar"));
    QCOMPARE(copy->iconPath(), QString("../../../resources/icons/png/qlcplus.png"));
    QCOMPARE(copy->function(), sc->id());
    QCOMPARE(copy->action(), VCButton::Flash);
    QCOMPARE(copy->keySequence(), QKeySequence(keySequenceB));
    QCOMPARE(copy->isStartupIntensityEnabled(), true);
    QCOMPARE(copy->startupIntensity(), qreal(0.2));
    delete copy;
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:28,代码来源:vcbutton_test.cpp

示例2: Scene

void VCButton_Test::copy()
{
    QWidget w;

    Scene* sc = new Scene(m_doc);
    m_doc->addFunction(sc);

    VCButton btn(&w, m_doc);
    btn.setCaption("Foobar");
    btn.setIcon("../../../gfx/qlc.png");
    btn.setFunction(sc->id());
    btn.setAction(VCButton::Flash);
    btn.setKeySequence(QKeySequence(keySequenceB));
    btn.setAdjustIntensity(true);
    btn.setIntensityAdjustment(0.2);

    VCFrame parent(&w, m_doc);
    VCButton* copy = qobject_cast<VCButton*> (btn.createCopy(&parent));
    QVERIFY(copy != NULL);
    QCOMPARE(copy->caption(), QString("Foobar"));
    QCOMPARE(copy->icon(), QString("../../../gfx/qlc.png"));
    QCOMPARE(copy->function(), sc->id());
    QCOMPARE(copy->action(), VCButton::Flash);
    QCOMPARE(copy->keySequence(), QKeySequence(keySequenceB));
    QCOMPARE(copy->adjustIntensity(), true);
    QCOMPARE(copy->intensityAdjustment(), qreal(0.2));
    delete copy;
}
开发者ID:skogkatten,项目名称:qlcplus,代码行数:28,代码来源:vcbutton_test.cpp

示例3: btn

void VCButton_Test::paint()
{
    QWidget w;

    VCButton btn(&w, m_doc);

    w.show();
    btn.show();

    QTest::qWait(1);

    btn.setOn(true);
    btn.update();
    QTest::qWait(1);
    btn.setOn(false);
    btn.update();
    QTest::qWait(1);
    btn.setIconPath("../../../resources/icons/png/qlcplus.png");
    btn.update();
    QTest::qWait(1);
    btn.setCaption("Foobar");
    btn.update();
    QTest::qWait(1);
    btn.setAction(VCButton::Flash);
    btn.update();
    QTest::qWait(1);
    m_doc->setMode(Doc::Operate);
    btn.update();
    QTest::qWait(1);
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:30,代码来源:vcbutton_test.cpp

示例4: menu_set_adc_direction

// channel if from 0
static void menu_set_adc_direction(u8 channel) {
    u16 adc, calm;

    // for channel 2 use throttle, for others steering
    if (channel == 1) {
	adc = adc_throttle_ovs;
	calm = cg.calib_throttle_mid;
    }
    else {
	adc = adc_steering_ovs;
	calm = cg.calib_steering_mid;
    }

    // check steering firstly
    if (adc_steering_ovs < ((cg.calib_steering_mid - 40) << ADC_OVS_SHIFT))
	menu_adc_direction = 0;
    else if (adc_steering_ovs > ((cg.calib_steering_mid + 40) << ADC_OVS_SHIFT))
	menu_adc_direction = 1;

    // then check throttle
    if (adc_throttle_ovs < ((cg.calib_throttle_mid - 40) << ADC_OVS_SHIFT))
	menu_adc_direction = 0;
    else if (adc_throttle_ovs > ((cg.calib_throttle_mid + 40) << ADC_OVS_SHIFT))
	menu_adc_direction = 1;

    // and then CH3 button
    else if (btn(BTN_CH3))  menu_adc_direction ^= 1;

    // if this channel is using forced values, set it to left/right
    if (menu_force_value_channel)
	menu_force_value = menu_adc_direction ? PPM(500) : PPM(-500);
}
开发者ID:Micha500,项目名称:gt3b,代码行数:33,代码来源:menu.c

示例5: menu_name_func

// change model name
static void menu_name_func(u8 action, void *p) {
    u8 letter;

    if (action == MCA_SET_CHG) {
	// change letter
	letter = cm.name[menu_set];
	if (btn(BTN_ROT_L)) {
	    // lower
	    if (letter == '0')      letter = 'Z';
	    else if (letter == 'A')	letter = '9';
	    else                    letter--;
	}
	else {
	    // upper
	    if (letter == '9')      letter = 'A';
	    else if (letter == 'Z')	letter = '0';
	    else                    letter++;
	}
	cm.name[menu_set] = letter;
    }
    else if (action == MCA_SET_NEXT) {
	// next char
	if (++menu_set > 2)  menu_set = 0;
    }

    // show name
    menu_blink = (u8)(1 << menu_set);	// blink only selected char
    lcd_segment(LS_SYM_MODELNO, LS_ON);
    lcd_chars(cm.name);
}
开发者ID:Micha500,项目名称:gt3b,代码行数:31,代码来源:menu.c

示例6: bgColor

void BookmarkView::updateTheme() {
    wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
    wxColour textColor(ThemeMgr::mgr.currentTheme->text);
    wxColour btn(ThemeMgr::mgr.currentTheme->button);
    wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
    
    SetBackgroundColour(bgColor);

    m_treeView->SetBackgroundColour(bgColor);
    m_treeView->SetForegroundColour(textColor);
    
    m_propPanel->SetBackgroundColour(bgColor);
    m_propPanel->SetForegroundColour(textColor);

    m_buttonPanel->SetBackgroundColour(bgColor);
    m_buttonPanel->SetForegroundColour(textColor);
    
    m_labelLabel->SetForegroundColour(textColor);
    m_frequencyVal->SetForegroundColour(textColor);
    m_frequencyLabel->SetForegroundColour(textColor);
    m_bandwidthVal->SetForegroundColour(textColor);
    m_bandwidthLabel->SetForegroundColour(textColor);
    m_modulationVal->SetForegroundColour(textColor);
    m_modulationLabel->SetForegroundColour(textColor);
    
    refreshLayout();
}
开发者ID:Dantali0n,项目名称:CubicSDR,代码行数:27,代码来源:BookmarkView.cpp

示例7: CRect

bool ViewCaption::Create(CWnd* parent, int toolbarBmp, const int commands[], int count,
						 const boost::function<void (void)>& on_clicked)
{
	on_clicked_ = on_clicked;

	CDC dc;
	dc.CreateCompatibleDC(0);
	dc.SelectStockObject(DEFAULT_GUI_FONT);
	TEXTMETRIC tm;
	dc.GetTextMetrics(&tm);
	int h= tm.tmHeight + tm.tmInternalLeading + 2;	// yes, internal leading is already in tmHeight

	if (!CWnd::Create(AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, AfxGetApp()->LoadStandardCursor(IDC_ARROW), 0, 0),
		0, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CRect(0,0,0,h), parent, -1))
		return false;

	if (!caption_.IsValid())
		VERIFY(LoadPingFromRsrc(MAKEINTRESOURCE(IDB_VIEW_CAPTION), caption_));
	if (!active_marker_.IsValid())
		VERIFY(LoadPingFromRsrc(MAKEINTRESOURCE(IDB_ACTIVE_VIEW), active_marker_));

	toolbar_.SetOnIdleUpdateState(false);

	FancyToolBar::Params p;
	p.shade = -0.28f;
	std::string btn(count, 'p');
	if (!toolbar_.Create(this, btn.c_str(), commands, toolbarBmp, &p))
		return false;

	toolbar_.SetPadding(CRect(5,4,5,4));
	toolbar_.SetOption(FancyToolBar::HOT_OVERLAY, false);
	toolbar_.SetOwner(parent);

	return true;
}
开发者ID:mikekov,项目名称:ExifPro,代码行数:35,代码来源:ViewCaption.cpp

示例8: main

int main(int argc, char **argv)
{
  Iup::Open(argc, argv);

  Iup::Frame frame(Iup::List().SetAttributes("DROPDOWN=YES, 1=Test, 2=XXX, VALUE=1"));
  frame.SetAttribute("TITLE", "List");

  Iup::Text text;

  text.SetAttributes("EXPAND = YES, VALUE = \"Enter your text here\"");
  
  /* Creates a label */
  Iup::Label lbl("This element is a label");

  /* Creatas a button */
  Iup::Button btn("This button does nothing");

  /* Creates handles for manipulating the zbox VALUE */
  Iup::SetHandle("frame", frame);
  Iup::SetHandle("text", text);
  Iup::SetHandle("lbl", lbl);
  Iup::SetHandle("btn", btn);
	
  /* Creates zbox with four elements */
  Iup::Zbox zbox(frame, text, lbl, btn);

  /* Sets zbox alignment */
  zbox.SetAttribute("ALIGNMENT", "ACENTER");
  zbox.SetAttribute("VALUE", "text");
  zbox.SetAttribute("NAME", "ZBOX");

  Iup::List list;
  Iup::Hbox hbox(list);

    /* Creates frame */
  Iup::Frame frm(hbox);

  /* Creates dialog */
  Iup::Dialog dlg
  (
    Iup::Vbox
    (
      frm,
      zbox
    )
  );

  list.SetAttributes("1 = frame, 2 = text, 3 = lbl, 4 = btn, VALUE=2");
  frm.SetAttribute("TITLE", "Select an element");
  dlg.SetAttributes("MARGIN=10x10, GAP=10, TITLE = \"IupZbox Example\"");
  list.SetCallback("ACTION", (Icallback)list_cb);

  dlg.ShowXY(IUP_CENTER, IUP_CENTER);

  Iup::MainLoop();

  Iup::Close();

  return 0;
}
开发者ID:svn2github,项目名称:iup-github,代码行数:60,代码来源:zbox.cpp

示例9: main

int main(int argc, char* argv[]) {
    QApplication app(argc, argv);
    QPushButton btn("Quit");
    QObject::connect(&btn, &QPushButton::clicked, &app, &QApplication::quit);
    btn.show();

    return app.exec();
}
开发者ID:heejune,项目名称:meetup-qt,代码行数:8,代码来源:main.cpp

示例10: 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

示例11: children

	void CCControlBase::layoutChildren(ELayoutMode layoutMode, bool resize)	{
		// now check for all sub layers and call needsLayout to
		CCArray* children(getChildren());
		CCObject* child;

		const float verticalOffset(static_cast<float>(m_marginV));


		if(resize == true)	{

			const CCSize& currentContentSize(getContentSize());
			float contentHeight(verticalOffset);
			// determine the new content height
			CCARRAY_FOREACH(children, child)
			{
				CCControlBase* ctrlBase(dynamic_cast<CCControlBase*>(child));
				if(ctrlBase != nullptr)	{
					CCSize preferredSize(CCSizeMake(currentContentSize.width - (m_marginH * 2),0));
					CCSize ctrlPreferredSize(ctrlBase->getPreferredSize());
					ctrlPreferredSize.width = preferredSize.width;
					ctrlBase->setPreferredSize(ctrlPreferredSize);
					ctrlBase->needsLayout();

					contentHeight += ctrlBase->getContentSize().height;
					contentHeight += verticalOffset;
				}
				else	{
					CCScale9Sprite* sprite(dynamic_cast<CCScale9Sprite*>(child));
					if(sprite == _backGroundSprite)	{

					}
					else	{
						CCControlButton* btn(dynamic_cast<CCControlButton*>(child));
						if(btn != nullptr)	{
							contentHeight += (btn->getContentSize().height + verticalOffset * 2);
							contentHeight += verticalOffset * 2;
						}
						else	{
							CCNode* node(dynamic_cast<CCNode*>(child));
							if(node != nullptr)	{
								contentHeight += node->getContentSize().height;
								contentHeight += verticalOffset;
							}
						}
					}
				}
			}

			CCSize newContentSize(getContentSize());
			newContentSize.height = contentHeight;
			setPreferredSize(newContentSize);
			needsLayout();
			layoutChildren(ELayoutMode_topLeftDown);
		}
开发者ID:Mobiletainment,项目名称:Multiplayer-Network-Conecpts,代码行数:54,代码来源:CCControlBase.cpp

示例12: main

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QPushButton btn("Hello World");
    btn.show();

    app.exec();

    return 0;
}
开发者ID:ynonp,项目名称:Qt-Examples-July7,代码行数:11,代码来源:main.cpp

示例13: elm

Handler<Element> TabCombo::removeChild(std::size_t const& idx)
{
	Handler<Element> elm(this->frame_->removeChild(idx));
	auto const it = this->buttonMap_.find(elm);
	Handler<TabButton> btn(it->second);
	this->buttonMap_.erase(it);
	this->buttons_->removeChild(btn);
	if(Handler<Element> front = this->frontChild()){ //もうボタンが残っていない場合、nullが帰ってくるので
		updateButtonState(front, Handler<TabButton>());
	}
	return elm;
}
开发者ID:kaiinui,项目名称:Chisa,代码行数:12,代码来源:TabCombo.cpp

示例14: main

int main(int argc,char **argv)
{

    /*	1.建立QT应用	*/
    QApplication app(argc,argv);

    /* 使中文正常显示	*/
    QTextCodec *codec=QTextCodec::codecForName("gb2312");
    QTextCodec::setCodecForTr(codec);

    /*	2.建立窗体		*/
    QWidget win;

    /*	3.调用窗体方法控制窗体		*/
    //窗体大小400*300
    win.resize(400,300);
    //居中显示
    win.move((1024-400)/2,(768-300)/2);

    //添加button 在窗体中
    QPushButton btn("OK",&win);
    btn.resize(100,30);
    btn.move(100,100);

    // 	添加QLineEdit对象		在窗体中
    //	使中文正常显示
    QLineEdit le(QObject::tr("你好"),&win);
    le.resize(50,50);
    le.move(20,20);

    MySlots myslo;
    /* 点击按钮弹出一个messagebox
    QObject::connect(
    	&btn,//信号发送者
    	SIGNAL(clicked()),//发送的信号
    	&myslo,//信号发送的槽函数的对象
    	SLOT(handle())//槽函数
    );
    */

    /* 点击按钮退出窗体	*/
    QObject::connect(
        &btn,//信号发送者
        SIGNAL(clicked()),//发送的信号
        &app,//信号发送的槽函数的对象
        SLOT(quit())//槽函数
    );

    win.setVisible(true);
    /*	4.等待所有窗体子线程终止	*/
    return app.exec();

}
开发者ID:hjd919,项目名称:recipes,代码行数:53,代码来源:main.cpp

示例15: btn

Handler<Element> TabCombo::removeChild(Handler<Element> const& h)
{
	auto it = this->buttonMap_.find(h);
	Handler<TabButton> btn(it->second);
	this->buttonMap_.erase(it);
	this->buttons_->removeChild(btn);
	this->frame_->removeChild(h);
	if(Handler<Element> front = this->frontChild()){ //もうボタンが残っていない場合、nullが帰ってくるので
		updateButtonState(front, Handler<TabButton>());
	}
	return h;
}
开发者ID:kaiinui,项目名称:Chisa,代码行数:12,代码来源:TabCombo.cpp


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