本文整理汇总了C++中QPushButton::hasFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::hasFocus方法的具体用法?C++ QPushButton::hasFocus怎么用?C++ QPushButton::hasFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::hasFocus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addWidget
bool QAquaAnimate::addWidget(QWidget *w)
{
if(focusable(w)) {
if(w->hasFocus())
setFocusWidget(w);
w->installEventFilter(this);
}
if(w == d->defaultButton || d->progressBars.contains((QProgressBar*)w)) //already knew of it
return FALSE;
if(w->inherits("QPushButton")){
QPushButton * btn = (QPushButton *) w;
if(btn->isDefault() || (btn->autoDefault() && btn->hasFocus())){
d->defaultButton = btn;
btn->installEventFilter(this);
if(btn->isVisible() && d->buttonTimerId == -1)
d->buttonTimerId = startTimer(50);
}
return TRUE;
} else if(w->inherits("QProgressBar")){
w->installEventFilter(this);
QObject::connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(objDestroyed(QObject*)));
if(w->isVisible() && d->progressTimerId == -1) {
d->progressBars.append((QProgressBar*)w);
d->progressTimerId = startTimer(50);
}
return TRUE;
} else if(w->inherits("QListView")) {
示例2: addCurrentChar
void SymbolDialog::addCurrentChar() {
for (int i = 1; i < numButtons; i++) {
QPushButton *btn = (QPushButton *)buttons->button(i);
if (btn && btn->hasFocus())
emit addLetter(btn->text());
}
}
示例3: addCurrentChar
void symbolDialog::addCurrentChar()
{
for (int i=0; i<GroupBox1->count(); i++)
{
QPushButton *btn = (QPushButton *) GroupBox1->find (i);
if (btn && btn->hasFocus())
{
emit addLetter(btn->text());
return;
}
}
}
示例4: 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;
}