本文整理汇总了C++中QSpinBox::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::isVisible方法的具体用法?C++ QSpinBox::isVisible怎么用?C++ QSpinBox::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::isVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visualRect
/* FIXME make this less of a hack. */
QRect TestCalendarWidget::visualRect(QString const &item) const
{
TestWidgetsLog() << item << "my geometry is" << geometry();
QRect ret;
QAbstractItemView *view = q->findChild<QAbstractItemView*>();
QtUiTest::ListWidget *calendarView
= qtuitest_cast<QtUiTest::ListWidget*>(view);
if (!calendarView) {
return ret;
}
ret = calendarView->visualRect(item);
if (!ret.isNull()) {
ret.moveTopLeft( q->mapFromGlobal( view->mapToGlobal(ret.topLeft()) ) );
TestWidgetsLog() << item << "is a visible day at" << ret;
return ret;
}
QToolButton *yearButton = 0;
QToolButton *monthButton = 0;
QSpinBox *yearSpin = q->findChild<QSpinBox*>();
QMenu *monthMenu = 0;
QList<QToolButton*> blist = q->findChildren<QToolButton*>();
foreach(QToolButton *b, blist) {
if (!monthButton && (monthMenu = b->menu())) {
monthButton = b;
}
if (!b->menu()) {
yearButton = b;
}
}
TestWidgetsLog() << "monthButton" << monthButton << "yearButton" << yearButton;
TestWidgetsLog() << "item" << item << "monthMenu" << monthMenu;
if (yearButton && yearButton->isVisible() && yearButton->text() == item) {
QPoint p = q->mapFromGlobal( yearButton->mapToGlobal(QPoint(yearButton->width()+5, yearButton->height()/2)) );
ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
TestWidgetsLog() << "click near yearbutton";
} else if (yearSpin && yearSpin->isVisible() && yearSpin->value() == item.toInt()) {
TestWidgetsLog() << "confirm spinbox";
QPoint p = q->mapFromGlobal( yearSpin->mapToGlobal(QPoint(yearSpin->width()+5, yearSpin->height()/2)) );
ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
} else if (monthButton && monthButton->isVisible() && monthButton->text() == item) {
QPoint p = q->mapFromGlobal( monthButton->mapToGlobal(QPoint(-5, monthButton->height()/2)) );
ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
TestWidgetsLog() << "click near monthbutton";
} else if (monthMenu && monthMenu->isVisible()
&& qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)
&& qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)->list().contains(item)) {
ret = qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)->visualRect(item);
ret.moveTopLeft( q->mapFromGlobal( monthMenu->mapToGlobal(ret.topLeft()) ) );
TestWidgetsLog() << "click on monthmenu";
} else {
do {
QStringList items = list();
if (items.contains(item)) {
ret = QRect(-1, -1, 1, 1);
ret.moveTopLeft( q->mapFromGlobal(QPoint(-1,-1)) );
break;
}
foreach (QString s, items) {
if (!s.startsWith(GetListRegExp)) continue;
QRegExp re(s.mid(GetListRegExp.length()));
if (re.exactMatch(item)) {
ret = QRect(-1, -1, 1, 1);
ret.moveTopLeft( q->mapFromGlobal(QPoint(-1,-1)) );
break;
}
}
if (!ret.isNull()) break;
} while(0);
}
TestWidgetsLog() << "returning rect" << ret;
return ret;
}