本文整理汇总了C++中QCalendarWidget::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QCalendarWidget::show方法的具体用法?C++ QCalendarWidget::show怎么用?C++ QCalendarWidget::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCalendarWidget
的用法示例。
在下文中一共展示了QCalendarWidget::show方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activated
void CmdTestRedirectPaint::activated(int iMsg)
{
QCalendarWidget* cal = new QCalendarWidget();
QLabel* label = new QLabel();
QPainter::setRedirected(cal,label);
cal->setWindowTitle(QString::fromAscii("QCalendarWidget"));
cal->show();
label->show();
label->setWindowTitle(QString::fromAscii("QLabel"));
}
示例2: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCalendarWidget *label = new QCalendarWidget();
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(100, 100, 200, 100));
// label->setText("Hello World");
label->show();
return app.exec();
}
示例3: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QCalendarWidget calendar;
calendar.setSelectedDate(calendar.selectedDate().addDays(3));
calendar.setGridVisible(true);
calendar.show();
QCalendarWidget calendarMin;
calendarMin.setMinimumDate(calendarMin.selectedDate().addDays(-7));
calendarMin.setGridVisible(true);
calendarMin.show();
QCalendarWidget calendarMax;
calendarMax.setMaximumDate(calendarMax.selectedDate().addDays(7));
calendarMax.setGridVisible(true);
calendarMax.show();
return app.exec();
}
示例4: buttonClickCheck
void tst_QCalendarWidget::buttonClickCheck()
{
QCalendarWidget object;
QSize size = object.sizeHint();
object.setGeometry(0,0,size.width(), size.height());
object.show();
object.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&object));
QDate selectedDate(2005, 1, 1);
//click on the month buttons
int month = object.monthShown();
QToolButton *button = object.findChild<QToolButton *>("qt_calendar_prevmonth");
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(month > 1 ? month-1 : 12, object.monthShown());
button = object.findChild<QToolButton *>("qt_calendar_nextmonth");
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(month, object.monthShown());
button = object.findChild<QToolButton *>("qt_calendar_yearbutton");
QTest::mouseClick(button, Qt::LeftButton, Qt::NoModifier, button->rect().center(), 2);
QVERIFY(!button->isVisible());
QSpinBox *spinbox = object.findChild<QSpinBox *>("qt_calendar_yearedit");
QTest::qWait(500);
QTest::keyClick(spinbox, '2');
QTest::keyClick(spinbox, '0');
QTest::keyClick(spinbox, '0');
QTest::keyClick(spinbox, '6');
QTest::qWait(500);
QWidget *widget = object.findChild<QWidget *>("qt_calendar_calendarview");
QTest::mouseMove(widget);
QTest::mouseClick(widget, Qt::LeftButton);
QCOMPARE(2006, object.yearShown());
object.setSelectedDate(selectedDate);
object.showSelectedDate();
QTest::keyClick(widget, Qt::Key_Down);
QVERIFY(selectedDate != object.selectedDate());
object.setDateRange(QDate(2006,1,1), QDate(2006,2,28));
object.setSelectedDate(QDate(2006,1,1));
object.showSelectedDate();
button = object.findChild<QToolButton *>("qt_calendar_prevmonth");
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(1, object.monthShown());
button = object.findChild<QToolButton *>("qt_calendar_nextmonth");
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(2, object.monthShown());
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(2, object.monthShown());
}
示例5: showPrevNext
void tst_QCalendarWidget::showPrevNext()
{
QFETCH(ShowFunc, function);
QFETCH(QDate, dateOrigin);
QFETCH(QDate, expectedDate);
QCalendarWidget calWidget;
calWidget.show();
QVERIFY(QTest::qWaitForWindowExposed(&calWidget));
if(!dateOrigin.isNull()) {
calWidget.setSelectedDate(dateOrigin);
calWidget.setCurrentPage(dateOrigin.year(), dateOrigin.month());
QCOMPARE(calWidget.yearShown(), dateOrigin.year());
QCOMPARE(calWidget.monthShown(), dateOrigin.month());
} else {
QCOMPARE(calWidget.yearShown(), QDate::currentDate().year());
QCOMPARE(calWidget.monthShown(), QDate::currentDate().month());
}
(calWidget.*function)();
QCOMPARE(calWidget.yearShown(), expectedDate.year());
QCOMPARE(calWidget.monthShown(), expectedDate.month());
// QTBUG-4058
QTest::qWait(20);
QToolButton *button = calWidget.findChild<QToolButton *>("qt_calendar_prevmonth");
QTest::mouseClick(button, Qt::LeftButton);
expectedDate = expectedDate.addMonths(-1);
QCOMPARE(calWidget.yearShown(), expectedDate.year());
QCOMPARE(calWidget.monthShown(), expectedDate.month());
if(!dateOrigin.isNull()) {
//the selectedDate should not have changed
QCOMPARE(calWidget.selectedDate(), dateOrigin);
}
}