first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include "ViewModels.h"
|
||||
|
||||
BarcodeViewModel::BarcodeViewModel(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void BarcodeViewModel::setContentPattern(const QString &contentPattern)
|
||||
{
|
||||
if (m_contentPattern == contentPattern)
|
||||
return;
|
||||
|
||||
m_contentPattern = contentPattern;
|
||||
emit contentPatternChanged();
|
||||
}
|
||||
|
||||
void BarcodeViewModel::setCounterViewModel(CounterViewModel counterViewModel)
|
||||
{
|
||||
m_counterViewModel = std::move(counterViewModel);
|
||||
emit counterViewModelChanged();
|
||||
}
|
||||
|
||||
void BarcodeViewModel::setDateViewModel(DateItemModel dateViewModel)
|
||||
{
|
||||
m_dateViewModel = std::move(dateViewModel);
|
||||
emit dateViewModelChanged();
|
||||
}
|
||||
|
||||
DateItemModel DateItemModel::createDefaultReplaceModel()
|
||||
{
|
||||
DateItemModel model;
|
||||
|
||||
model.dataMap << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7"
|
||||
<< "8" << "9" << "A" << "B" << "C" << "D" << "E" << "F";
|
||||
|
||||
for (int i = 1; i <= 31; ++i) {
|
||||
model.daysMap.append(QString("%1").arg(i, 2, 10, QChar('0')));
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 12; ++i) {
|
||||
model.monthsMap.append(QString("%1").arg(i, 2, 10, QChar('0')));
|
||||
}
|
||||
|
||||
int startYear = QDate::currentDate().year();
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
model.yearsMap.insert(startYear + i, QString::number(startYear + i));
|
||||
}
|
||||
|
||||
model.weeksMap << "MON" << "TUE" << "WED" << "THU" << "FRI" << "SAT" << "SUN";
|
||||
|
||||
for (int i = 0; i <= 23; ++i) {
|
||||
model.hoursMap.append(QString("%1").arg(i, 2, 10, QChar('0')));
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
Reference in New Issue
Block a user