Print preview dialog : Add selection by date.

Add two news option for select diagrams to print :
select "from the date :" and select "at the date".
This commit is contained in:
Claveau Joshua
2020-09-30 21:29:17 +02:00
parent 930bb70f99
commit add11e7c7a
3 changed files with 79 additions and 4 deletions

View File

@@ -120,6 +120,10 @@ ProjectPrintWindow::ProjectPrintWindow(QETProject *project, QPrinter *printer, Q
ui->m_draw_terminal_cb->setChecked(exp.draw_terminals);
ui->m_keep_conductor_color_cb->setChecked(exp.draw_colored_conductors);
ui->m_date_cb->blockSignals(true);
ui->m_date_cb->setDate(QDate::currentDate());
ui->m_date_cb->blockSignals(false);
m_backup_diagram_background_color = Diagram::background_color;
Diagram::background_color = Qt::white;
}
@@ -578,3 +582,28 @@ void ProjectPrintWindow::print()
savePageSetupForCurrentPrinter();
this->close();
}
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
{
on_m_uncheck_all_clicked();
auto index = ui->m_date_from_cb->currentIndex();
// 0 = from the date
// 1 = at the date
for (auto diagram : m_diagram_list_hash.keys())
{
auto diagram_date = diagram->border_and_titleblock.date();
if ( (index == 0 && diagram_date >= date) ||
(index == 1 && diagram_date == date) )
m_diagram_list_hash.value(diagram)->setChecked(true);
}
m_preview->updatePreview();
}
void ProjectPrintWindow::on_m_date_from_cb_currentIndexChanged(int index)
{
Q_UNUSED(index)
on_m_date_cb_userDateChanged(ui->m_date_cb->date());
}