本文整理汇总了C++中QPushButton::click方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::click方法的具体用法?C++ QPushButton::click怎么用?C++ QPushButton::click使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::click方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
void Tile::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape || event->key() == Qt::Key_Q) {
Quit();
} else if (event->key() == Qt::Key_S) {
Shuffle();
} else if (event->key() == Qt::Key_R) {
Reset();
} else if (event->key() == Qt::Key_H) {
Help();
} else if (event->key() == Qt::Key_O) {
Solve();
} else if (event->key() == Qt::Key_Up) {
//focusNextChild();
//qDebug() << qApp->focusWidget();
QPushButton *button = qobject_cast< QPushButton* >(qApp->focusWidget());
if (button) {
keyUp(button);
}
} else if (event->key() == Qt::Key_Down) {
//focusPreviousChild();
//qDebug() << qApp->focusWidget();
QPushButton *button = qobject_cast< QPushButton* >(qApp->focusWidget());
if (button) {
keyDown(button);
}
} else if( event->key() == Qt::Key_Return ) {
QPushButton *button = qobject_cast< QPushButton* >(qApp->focusWidget());
if (button) {
button->click();
}
} else {
return;
}
}
示例2: slotInputValueChanged
void VCMatrix::slotInputValueChanged(quint32 universe, quint32 channel, uchar value)
{
/* Don't let input data thru in design mode */
if (mode() == Doc::Design || isEnabled() == false)
return;
quint32 pagedCh = (page() << 16) | channel;
if (checkInputSource(universe, pagedCh, value, sender()))
{
m_slider->setValue((int) value);
}
else
{
QHashIterator<QPushButton *, VCMatrixControl *> it(m_controls);
while(it.hasNext())
{
it.next();
VCMatrixControl *control = it.value();
if (control->m_inputSource != NULL &&
control->m_inputSource->universe() == universe &&
control->m_inputSource->channel() == pagedCh)
{
QPushButton *button = it.key();
button->click();
}
}
}
}
示例3: keyPressEvent
void TaskView::keyPressEvent(QKeyEvent* ke)
{
if (ActiveCtrl && ActiveDialog) {
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
// get all buttons of the complete task dialog
QList<QPushButton*> list = this->findChildren<QPushButton*>();
for (int i=0; i<list.size(); ++i) {
QPushButton *pb = list.at(i);
if (pb->isDefault() && pb->isVisible()) {
if (pb->isEnabled())
pb->click();
return;
}
}
}
else if (ke->key() == Qt::Key_Escape) {
// get only the buttons of the button box
QDialogButtonBox* box = ActiveCtrl->standardButtons();
QList<QAbstractButton*> list = box->buttons();
for (int i=0; i<list.size(); ++i) {
QAbstractButton *pb = list.at(i);
if (box->buttonRole(pb) == QDialogButtonBox::RejectRole) {
if (pb->isEnabled())
pb->click();
return;
}
}
}
}
else {
QScrollArea::keyPressEvent(ke);
}
}
示例4: dial
void RemoteControl::dial(const QVariantList &args)
{
QString extension = args[0].toString();
DialPanel *xlet = this->get_xlet<DialPanel>("dial");
QComboBox *extension_input = xlet->findChild<QComboBox *>("extension_input");
QPushButton *button = xlet->findChild<QPushButton *>("dial_button");
extension_input->setEditText(extension);
button->click();
}
示例5: clickButton
bool DialogyWidget::clickButton(QDialogButtonBox::StandardButton standardButton)
{
QPushButton* pb = qobject_cast<QPushButton*>(focusWidget());
if (pb && pb->isVisible() && pb->isEnabled() && pb->hasFocus()) {
pb->click();
return true;
}
QList<QDialogButtonBox*> buttonBoxes = findChildren<QDialogButtonBox*>();
for (int i = 0; i < buttonBoxes.size(); ++i) {
QDialogButtonBox* buttonBox = buttonBoxes.at(i);
pb = buttonBox->button(standardButton);
if (pb && pb->isVisible() && pb->isEnabled()) {
pb->click();
return true;
}
}
return false;
}
示例6: menuTimeout
void MainInterface::menuTimeout()
{
QPushButton *Fn ;
Fn = barui->findChild<QPushButton *> ("pushButton_F8");
if(Fn != NULL){
Fn->click();
}
if(timer->isActive())
timer->stop();
}
示例7: keyPressEvent
void TaskView::keyPressEvent(QKeyEvent* ke)
{
if (ActiveCtrl && ActiveDialog) {
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
// get all buttons of the complete task dialog
QList<QPushButton*> list = this->findChildren<QPushButton*>();
for (int i=0; i<list.size(); ++i) {
QPushButton *pb = list.at(i);
if (pb->isDefault() && pb->isVisible()) {
if (pb->isEnabled()) {
#if defined(FC_OS_MACOSX)
// #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
QPoint pos = QCursor::pos();
QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
pb->click();
#if defined(FC_OS_MACOSX)
QCursor::setPos(pos);
#endif
}
return;
}
}
}
else if (ke->key() == Qt::Key_Escape) {
// get only the buttons of the button box
QDialogButtonBox* box = ActiveCtrl->standardButtons();
QList<QAbstractButton*> list = box->buttons();
for (int i=0; i<list.size(); ++i) {
QAbstractButton *pb = list.at(i);
if (box->buttonRole(pb) == QDialogButtonBox::RejectRole) {
if (pb->isEnabled()) {
#if defined(FC_OS_MACOSX)
// #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
QPoint pos = QCursor::pos();
QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
pb->click();
#if defined(FC_OS_MACOSX)
QCursor::setPos(pos);
#endif
}
return;
}
}
}
}
else {
QScrollArea::keyPressEvent(ke);
}
}
示例8: slotKeyPressed
void VCMatrix::slotKeyPressed(const QKeySequence &keySequence)
{
if (isEnabled() == false)
return;
QHashIterator<QPushButton *, VCMatrixControl *> it(m_controls);
while(it.hasNext())
{
it.next();
VCMatrixControl *control = it.value();
if (control->m_keySequence == keySequence)
{
QPushButton *button = it.key();
button->click();
}
}
}
示例9: addbookmarkdialog
void tst_AddBookmarkDialog::addbookmarkdialog()
{
QFETCH(QString, url);
QFETCH(QString, title);
QFETCH(QDialogButtonBox::StandardButton, button);
QFETCH(int, menuCount);
QFETCH(int, toolbarCount);
QFETCH(int, select);
BookmarksManager *manager = BrowserApplication::bookmarksManager();
qRegisterMetaType<BookmarkNode *>("BookmarkNode *");
QSignalSpy spy(manager, SIGNAL(entryAdded(BookmarkNode *)));
BookmarkNode *menu = manager->menu();
BookmarkNode *toolbar = manager->toolbar();
QCOMPARE(menu->children().count(), 0);
QCOMPARE(toolbar->children().count(), 0);
SubAddBookmarkDialog dialog(0, manager);
dialog.setUrl(url);
dialog.setTitle(title);
QComboBox *combobox = dialog.findChild<QComboBox*>();
QVERIFY(combobox);
if (select != -1) {
combobox->setCurrentIndex(select);
combobox->view()->setCurrentIndex(combobox->model()->index(select, 0));
}
QDialogButtonBox *buttonBox = dialog.findChild<QDialogButtonBox*>();
QVERIFY(buttonBox);
QPushButton *pushButton = buttonBox->button(button);
pushButton->click();
QCOMPARE(spy.count(), menuCount + toolbarCount);
QCOMPARE(menu->children().count(), menuCount);
QCOMPARE(toolbar->children().count(), toolbarCount);
BookmarkNode *node = 0;
if (menuCount == 1) node = menu->children()[0];
if (toolbarCount == 1) node = toolbar->children()[0];
if (node) {
QCOMPARE(node->title, title);
QCOMPARE(node->url, url);
}
}
示例10: QDialog
ZoomScrollTrack2::ZoomScrollTrack2(QWidget *parent) :
QDialog(parent)
{
//
// Set up the GUI
//
setFixedSize(782, 376);
setWindowTitle("Zooming and Scrolling with Track Line (2)");
// The frame on the left side
QFrame *frame = new QFrame(this);
frame->setGeometry(4, 4, 120, 370);
frame->setFrameShape(QFrame::StyledPanel);
// Pointer push button
QPushButton *pointerPB = new QPushButton(QIcon(":/pointer.png"), "Pointer", frame);
pointerPB->setGeometry(4, 8, 112, 28);
pointerPB->setStyleSheet("QPushButton { text-align:left; padding:5px}");
pointerPB->setCheckable(true);
// Zoom In push button
QPushButton *zoomInPB = new QPushButton(QIcon(":/zoomin.png"), "Zoom In", frame);
zoomInPB->setGeometry(4, 36, 112, 28);
zoomInPB->setStyleSheet("QPushButton { text-align:left; padding:5px}");
zoomInPB->setCheckable(true);
// Zoom Out push button
QPushButton *zoomOutPB = new QPushButton(QIcon(":/zoomout.png"), "Zoom Out", frame);
zoomOutPB->setStyleSheet("QPushButton { text-align:left; padding:5px}");
zoomOutPB->setGeometry(4, 64, 112, 28);
zoomOutPB->setCheckable(true);
// The Pointer/Zoom In/Zoom Out buttons form a button group
QButtonGroup *mouseUsage = new QButtonGroup(frame);
mouseUsage->addButton(pointerPB, Chart::MouseUsageScroll);
mouseUsage->addButton(zoomInPB, Chart::MouseUsageZoomIn);
mouseUsage->addButton(zoomOutPB, Chart::MouseUsageZoomOut);
connect(mouseUsage, SIGNAL(buttonPressed(int)), SLOT(onMouseUsageChanged(int)));
// Start Date control
(new QLabel("Start Date", frame))->setGeometry(6, 230, 112, 18);
m_StartDate = new QDateEdit(frame);
m_StartDate->setGeometry(4, 248, 113, 22);
connect(m_StartDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onStartDateChanged(QDateTime)));
// Duration control
(new QLabel("End Date", frame))->setGeometry(6, 284, 112, 18);
m_EndDate = new QDateEdit(frame);
m_EndDate->setGeometry(4, 302, 113, 22);
connect(m_EndDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onEndDateChanged(QDateTime)));
// Chart Viewer
m_ChartViewer = new QChartViewer(this);
m_ChartViewer->setGeometry(128, 4, 650, 350);
connect(m_ChartViewer, SIGNAL(viewPortChanged()), SLOT(onViewPortChanged()));
connect(m_ChartViewer, SIGNAL(mouseMovePlotArea(QMouseEvent*)), SLOT(onMouseMovePlotArea(QMouseEvent*)));
connect(m_ChartViewer, SIGNAL(mouseWheel(QWheelEvent*)), SLOT(onMouseWheelChart(QWheelEvent*)));
// Horizontal scroll bar
m_HScrollBar = new QScrollBar(Qt::Horizontal, this);
m_HScrollBar->setGeometry(128, 356, 650, 17);
connect(m_HScrollBar, SIGNAL(valueChanged(int)), SLOT(onHScrollBarChanged(int)));
//
// Initialize the chart
//
// Load the data
loadData();
// Initialize the QChartViewer
initChartViewer(m_ChartViewer);
// Initially set the mouse to drag to scroll mode
pointerPB->click();
// Trigger the ViewPortChanged event to draw the chart
m_ChartViewer->updateViewPort(true, true);
}
示例11: keyPressEvent
void MainInterface::keyPressEvent( QKeyEvent *k )
{
QPalette palette;
QColor color(255 ,0 ,0);
palette.setColor(QPalette::WindowText,color);
/*去除按键重复事件*/
if(!k->isAutoRepeat()){
k->accept();
QPushButton *Fn ;
switch(k->key())
{
case Qt::Key_F1:
Fn = barui->findChild<QPushButton *> ("pushButton_F1");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F2:
Fn = barui->findChild<QPushButton *> ("pushButton_F2");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F3:
Fn = barui->findChild<QPushButton *> ("pushButton_F3");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F4:
Fn = barui->findChild<QPushButton *> ("pushButton_F4");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F5:
Fn = barui->findChild<QPushButton *> ("pushButton_F5");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F6:
Fn = barui->findChild<QPushButton *> ("pushButton_F6");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F7:
Fn = barui->findChild<QPushButton *> ("pushButton_F7");
if(Fn != NULL)
Fn->click();
break;
case Qt::Key_F8:
Fn = barui->findChild<QPushButton *> ("pushButton_F8");
if(Fn != NULL){
if(barmap.key(barui) != 28){
Fn->click();
}else{
if(!timer->isActive())
timer->start();
}
}
break;
case Qt::Key_X:
ui->label_cux->setPalette(palette);
command ->setFocus();
command ->setStatus(0x10);
command ->setType(false ,true ,0x04 ,true ,0x03);
target = L_SLOT << 8 | L_X_CURRENT;
command ->setTarget(L_SLOT ,L_X_CURRENT);
break;
case Qt::Key_Y:
ui->label_cuy->setPalette(palette);
command ->setFocus();
command ->setStatus(0x10);
command ->setType(false ,true ,0x04 ,true ,0x03);
target = L_SLOT << 8 | L_Y_CURRENT;
command ->setTarget(L_SLOT ,L_Y_CURRENT);
break;
case Qt::Key_Z:
ui->label_cuz->setPalette(palette);
command ->setFocus();
command ->setStatus(0x10);
command ->setType(false ,true ,0x04 ,true ,0x03);
target = L_SLOT << 8 | L_Z_CURRENT;
command ->setTarget(L_SLOT ,L_Z_CURRENT);
break;
case Qt::Key_F9:
case Qt::Key_F10:
break;
/*放电监听F11键*/
case Qt::Key_F11:
spark_info->setBool(B_START ,false);
break;
case Qt::Key_F12:
spark_info->setBool(B_START ,true);
break;
case Qt::Key_Up:
//.........这里部分代码省略.........
示例12: f
VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) :
EffectControlDialog( _ctl ),
m_pluginWidget( NULL ),
m_plugin( NULL ),
tbLabel( NULL )
{
QGridLayout * l = new QGridLayout( this );
l->setContentsMargins( 10, 10, 10, 10 );
l->setVerticalSpacing( 2 );
l->setHorizontalSpacing( 2 );
if( _ctl != NULL && _ctl->m_effect != NULL &&
_ctl->m_effect->m_plugin != NULL )
{
m_plugin = _ctl->m_effect->m_plugin;
m_plugin->showEditor( NULL, true );
m_pluginWidget = m_plugin->pluginWidget();
#ifdef LMMS_BUILD_WIN32
if( !m_pluginWidget )
{
m_pluginWidget = m_plugin->pluginWidget( false );
}
#endif
}
if( m_pluginWidget )
{
setWindowTitle( m_pluginWidget->windowTitle() );
setMinimumWidth( 250 );
QPushButton * btn = new QPushButton( tr( "Show/hide" ) );
btn->setCheckable( true );
connect( btn, SIGNAL( toggled( bool ) ),
m_pluginWidget, SLOT( setVisible( bool ) ) );
emit btn->click();
btn->setMinimumWidth( 78 );
btn->setMaximumWidth( 78 );
btn->setMinimumHeight( 24 );
btn->setMaximumHeight( 24 );
m_managePluginButton = new pixmapButton( this, "" );
m_managePluginButton->setCheckable( false );
m_managePluginButton->setCursor( Qt::PointingHandCursor );
m_managePluginButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"track_op_menu" ) );
m_managePluginButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"track_op_menu" ) );
connect( m_managePluginButton, SIGNAL( clicked() ), _ctl,
SLOT( managePlugin() ) );
toolTip::add( m_managePluginButton, tr( "Control VST-plugin from LMMS host" ) );
m_managePluginButton->setWhatsThis(
tr( "Click here, if you want to control VST-plugin from host." ) );
m_managePluginButton->setMinimumWidth( 21 );
m_managePluginButton->setMaximumWidth( 21 );
m_managePluginButton->setMinimumHeight( 21 );
m_managePluginButton->setMaximumHeight( 21 );
m_openPresetButton = new pixmapButton( this, "" );
m_openPresetButton->setCheckable( false );
m_openPresetButton->setCursor( Qt::PointingHandCursor );
m_openPresetButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"stepper-up-press" ) );
m_openPresetButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"stepper-up" ) );
connect( m_openPresetButton, SIGNAL( clicked() ), _ctl,
SLOT( openPreset() ) );
toolTip::add( m_openPresetButton, tr( "Open VST-plugin preset" ) );
m_openPresetButton->setWhatsThis(
tr( "Click here, if you want to open another *.fxp, *.fxb VST-plugin preset." ) );
m_openPresetButton->setMinimumWidth( 16 );
m_openPresetButton->setMaximumWidth( 16 );
m_openPresetButton->setMinimumHeight( 16 );
m_openPresetButton->setMaximumHeight( 16 );
m_rolLPresetButton = new pixmapButton( this, "" );
m_rolLPresetButton->setCheckable( false );
m_rolLPresetButton->setCursor( Qt::PointingHandCursor );
m_rolLPresetButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"stepper-left-press" ) );
m_rolLPresetButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"stepper-left" ) );
connect( m_rolLPresetButton, SIGNAL( clicked() ), _ctl,
SLOT( rolrPreset() ) );
connect( m_rolLPresetButton, SIGNAL( clicked() ), this,
SLOT( update() ) );
toolTip::add( m_rolLPresetButton, tr( "Previous (-)" ) );
m_rolLPresetButton->setShortcut( Qt::Key_Minus );
m_rolLPresetButton->setWhatsThis(
tr( "Click here, if you want to switch to another VST-plugin preset program." ) );
//.........这里部分代码省略.........