From f242e1bccc2b40d41aff9cbec9523975acb76857 Mon Sep 17 00:00:00 2001 From: Claveau Joshua Date: Mon, 20 Jul 2020 20:29:13 +0200 Subject: [PATCH] graphics table properties editor : minor Add label to inform users that the number of row is less than the number of information to display. --- .../ui/graphicstablepropertieseditor.cpp | 37 ++++ .../ui/graphicstablepropertieseditor.h | 1 + .../ui/graphicstablepropertieseditor.ui | 203 ++++++++++-------- 3 files changed, 146 insertions(+), 95 deletions(-) diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp index 75ed5aa63..c1e48344d 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp @@ -52,6 +52,8 @@ GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableIte if (table) { setTable(table); } + + ui->m_info_label->setStyleSheet("QLabel {color : red; }"); } /** @@ -281,6 +283,8 @@ void GraphicsTablePropertiesEditor::updateUi() } } + updateInfoLabel(); + auto margin = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString()); ui->m_header_top_margin ->setValue(margin.top()); ui->m_header_left_margin ->setValue(margin.left()); @@ -306,6 +310,38 @@ void GraphicsTablePropertiesEditor::updateUi() setUpEditConnection(); } +void GraphicsTablePropertiesEditor::updateInfoLabel() +{ + auto table_ = m_table_item; + while (table_->previousTable()) { table_ = table_->previousTable();} + + int count_ = 0; + bool infinite = false; + if (table_->displayNRow() <= 0) { + infinite = true; + } else { + count_ = table_->displayNRow(); + } + + while (table_->nextTable()) + { + table_ = table_->nextTable(); + if (table_->displayNRow() <= 0) { + infinite = true; + } else { + count_ += table_->displayNRow(); + } + } + + auto value = m_table_item->model()->rowCount() - count_; + if (value > 0 && !infinite) { + ui->m_info_label->setText(tr("
ATTENTION :
\n il manque %1 lignes afin d'afficher l'intégralité des informations").arg(value)); + ui->m_info_label->show(); + } else { + ui->m_info_label->hide(); + } +} + /** * @brief GraphicsTablePropertiesEditor::setUpEditConnection */ @@ -338,6 +374,7 @@ void GraphicsTablePropertiesEditor::setUpEditConnection() m_edit_connection << connect(m_header_button_group, QOverload::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); #endif m_edit_connection << connect(ui->m_display_n_row_sb, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); + m_edit_connection << connect(ui->m_display_n_row_sb, QOverload::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel); } } diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.h b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.h index 1f5638ff6..f152727e8 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.h +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.h @@ -52,6 +52,7 @@ class GraphicsTablePropertiesEditor : public PropertiesEditorWidget void on_m_header_font_pb_clicked(); void on_m_table_font_pb_clicked(); virtual void updateUi() override; + void updateInfoLabel(); void on_m_table_name_le_textEdited(const QString &arg1); void on_m_previous_table_cb_activated(int index); void on_m_previous_pb_clicked(); diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui index 1922c0296..439512405 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.ui @@ -7,7 +7,7 @@ 0 0 524 - 600 + 623 @@ -40,40 +40,17 @@ Géometrie et lignes - - - - Appliquer la géometrie à tous les tableaux liée à celui-ci - - - - - - - :/ico/22x22/all_pages.png:/ico/22x22/all_pages.png - - - - - - - 10000 - - - - - - QComboBox::InsertAtBottom + + + Toutes + + + 999 - - - Aucun - - - + true @@ -93,14 +70,19 @@ - - - - 10000 + + + + QComboBox::InsertAtBottom + + + Aucun + + - + Qt::Horizontal @@ -113,20 +95,7 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + Ajuster le tableau au folio @@ -140,7 +109,47 @@ - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Y : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + X : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 10000 + + + + @@ -158,47 +167,7 @@ - - - - Lignes à afficher : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - X : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Toutes - - - 999 - - - - - - - Tableau précédent : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + true @@ -218,16 +187,60 @@ - - + + + + 10000 + + + + + + + Appliquer la géometrie à tous les tableaux liée à celui-ci + - Y : + + + + + :/ico/22x22/all_pages.png:/ico/22x22/all_pages.png + + + + + + + Tableau précédent : Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Lignes à afficher : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + TextLabel + + + Qt::RichText + + + false + + +