[qet] [3210] title block properties widget: minor improvement |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 3210
Author: blacksun
Date: 2014-07-13 15:37:43 +0200 (Sun, 13 Jul 2014)
Log Message:
-----------
title block properties widget: minor improvement
Modified Paths:
--------------
trunk/sources/diagramview.cpp
trunk/sources/ui/titleblockpropertieswidget.cpp
trunk/sources/ui/titleblockpropertieswidget.h
trunk/sources/ui/titleblockpropertieswidget.ui
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2014-07-12 21:24:22 UTC (rev 3209)
+++ trunk/sources/diagramview.cpp 2014-07-13 13:37:43 UTC (rev 3210)
@@ -647,16 +647,14 @@
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
border_infos -> setReadOnly(diagram_is_read_only);
- TitleBlockPropertiesWidget *titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, &popup);
+ TitleBlockPropertiesWidget *titleblock_infos;
if (QETProject *parent_project = scene -> project()) {
- titleblock_infos -> setTitleBlockTemplatesCollection(parent_project -> embeddedTitleBlockTemplatesCollection());
- titleblock_infos -> setTitleBlockTemplatesVisible(true);
- // we have to parse again the TitleBlockProperties object, since the
- // first parsing did not know of our templates
- titleblock_infos -> setProperties(titleblock);
- // relay the signal that requires a title block template edition
+ titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, &popup);
connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), this, SIGNAL(editTitleBlockTemplate(QString, bool)));
}
+ else
+ titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, &popup);
+
titleblock_infos -> setReadOnly(diagram_is_read_only);
ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors);
Modified: trunk/sources/ui/titleblockpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.cpp 2014-07-12 21:24:22 UTC (rev 3209)
+++ trunk/sources/ui/titleblockpropertieswidget.cpp 2014-07-13 13:37:43 UTC (rev 3210)
@@ -40,6 +40,25 @@
}
/**
+ * @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget
+ * default constructor with tempalte list
+ * @param tbt_collection template list
+ * @param titleblock properties to edit
+ * @param current_date if true, display the radio button "current date"
+ * @param parent parent widget
+ */
+TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::TitleBlockPropertiesWidget),
+ m_tbt_collection(nullptr)
+{
+ ui->setupUi(this);
+ initDialog(current_date);
+ setTitleBlockTemplatesCollection(tbt_collection);
+ setProperties(titleblock);
+}
+
+/**
* @brief TitleBlockPropertiesWidget::~TitleBlockPropertiesWidget
* destructor
*/
@@ -58,11 +77,12 @@
ui -> m_file_le -> setText (properties.filename);
ui -> m_folio_le -> setText (properties.folio);
- //About date
- on_m_fixed_date_rb_toggled(ui->m_fixed_date_rb->isChecked());
- ui -> m_date_edit -> setDate(QDate::currentDate());
+ //About date
+ ui -> m_date_now_pb -> setDisabled(true);
+ ui -> m_date_edit -> setDisabled(true);
+ ui -> m_date_edit -> setDate(QDate::currentDate());
- if (ui -> m_current_date_rb -> isVisible()) {
+ if (!ui -> m_current_date_rb -> isHidden()) {
if(properties.useDate == TitleBlockProperties::CurrentDate)
ui -> m_current_date_rb -> setChecked(true);
else {
@@ -175,6 +195,7 @@
*/
void TitleBlockPropertiesWidget::setTitleBlockTemplatesCollection(TitleBlockTemplatesCollection *tbt_collection) {
if (!tbt_collection) return;
+ setTitleBlockTemplatesVisible(true);
if (m_tbt_collection && tbt_collection != m_tbt_collection) {
// forget any connection with the previous collection
disconnect(m_tbt_collection, 0, this, 0);
@@ -272,13 +293,3 @@
void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() {
ui -> m_date_edit -> setDate(QDate::currentDate());
}
-
-/**
- * @brief TitleBlockPropertiesWidget::on_m_fixed_date_rb_toggled
- * Disable widget related to fixed date, if radio button
- * current date isn't checked
- */
-void TitleBlockPropertiesWidget::on_m_fixed_date_rb_toggled(bool checked) {
- ui -> m_date_edit -> setEnabled(checked);
- ui -> m_date_now_pb -> setEnabled(checked);
-}
Modified: trunk/sources/ui/titleblockpropertieswidget.h
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.h 2014-07-12 21:24:22 UTC (rev 3209)
+++ trunk/sources/ui/titleblockpropertieswidget.h 2014-07-13 13:37:43 UTC (rev 3210)
@@ -35,6 +35,7 @@
public:
explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
+ explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0);
~TitleBlockPropertiesWidget();
void setProperties(const TitleBlockProperties &properties);
@@ -56,7 +57,6 @@
void updateTemplateList();
void changeCurrentTitleBlockTemplate(QString name);
void on_m_date_now_pb_clicked();
- void on_m_fixed_date_rb_toggled(bool checked);
signals:
void editTitleBlockTemplate(const QString &, bool);
Modified: trunk/sources/ui/titleblockpropertieswidget.ui
===================================================================
--- trunk/sources/ui/titleblockpropertieswidget.ui 2014-07-12 21:24:22 UTC (rev 3209)
+++ trunk/sources/ui/titleblockpropertieswidget.ui 2014-07-13 13:37:43 UTC (rev 3210)
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>508</width>
- <height>567</height>
+ <width>449</width>
+ <height>387</height>
</rect>
</property>
<property name="sizePolicy">
@@ -35,7 +35,7 @@
<item>
<widget class="QGroupBox" name="m_tbt_gb">
<property name="title">
- <string>Informations du cartouche</string>
+ <string>Informations des cartouche</string>
</property>
<property name="checkable">
<bool>false</bool>
@@ -78,7 +78,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -280,5 +280,38 @@
<resources>
<include location="../../qelectrotech.qrc"/>
</resources>
- <connections/>
+ <connections>
+ <connection>
+ <sender>m_fixed_date_rb</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_date_edit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>146</x>
+ <y>199</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>275</x>
+ <y>199</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>m_fixed_date_rb</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_date_now_pb</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>102</x>
+ <y>214</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>401</x>
+ <y>214</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>