本文整理汇总了C++中QCalendarWidget::setFirstDayOfWeek方法的典型用法代码示例。如果您正苦于以下问题:C++ QCalendarWidget::setFirstDayOfWeek方法的具体用法?C++ QCalendarWidget::setFirstDayOfWeek怎么用?C++ QCalendarWidget::setFirstDayOfWeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCalendarWidget
的用法示例。
在下文中一共展示了QCalendarWidget::setFirstDayOfWeek方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activated
void LxQtClock::activated(ActivationReason reason)
{
if (reason != ILxQtPanelPlugin::Trigger)
return;
if (!mCalendarDialog)
{
mCalendarDialog = new QDialog(mContent);
//mCalendarDialog->setAttribute(Qt::WA_DeleteOnClose, true);
mCalendarDialog->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog | Qt::X11BypassWindowManagerHint);
mCalendarDialog->setLayout(new QHBoxLayout(mCalendarDialog));
mCalendarDialog->layout()->setMargin(1);
QCalendarWidget* cal = new QCalendarWidget(mCalendarDialog);
cal->setFirstDayOfWeek(mFirstDayOfWeek);
mCalendarDialog->layout()->addWidget(cal);
mCalendarDialog->adjustSize();
QRect pos = calculatePopupWindowPos(mCalendarDialog->size());
mCalendarDialog->move(pos.topLeft());
mCalendarDialog->show();
}
else
{
delete mCalendarDialog;
mCalendarDialog = 0;
}
}
示例2: setupCalenderWidget
void MultiDelegate::setupCalenderWidget( QDateTimeEdit* editor) const
{
editor->setCalendarPopup(true);
QCalendarWidget* calendar = editor->calendarWidget();
if (calendar) {
calendar->setFirstDayOfWeek(Qt::Monday);
calendar->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers);
}
}
示例3: activated
void LXQtWorldClock::activated(ActivationReason reason)
{
switch (reason)
{
case ILXQtPanelPlugin::Trigger:
case ILXQtPanelPlugin::MiddleClick:
break;
default:
return;
}
if (!mPopup)
{
mPopup = new LXQtWorldClockPopup(mContent);
connect(mPopup, SIGNAL(deactivated()), SLOT(deletePopup()));
if (reason == ILXQtPanelPlugin::Trigger)
{
mPopup->setObjectName(QLatin1String("WorldClockCalendar"));
mPopup->layout()->setContentsMargins(0, 0, 0, 0);
QCalendarWidget *calendarWidget = new QCalendarWidget(mPopup);
mPopup->layout()->addWidget(calendarWidget);
QString timeZoneName = mActiveTimeZone;
if (timeZoneName == QLatin1String("local"))
timeZoneName = QString::fromLatin1(QTimeZone::systemTimeZoneId());
QTimeZone timeZone(timeZoneName.toLatin1());
calendarWidget->setFirstDayOfWeek(QLocale(QLocale::AnyLanguage, timeZone.country()).firstDayOfWeek());
calendarWidget->setSelectedDate(QDateTime::currentDateTime().toTimeZone(timeZone).date());
}
else
{
mPopup->setObjectName(QLatin1String("WorldClockPopup"));
mPopupContent = new QLabel(mPopup);
mPopup->layout()->addWidget(mPopupContent);
mPopupContent->setAlignment(mContent->alignment());
updatePopupContent();
}
mPopup->adjustSize();
mPopup->setGeometry(calculatePopupWindowPos(mPopup->size()));
willShowWindow(mPopup);
mPopup->show();
}
else
{
deletePopup();
}
}
示例4: s_searchFecha
void BlDateSearch::s_searchFecha()
{
BL_FUNC_DEBUG
QDialog *diag = new QDialog ( 0 );
diag->setModal ( true );
QCalendarWidget *calend = new QCalendarWidget ( diag );
/// Se pone el 1er dia del calendario a lunes.
calend->setFirstDayOfWeek ( Qt::Monday );
/// Evitar fechas demasiado antiguas
calend->setMinimumDate( QDate ( 1900, 1, 1 ) );
/// Si el campo estaba vacío, seleccionar una fecha imposible, pero mostrar el mes actual
if ( m_textoFecha->text().isEmpty() ) {
calend->setSelectedDate ( calend->minimumDate() );
calend->setCurrentPage ( QDate::currentDate().year(), QDate::currentDate().month() );
}
/// Si ya hay una fecha en el campo, abrir el calendario con ese día seleccionado inicialmente
else {
calend->setSelectedDate ( blNormalizeDate ( m_textoFecha->text() ) );
}
connect ( calend, SIGNAL ( activated ( const QDate & ) ), diag, SLOT ( accept() ) );
/// Creamos un layout donde estara el contenido de la ventana y la ajustamos al QDialog
/// para que sea redimensionable y aparezca el titulo de la ventana.
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget ( calend );
layout->setMargin ( 0 );
layout->setSpacing ( 0 );
diag->setLayout ( layout );
diag->setWindowTitle ( _ ( "Seleccione fecha" ) );
diag->exec();
/// Si la fecha es imposible, significa que el usuario no ha seleccionado una fecha
/// y su campo debe quedarse como estaba: vacío
if ( calend->selectedDate() != QDate ( 1900, 1, 1 ) ) {
m_textoFecha->setText ( calend->selectedDate().toString ( "dd/MM/yyyy" ) );
}
/// Liberamos la memoria
delete layout;
delete calend;
delete diag;
emit ( valueChanged ( m_textoFecha->text() ) );
emit ( editingFinished () );
}