graphics table properties editor : minor

Add label to inform users that the number of row is less than the number
of information to display.
This commit is contained in:
Claveau Joshua
2020-07-20 20:29:13 +02:00
parent 709280e3c1
commit f242e1bccc
3 changed files with 146 additions and 95 deletions

View File

@@ -52,6 +52,8 @@ GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableIte
if (table) { if (table) {
setTable(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()); 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_top_margin ->setValue(margin.top());
ui->m_header_left_margin ->setValue(margin.left()); ui->m_header_left_margin ->setValue(margin.left());
@@ -306,6 +310,38 @@ void GraphicsTablePropertiesEditor::updateUi()
setUpEditConnection(); 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("<center>ATTENTION :</center>\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 * @brief GraphicsTablePropertiesEditor::setUpEditConnection
*/ */
@@ -338,6 +374,7 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
#endif #endif
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply); m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
} }
} }

View File

@@ -52,6 +52,7 @@ class GraphicsTablePropertiesEditor : public PropertiesEditorWidget
void on_m_header_font_pb_clicked(); void on_m_header_font_pb_clicked();
void on_m_table_font_pb_clicked(); void on_m_table_font_pb_clicked();
virtual void updateUi() override; virtual void updateUi() override;
void updateInfoLabel();
void on_m_table_name_le_textEdited(const QString &arg1); void on_m_table_name_le_textEdited(const QString &arg1);
void on_m_previous_table_cb_activated(int index); void on_m_previous_table_cb_activated(int index);
void on_m_previous_pb_clicked(); void on_m_previous_pb_clicked();

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>524</width> <width>524</width>
<height>600</height> <height>623</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -40,40 +40,17 @@
<string>Géometrie et lignes</string> <string>Géometrie et lignes</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0,0,0,0,0">
<item row="0" column="6">
<widget class="QPushButton" name="m_apply_geometry_to_linked_table_pb">
<property name="toolTip">
<string>Appliquer la géometrie à tous les tableaux liée à celui-ci</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../../qelectrotech.qrc">
<normaloff>:/ico/22x22/all_pages.png</normaloff>:/ico/22x22/all_pages.png</iconset>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="m_y_pos">
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QComboBox" name="m_previous_table_cb"> <widget class="QSpinBox" name="m_display_n_row_sb">
<property name="insertPolicy"> <property name="specialValueText">
<enum>QComboBox::InsertAtBottom</enum> <string>Toutes</string>
</property>
<property name="maximum">
<number>999</number>
</property> </property>
<item>
<property name="text">
<string>Aucun</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="1" column="6"> <item row="2" column="6">
<widget class="QPushButton" name="m_next_pb"> <widget class="QPushButton" name="m_next_pb">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@@ -93,14 +70,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="2" column="4">
<widget class="QSpinBox" name="m_x_pos"> <widget class="QComboBox" name="m_previous_table_cb">
<property name="maximum"> <property name="insertPolicy">
<number>10000</number> <enum>QComboBox::InsertAtBottom</enum>
</property> </property>
<item>
<property name="text">
<string>Aucun</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@@ -113,20 +95,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="7"> <item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="m_auto_geometry_pb"> <widget class="QPushButton" name="m_auto_geometry_pb">
<property name="toolTip"> <property name="toolTip">
<string>Ajuster le tableau au folio</string> <string>Ajuster le tableau au folio</string>
@@ -140,7 +109,47 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="6"> <item row="2" column="7">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Y :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>X :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="m_x_pos">
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
<item row="4" column="1" colspan="6">
<widget class="QWidget" name="widget_3" native="true"> <widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin"> <property name="leftMargin">
@@ -158,47 +167,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="2" column="5">
<widget class="QLabel" name="label">
<property name="text">
<string>Lignes à afficher :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>X :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QSpinBox" name="m_display_n_row_sb">
<property name="specialValueText">
<string>Toutes</string>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Tableau précédent :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="m_previous_pb"> <widget class="QPushButton" name="m_previous_pb">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@@ -218,16 +187,60 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="2">
<widget class="QLabel" name="label_7"> <widget class="QSpinBox" name="m_y_pos">
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QPushButton" name="m_apply_geometry_to_linked_table_pb">
<property name="toolTip">
<string>Appliquer la géometrie à tous les tableaux liée à celui-ci</string>
</property>
<property name="text"> <property name="text">
<string>Y :</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../../qelectrotech.qrc">
<normaloff>:/ico/22x22/all_pages.png</normaloff>:/ico/22x22/all_pages.png</iconset>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Tableau précédent :</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3">
<widget class="QLabel" name="label">
<property name="text">
<string>Lignes à afficher :</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="6">
<widget class="QLabel" name="m_info_label">
<property name="text">
<string>TextLabel</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>