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); connect(checkbox, &QCheckBox::clicked, m_preview, &QPrintPreviewWidget::updatePreview);
m_diagram_list_hash.insert(diagram, checkbox); m_diagram_list_hash.insert(diagram, checkbox);
} }
layout->addStretch();
} }
QString ProjectPrintWindow::settingsSectionName(const QPrinter *printer) QString ProjectPrintWindow::settingsSectionName(const QPrinter *printer)
@@ -653,17 +654,20 @@ void ProjectPrintWindow::print()
void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date) void ProjectPrintWindow::on_m_date_cb_userDateChanged(const QDate &date)
{ {
on_m_uncheck_all_clicked();
auto index = ui->m_date_from_cb->currentIndex(); auto index = ui->m_date_from_cb->currentIndex();
// 0 = from the date // 0 = all date
// 1 = at the 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()) for (auto diagram : m_diagram_list_hash.keys())
{ {
auto diagram_date = diagram->border_and_titleblock.date(); auto diagram_date = diagram->border_and_titleblock.date();
if ( (index == 0 && diagram_date >= date) || if ( (index == 1 && diagram_date >= date) ||
(index == 1 && diagram_date == date) ) (index == 2 && diagram_date == date) )
m_diagram_list_hash.value(diagram)->setChecked(true); 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) void ProjectPrintWindow::on_m_date_from_cb_currentIndexChanged(int index)
{ {
Q_UNUSED(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()); on_m_date_cb_userDateChanged(ui->m_date_cb->date());
} }

View File

@@ -72,10 +72,9 @@ class ProjectPrintWindow : public QMainWindow
void on_m_check_all_pb_clicked(); void on_m_check_all_pb_clicked();
void on_m_uncheck_all_clicked(); void on_m_uncheck_all_clicked();
void print(); void print();
void on_m_date_cb_userDateChanged(const QDate &date); void on_m_date_cb_userDateChanged(const QDate &date);
void on_m_date_from_cb_currentIndexChanged(int index); void on_m_date_from_cb_currentIndexChanged(int index);
void on_m_apply_date_pb_clicked();
private: private:
void requestPaint(); void requestPaint();

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>956</width> <width>956</width>
<height>554</height> <height>537</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -58,7 +58,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>932</width> <width>932</width>
<height>75</height> <height>58</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
<property name="spacing"> <property name="spacing">
<number>9</number> <number>9</number>
</property> </property>
@@ -98,6 +98,11 @@
</property> </property>
<item> <item>
<widget class="QComboBox" name="m_date_from_cb"> <widget class="QComboBox" name="m_date_from_cb">
<item>
<property name="text">
<string>Toutes les dates</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>À partir de la date du :</string> <string>À partir de la date du :</string>
@@ -112,11 +117,31 @@
</item> </item>
<item> <item>
<widget class="QDateEdit" name="m_date_cb"> <widget class="QDateEdit" name="m_date_cb">
<property name="enabled">
<bool>false</bool>
</property>
<property name="calendarPopup"> <property name="calendarPopup">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>