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
|
* @brief TerminalStripEditor::on_m_add_terminal_strip_pb_clicked
|
||||||
* Action when user click on add terminal strip button
|
* 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();
|
on_m_reload_pb_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TerminalStripEditor::on_m_reload_pb_clicked
|
||||||
|
*/
|
||||||
void TerminalStripEditor::on_m_reload_pb_clicked()
|
void TerminalStripEditor::on_m_reload_pb_clicked()
|
||||||
{
|
{
|
||||||
ui->m_terminal_strip_tw->clear();
|
ui->m_terminal_strip_tw->clear();
|
||||||
@@ -293,5 +308,40 @@ void TerminalStripEditor::on_m_reload_pb_clicked()
|
|||||||
qDeleteAll(m_item_strip_H.keys());
|
qDeleteAll(m_item_strip_H.keys());
|
||||||
|
|
||||||
buildTree();
|
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();
|
void buildTree();
|
||||||
QTreeWidgetItem* addTerminalStrip(TerminalStrip *terminal_strip);
|
QTreeWidgetItem* addTerminalStrip(TerminalStrip *terminal_strip);
|
||||||
void addFreeTerminal();
|
void addFreeTerminal();
|
||||||
|
void clearDataTab();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_add_terminal_strip_pb_clicked();
|
void on_m_add_terminal_strip_pb_clicked();
|
||||||
void on_m_remove_terminal_strip_pb_clicked();
|
void on_m_remove_terminal_strip_pb_clicked();
|
||||||
|
|
||||||
void on_m_reload_pb_clicked();
|
void on_m_reload_pb_clicked();
|
||||||
|
void on_m_terminal_strip_tw_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TerminalStripEditor *ui;
|
Ui::TerminalStripEditor *ui;
|
||||||
|
|||||||
@@ -6,69 +6,206 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>805</width>
|
<width>706</width>
|
||||||
<height>502</height>
|
<height>396</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Gestionnaire de borniers</string>
|
<string>Gestionnaire de borniers</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1" columnstretch="0">
|
||||||
<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>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="m_add_terminal_strip_pb">
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
<property name="text">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<string>Ajouter un bornier</string>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="icon">
|
</property>
|
||||||
<iconset resource="../../../qelectrotech.qrc">
|
<property name="topMargin">
|
||||||
<normaloff>:/ico/16x16/list-add.png</normaloff>:/ico/16x16/list-add.png</iconset>
|
<number>0</number>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="m_reload_pb">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string/>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="handleWidth">
|
||||||
<iconset resource="../../../qelectrotech.qrc">
|
<number>4</number>
|
||||||
<normaloff>:/ico/16x16/view-refresh.png</normaloff>:/ico/16x16/view-refresh.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="childrenCollapsible">
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="3">
|
|
||||||
<widget class="TerminalStripTreeWidget" name="m_terminal_strip_tw">
|
|
||||||
<property name="dragEnabled">
|
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragDropMode">
|
<widget class="TerminalStripTreeWidget" name="m_terminal_strip_tw">
|
||||||
<enum>QAbstractItemView::InternalMove</enum>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<property name="autoExpandDelay">
|
<horstretch>0</horstretch>
|
||||||
<number>500</number>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="animated">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Explorateur de bornier</string>
|
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -80,6 +217,15 @@
|
|||||||
<header location="global">terminalstriptreewidget.h</header>
|
<header location="global">terminalstriptreewidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</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>
|
<resources>
|
||||||
<include location="../../../qelectrotech.qrc"/>
|
<include location="../../../qelectrotech.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user