当前位置: 首页>>代码示例>>C++>>正文


C++ QDate::day方法代码示例

本文整理汇总了C++中QDate::day方法的典型用法代码示例。如果您正苦于以下问题:C++ QDate::day方法的具体用法?C++ QDate::day怎么用?C++ QDate::day使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDate的用法示例。


在下文中一共展示了QDate::day方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setDate

void aniadir::setDate(QDate date){

    ui->anadir_dia->setValue(date.day());
    ui->anadir_mes->setValue(date.month());
    ui->anadir_anio->setValue(date.year());

}
开发者ID:oranyero,项目名称:Task-It--Interfaz,代码行数:7,代码来源:aniadir.cpp

示例2: HostComboBox

static HostComboBox *ZMDateFormat()
{
    HostComboBox *gc = new HostComboBox("ZoneMinderDateFormat");
    gc->setLabel(QObject::tr("Date format"));

    QDate sampdate = QDate::currentDate();
    QString sampleStr =
            QObject::tr("Samples are shown using today's date.");

    if (sampdate.month() == sampdate.day())
    {
        sampdate = sampdate.addDays(1);
        sampleStr =
                QObject::tr("Samples are shown using tomorrow's date.");
    }

    gc->addSelection(sampdate.toString("ddd - dd/MM"), "ddd - dd/MM");
    gc->addSelection(sampdate.toString("ddd MMM d"), "ddd MMM d");
    gc->addSelection(sampdate.toString("ddd MMMM d"), "ddd MMMM d");
    gc->addSelection(sampdate.toString("MMM d"), "MMM d");
    gc->addSelection(sampdate.toString("MM/dd"), "MM/dd");
    gc->addSelection(sampdate.toString("MM.dd"), "MM.dd");
    gc->addSelection(sampdate.toString("ddd d MMM"), "ddd d MMM");
    gc->addSelection(sampdate.toString("M/d/yyyy"), "M/d/yyyy");
    gc->addSelection(sampdate.toString("dd.MM.yyyy"), "dd.MM.yyyy");
    gc->addSelection(sampdate.toString("yyyy-MM-dd"), "yyyy-MM-dd");
    gc->addSelection(sampdate.toString("ddd MMM d yyyy"), "ddd MMM d yyyy"); 
    gc->addSelection(sampdate.toString("ddd yyyy-MM-dd"), "ddd yyyy-MM-dd");
    gc->addSelection(sampdate.toString("ddd dd MMM yyyy"), "ddd dd MMM yyyy");
    gc->setHelpText(QObject::tr("Your preferred date format to use on the events screens.") 
            + " " +  sampleStr);
    return gc;
}
开发者ID:JackOfMostTrades,项目名称:mythtv,代码行数:33,代码来源:zmsettings.cpp

示例3: on_boutonAjouterVente_clicked

void DialogAjouterVente::on_boutonAjouterVente_clicked()
{
    string nom = ui->valNom->text().toStdString();
    string categorie = ui->valCat->text().toStdString();
    float prix = ui->valPrix->value();
    unsigned int qte = ui->valQte->text().toUInt();
    string etat = ui->buttonGroup->checkedButton()->text().toStdString();

    if(nom != "" && categorie != "" && prix > 0.00 && qte > 0) {
        if(etat == "Vente aux enchères") {
            QDate date = ui->valDateLimite->date();
            int year = date.year();
            int month = date.month();
            int day = date.day();
            struct tm dateLimite;
            dateLimite.tm_mday = day;
            dateLimite.tm_mon = month;
            dateLimite.tm_year = year;
            gestionBdd->ajouterVente(nom, categorie, prix, qte, true, dateLimite);
            close();
        } else {
            gestionBdd->ajouterVente(nom, categorie, prix, qte, false);
            close();
        }
    }
}
开发者ID:DecolleAnais,项目名称:E-Marche-,代码行数:26,代码来源:DialogAjouterVente.cpp

示例4: saveCouplesToFile

void MainWindow::saveCouplesToFile()
{
    QDate date = QDate::currentDate();
    QString path = QFileDialog::getSaveFileName(this,
                                                tr("Введите имя файла для "
                                                   "сохранения"),
                                                QDir::homePath()
                                                + QDir::separator()
                                                + "draw_"
                                                + QString::number(date.year())
                                                + "."
                                                + QString::number(date.month())
                                                + "."
                                                + QString::number(date.day())
                                                + "_.txt",
                                                tr("Текстовые файлы (*.txt)"));
    if (path.length()) {
        QFile file(path);
        if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
            QMessageBox::warning(this, tr("Ошибка"),
                                 tr("Невозможно открыть файл для записи."));
        }
        QTextStream stream(&file);
#ifdef Q_OS_UNIX
        stream << ui->couples->toPlainText();
#endif
#ifdef Q_OS_WIN
        stream << ui->couples->toPlainText().replace("\n", "\r\n");
#endif
        file.close();
    }
}
开发者ID:39dotyt,项目名称:shooter-drawer,代码行数:32,代码来源:mainwindow.cpp

