mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Add widgets to edit terminal strip data (WIP)
This commit is contained in:
@@ -232,6 +232,18 @@ void TerminalStripEditor::addFreeTerminal()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalStripEditor::clearDataTab
|
||||
*/
|
||||
void TerminalStripEditor::clearDataTab()
|
||||
{
|
||||
ui->m_installation_le ->clear();
|
||||
ui->m_location_le ->clear();
|
||||
ui->m_name_le ->clear();
|
||||
ui->m_comment_le ->clear();
|
||||
ui->m_description_te ->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalStripEditor::on_m_add_terminal_strip_pb_clicked
|
||||
* Action when user click on add terminal strip button
|
||||
@@ -283,6 +295,9 @@ void TerminalStripEditor::on_m_remove_terminal_strip_pb_clicked()
|
||||
on_m_reload_pb_clicked();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalStripEditor::on_m_reload_pb_clicked
|
||||
*/
|
||||
void TerminalStripEditor::on_m_reload_pb_clicked()
|
||||
{
|
||||
ui->m_terminal_strip_tw->clear();
|
||||
@@ -293,5 +308,40 @@ void TerminalStripEditor::on_m_reload_pb_clicked()
|
||||
qDeleteAll(m_item_strip_H.keys());
|
||||
|
||||
buildTree();
|
||||
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
|
||||
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalStripEditor::on_m_terminal_strip_tw_currentItemChanged
|
||||
* @param current
|
||||
* @param previous
|
||||
*/
|
||||
void TerminalStripEditor::on_m_terminal_strip_tw_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
Q_UNUSED(previous)
|
||||
|
||||
if (!current) {
|
||||
clearDataTab();
|
||||
return;
|
||||
}
|
||||
|
||||
TerminalStrip *strip_ = nullptr;
|
||||
if (current->type() == TerminalStripTreeWidget::Strip) {
|
||||
strip_ = m_item_strip_H.value(current);
|
||||
}
|
||||
else if (current->type() == TerminalStripTreeWidget::Terminal
|
||||
&& current->parent()
|
||||
&& current->parent()->type() == TerminalStripTreeWidget::Strip) {
|
||||
strip_ = m_item_strip_H.value(current->parent());
|
||||
}
|
||||
|
||||
if (strip_) {
|
||||
ui->m_installation_le ->setText(strip_->installation());
|
||||
ui->m_location_le ->setText(strip_->location());
|
||||
ui->m_name_le ->setText(strip_->name());
|
||||
ui->m_comment_le ->setText(strip_->comment());
|
||||
ui->m_description_te ->setPlainText(strip_->description());
|
||||
} else {
|
||||
clearDataTab();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,13 @@ class TerminalStripEditor : public QDialog
|
||||
void buildTree();
|
||||
QTreeWidgetItem* addTerminalStrip(TerminalStrip *terminal_strip);
|
||||
void addFreeTerminal();
|
||||
void clearDataTab();
|
||||
|
||||
private slots:
|
||||
void on_m_add_terminal_strip_pb_clicked();
|
||||
void on_m_remove_terminal_strip_pb_clicked();
|
||||
|
||||
void on_m_reload_pb_clicked();
|
||||
void on_m_terminal_strip_tw_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
|
||||
private:
|
||||
Ui::TerminalStripEditor *ui;
|
||||
|
||||
@@ -6,69 +6,206 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>805</width>
|
||||
<height>502</height>
|
||||
<width>706</width>
|
||||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Gestionnaire de borniers</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="m_remove_terminal_strip_pb">
|
||||
<property name="text">
|
||||
<string>Supprimer le bornier</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-remove.png</normaloff>:/ico/16x16/list-remove.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1" columnstretch="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_add_terminal_strip_pb">
|
||||
<property name="text">
|
||||
<string>Ajouter un bornier</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-add.png</normaloff>:/ico/16x16/list-add.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_add_terminal_strip_pb">
|
||||
<property name="text">
|
||||
<string>Ajouter un bornier</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-add.png</normaloff>:/ico/16x16/list-add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_remove_terminal_strip_pb">
|
||||
<property name="text">
|
||||
<string>Supprimer le bornier</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/list-remove.png</normaloff>:/ico/16x16/list-remove.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_reload_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_reload_pb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<item row="1" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
||||
<property name="handleWidth">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="TerminalStripTreeWidget" name="m_terminal_strip_tw">
|
||||
<property name="dragEnabled">
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="autoExpandDelay">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Explorateur de bornier</string>
|
||||
<widget class="TerminalStripTreeWidget" name="m_terminal_strip_tw">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</column>
|
||||
<property name="dragEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="autoExpandDelay">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Explorateur de bornier</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="m_tab_widget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_layout_tab">
|
||||
<attribute name="title">
|
||||
<string>Disposition</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_data_tab">
|
||||
<attribute name="title">
|
||||
<string>Propriétés</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Installation :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Commentaire</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Nom :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Localisation :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_location_le"/>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="m_description_te"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_installation_le"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_name_le"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="m_comment_le"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -80,6 +217,15 @@
|
||||
<header location="global">terminalstriptreewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_tab_widget</tabstop>
|
||||
<tabstop>m_installation_le</tabstop>
|
||||
<tabstop>m_location_le</tabstop>
|
||||
<tabstop>m_name_le</tabstop>
|
||||
<tabstop>m_comment_le</tabstop>
|
||||
<tabstop>m_description_te</tabstop>
|
||||
<tabstop>tableView</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user