project print window : minor gui improvement

This commit is contained in:
Claveau Joshua
2020-10-10 12:12:50 +02:00
parent b45c6b453e
commit 44e945489a
3 changed files with 48 additions and 12 deletions

View File

@@ -410,6 +410,7 @@ void ProjectPrintWindow::setUpDiagramList()
connect(checkbox, &QCheckBox::clicked, m_preview, &QPrintPreviewWidget::updatePreview);
m_diagram_list_hash.insert(diagram, checkbox);
}
layout->addStretch();
}
QString ProjectPrintWindow::settingsSectionName(const QPrinter *printer)
@@ -653,17 +654,20 @@ void ProjectPrintWindow::print()
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
// 0 = all date
// 1 = from the date
// 2 = at the date
if (index) { on_m_uncheck_all_clicked(); }
else { on_m_check_all_pb_clicked(); }
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) )
if ( (index == 1 && diagram_date >= date) ||
(index == 2 && diagram_date == date) )
m_diagram_list_hash.value(diagram)->setChecked(true);
}
@@ -673,5 +677,13 @@ void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
void ProjectPrintWindow::on_m_date_from_cb_currentIndexChanged(int index)
{
Q_UNUSED(index)
ui->m_date_cb->setEnabled(index);
ui->m_apply_date_pb->setEnabled(index);
on_m_date_cb_userDateChanged(ui->m_date_cb->date());
}
void ProjectPrintWindow::on_m_apply_date_pb_clicked() {
on_m_date_cb_userDateChanged(ui->m_date_cb->date());
}

View File

@@ -72,12 +72,11 @@ class ProjectPrintWindow : public QMainWindow
void on_m_check_all_pb_clicked();
void on_m_uncheck_all_clicked();
void print();
void on_m_date_cb_userDateChanged(const QDate &date);
void on_m_date_from_cb_currentIndexChanged(int index);
void on_m_apply_date_pb_clicked();
private:
private:
void requestPaint();
void printDiagram(Diagram *diagram, bool fit_page, QPainter *painter, QPrinter *printer);
QRect diagramRect(Diagram *diagram, const ExportProperties &option) const;

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>956</width>
<height>554</height>
<height>537</height>
</rect>
</property>
<property name="sizePolicy">
@@ -58,7 +58,7 @@
<x>0</x>
<y>0</y>
<width>932</width>
<height>75</height>
<height>58</height>
</rect>
</property>
</widget>
@@ -80,7 +80,7 @@
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
<property name="spacing">
<number>9</number>
</property>
@@ -98,6 +98,11 @@
</property>
<item>
<widget class="QComboBox" name="m_date_from_cb">
<item>
<property name="text">
<string>Toutes les dates</string>
</property>
</item>
<item>
<property name="text">
<string>À partir de la date du :</string>
@@ -112,11 +117,31 @@
</item>
<item>
<widget class="QDateEdit" name="m_date_cb">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_apply_date_pb">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../qelectrotech.qrc">
<normaloff>:/ico/16x16/dialog-ok.png</normaloff>:/ico/16x16/dialog-ok.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>