×
Namespaces

Variants
Actions
Revision as of 11:42, 11 September 2009 by nayan_trivedi (Talk | contribs)

Archived:How to use QCalendar

From Nokia Developer Wiki
Jump to: navigation, search


{{{width}}}


Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Symbian
Article
Keywords: QCalendar, Push Button
Created: (07 Jan 2009)
Last edited: nayan_trivedi (11 Sep 2009)


Overview

This code snippet demonstrates how to calendar widget in Qt for S60.

Preconditions


Various Functions

  • This property holds the format of the vertical header.
QCalendarWidget *calendar = new QCalendarWidget;
calendar->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
  • This property holds whether the date edit popup is enabled.When the widget is focus and then press any non-modifier key will cause a date edit to popup.
QCalendarWidget *calendar = new QCalendarWidget;
calendar->setDateEditEnabled(1);

Calender1.JPG

  • Property holds a value identifying the day displayed in the first column.
QCalendarWidget *calendar = new QCalendarWidget;
calendar->setFirstDayOfWeek(Qt::Wednesday);

Calender2.JPG


Source File

#include <QCalendarWidget>
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
#include <QWindowsStyle>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *win = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QPushButton *nextyrbutton = new QPushButton("Next Year");
QPushButton *prevyrbutton = new QPushButton("Prev Year");
QCalendarWidget *calendar = new QCalendarWidget;
QObject::connect(nextyrbutton,SIGNAL(clicked()),calendar,SLOT(showNextYear()));
QObject::connect(prevyrbutton,SIGNAL(clicked()),calendar,SLOT(showPreviousYear()));
layout->addWidget(calendar);
layout->addWidget(prevyrbutton);
layout->addWidget(nextyrbutton);
calendar->setGridVisible(true);
win->setLayout(layout);
win->showNormal();
 
return app.exec();
}
  • In the above example only two function for displaying next and previous year are used but there are many other function like showNextMonth,show PreviousMonth,showToday etc...

Screenshot

Calender.JPG

78 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×