示例5: QDateTimeToDATE

static DATE QDateTimeToDATE(const QDateTime &dt)
{
    if (!dt.isValid() || dt.isNull())
        return 949998;
    
    SYSTEMTIME stime;
    memset(&stime, 0, sizeof(stime));
    QDate date = dt.date();
    QTime time = dt.time();
    if (date.isValid() && !date.isNull()) {
        stime.wDay = date.day();
        stime.wMonth = date.month();
        stime.wYear = date.year();
    }
    if (time.isValid() && !time.isNull()) {
        stime.wMilliseconds = time.msec();
        stime.wSecond = time.second();
        stime.wMinute = time.minute();
        stime.wHour = time.hour();
    }
    
    double vtime;
    SystemTimeToVariantTime(&stime, &vtime);
    
    return vtime;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:26,代码来源:qaxtypes.cpp

示例6:

int CalendarBox::Context::daysShiftForMonth(QDate month) {
	Assert(!month.isNull());
	constexpr auto kMaxRows = 6;
	auto inMonthIndex = month.day() - 1;
	auto inWeekIndex = month.dayOfWeek() - 1;
	return ((kMaxRows * kDaysInWeek) + inWeekIndex - inMonthIndex) % kDaysInWeek;
}
开发者ID:Federated-Blockchains-Initiative,项目名称:tdesktop,代码行数:7,代码来源:calendar_box.cpp

示例7: QDate

QList<int> tradeDateCalendar::computeFrequencyTradeMonthly(int date_, int minimumDate_, int maximumDate_)
{
    QList<int> tradeDates;

    QDate monthDayCounter = QDate::fromJulianDay(minimumDate_);
    int dayOfMonth = QDate::fromJulianDay(date_).day();

    forever
    {
        QDate monthDayComputation = monthDayCounter;
        if (monthDayComputation.day() > dayOfMonth)
            monthDayComputation = monthDayComputation.addMonths(1);

        if (dayOfMonth > monthDayComputation.daysInMonth())
        {
            monthDayComputation = monthDayComputation.addMonths(1);
            monthDayComputation = QDate(monthDayComputation.year(), monthDayComputation.month(), 1);
        }
        else
            monthDayComputation = QDate(monthDayComputation.year(), monthDayComputation.month(), dayOfMonth);

        date_ = checkTradeDate(monthDayComputation.toJulianDay(), direction_ascending);
        if (date_ > maximumDate_)
            break;

        tradeDates.append(date_);
        monthDayCounter = monthDayCounter.addMonths(1);
    }

    return tradeDates;
}
开发者ID:choff97,项目名称:mypersonalindex,代码行数:31,代码来源:tradeDateCalendar.cpp

示例8: addDays_data

void tst_QDate::addDays_data()
{
    QTest::addColumn<int>("year");
    QTest::addColumn<int>("month");
    QTest::addColumn<int>("day");
    QTest::addColumn<int>("amountToAdd");
    QTest::addColumn<int>("expectedYear");
    QTest::addColumn<int>("expectedMonth");
    QTest::addColumn<int>("expectedDay");

    QTest::newRow( "data0" ) << 2000 << 1 << 1 << 1 << 2000 << 1 << 2;
    QTest::newRow( "data1" ) << 2000 << 1 << 31 << 1 << 2000 << 2 << 1;
    QTest::newRow( "data2" ) << 2000 << 2 << 28 << 1 << 2000 << 2 << 29;
    QTest::newRow( "data3" ) << 2000 << 2 << 29 << 1 << 2000 << 3 << 1;
    QTest::newRow( "data4" ) << 2000 << 12 << 31 << 1 << 2001 << 1 << 1;
    QTest::newRow( "data5" ) << 2001 << 2 << 28 << 1 << 2001 << 3 << 1;
    QTest::newRow( "data6" ) << 2001 << 2 << 28 << 30 << 2001 << 3 << 30;
    QTest::newRow( "data7" ) << 2001 << 3 << 30 << 5 << 2001 << 4 << 4;

    QTest::newRow( "data8" ) << 2000 << 1 << 1 << -1 << 1999 << 12 << 31;
    QTest::newRow( "data9" ) << 2000 << 1 << 31 << -1 << 2000 << 1 << 30;
    QTest::newRow( "data10" ) << 2000 << 2 << 28 << -1 << 2000 << 2 << 27;
    QTest::newRow( "data11" ) << 2001 << 2 << 28 << -30 << 2001 << 1 << 29;

    QDate invalid;
    QTest::newRow( "data12" ) << -4713 << 1 << 2 << -2
        << invalid.year() << invalid.month() << invalid.day();
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:28,代码来源:tst_qdate.cpp

示例9: text

 QString QCalendarDayValidator::text(const QDate &date, int repeat) const
 {
     if (repeat <= 1) {
         return QString::number(date.day());
     } else if (repeat == 2) {
         QString str;
         if (date.day() / 10 == 0)
             str += QLatin1String("0");
         return str + QString::number(date.day());
     } else if (repeat == 3) {
         return m_locale.dayName(date.dayOfWeek(), QLocale::ShortFormat);
     } else if (repeat >= 4) {
         return m_locale.dayName(date.dayOfWeek(), QLocale::LongFormat);
     }
     return QString();
 }
开发者ID:Camelek,项目名称:qtmoko,代码行数:16,代码来源:dayview.cpp

示例10: HostComboBox

static HostComboBox *MythArchiveDateFormat()
{
    HostComboBox *gc = new HostComboBox("MythArchiveDateFormat");
    gc->setLabel(QObject::tr("Date format"));

    QDate sampdate = QDate::currentDate();
    QString sampleStr =
            QObject::tr("Samples are shown using today's date.");

    if (sampdate.month() == sampdate.day())
    {
        sampdate = sampdate.addDays(1);
        sampleStr =
                QObject::tr("Samples are shown using tomorrow's date.");
    }

    gc->addSelection(sampdate.toString("ddd MMM d"), "%a  %b  %d");
    gc->addSelection(sampdate.toString("ddd MMMM d"), "%a %B %d");
    gc->addSelection(sampdate.toString("MMM d"), "%b %d");
    gc->addSelection(sampdate.toString("MM/dd"), "%m/%d");
    gc->addSelection(sampdate.toString("MM.dd"), "%m.%d");
    gc->addSelection(sampdate.toString("ddd d MMM"), "%a %d %b");
    gc->addSelection(sampdate.toString("M/d/yyyy"), "%m/%d/%Y");
    gc->addSelection(sampdate.toString("dd.MM.yyyy"), "%d.%m.%Y");
    gc->addSelection(sampdate.toString("yyyy-MM-dd"), "%Y-%m-%d");
    gc->addSelection(sampdate.toString("ddd MMM d yyyy"), "%a %b %d %Y");
    gc->addSelection(sampdate.toString("ddd yyyy-MM-dd"), "%a %Y-%m-%d");
    gc->addSelection(sampdate.toString("ddd dd MMM yyyy"), "%a %d %b %Y");
    gc->setHelpText(QObject::tr("Your preferred date format to use on DVD menus.") + " " +
            sampleStr);
    return gc;
}
开发者ID:gorillaoncrack,项目名称:mythtv,代码行数:32,代码来源:archivesettings.cpp

示例11: QString

DateItem::DateItem(QDate date)
{
	date_ = date;
	setText(0,date.toString(Qt::SystemLocaleDate));
	QString sort = QString(date.year()* 10000 +date.month()*100 + date.day());
	setText(1,sort);
}
开发者ID:BackupTheBerlios,项目名称:synapse-xmpp-svn,代码行数:7,代码来源:historydlg.cpp

示例12: firstday

bool cal2::showtodomark(QDate date)
{
    if(date.year()!=cur_date.year() || date.month()!=cur_date.month()) return false;
    QDate firstday(date.year(),date.month(),1);
    labels[date.day()+firstday.dayOfWeek()-1]->btodo->show();
    return true;
}
开发者ID:AdachiQ,项目名称:multiFunctionCal,代码行数:7,代码来源:cal2.cpp

示例13: showDate

void ShowDate::showDate()
{
    QDate date = QDate::currentDate();
    QString date_text;
    date_text.sprintf("%d-%02d-%02d", date.year(), date.month(), date.day());
    ymdlcd->display(date_text);
}
开发者ID:navyzhou926,项目名称:test.2,代码行数:7,代码来源:mydialog.cpp

示例14: setDstEndDate

void SchedulesTabController::setDstEndDate(const QDate & newdate)
{
  model::RunPeriodControlDaylightSavingTime dst =
    m_model.getUniqueModelObject<model::RunPeriodControlDaylightSavingTime>();

  dst.setEndDate(monthOfYear(newdate.month()),newdate.day());
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:7,代码来源:SchedulesTabController.cpp

示例15: calculAge

// Calcul de l'âge du capitaine
int AddressBook::calculAge(QDate birthdate) {
    int age = QDate::currentDate().year() - birthdate.year();
    if((QDate::currentDate().month() - birthdate.month()) < 0) age--;
    else if ((QDate::currentDate().month() - birthdate.month()) == 0) {
       if((QDate::currentDate().day() - birthdate.day()) < 0) age--;
   }
    return age;
}
开发者ID:Tuxkowo,项目名称:swithom,代码行数:9,代码来源:addressbook.cpp


注:本文中的QDate::day方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。