When the date is unknown, only display the year
This commit is contained in:
parent
6a0417a58b
commit
acb9e0ef9c
1 changed files with 9 additions and 1 deletions
|
@ -49,11 +49,17 @@ ArtDetailWindow::ArtDetailWindow(const QString& filename, const QString& assetDi
|
|||
formLayout->addRow("Title", m_titleEdit);
|
||||
|
||||
m_knowExactDateBox = new QCheckBox();
|
||||
connect(m_knowExactDateBox, &QCheckBox::toggled, this, [=](bool checked) {
|
||||
if (checked) {
|
||||
m_dateEdit->setDisplayFormat("yyyy-MM-dd");
|
||||
} else {
|
||||
m_dateEdit->setDisplayFormat("yyyy");
|
||||
}
|
||||
});
|
||||
formLayout->addRow("Know Exact Date?", m_knowExactDateBox);
|
||||
|
||||
m_dateEdit = new QDateEdit();
|
||||
m_dateEdit->setCalendarPopup(true);
|
||||
m_dateEdit->setDisplayFormat("yyyy-MM-dd");
|
||||
formLayout->addRow("Date", m_dateEdit);
|
||||
|
||||
m_altTextEdit = new QTextEdit();
|
||||
|
@ -183,8 +189,10 @@ void ArtDetailWindow::loadData(const QString& filename) {
|
|||
m_knowExactDateBox->setChecked(artJson["date"].toString().contains("-"));
|
||||
if(m_knowExactDateBox->isChecked()) {
|
||||
m_dateEdit->setDate(QDate::fromString(artJson["date"].toString(), "yyyy-MM-dd"));
|
||||
m_dateEdit->setDisplayFormat("yyyy-MM-dd");
|
||||
} else {
|
||||
m_dateEdit->setDate(QDate::fromString(artJson["date"].toString(), "yyyy"));
|
||||
m_dateEdit->setDisplayFormat("yyyy");
|
||||
}
|
||||
|
||||
if(artJson.object().contains("nsfw"))
|
||||
|
|
Loading…
Add table
Reference in a new issue