mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
title block properties widget: minor improvement
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3210 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -647,16 +647,14 @@ void DiagramView::editDiagramProperties() {
|
||||
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);
|
||||
|
||||
@@ -39,6 +39,25 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockPropertie
|
||||
setProperties(titleblock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
@@ -59,10 +78,11 @@ void TitleBlockPropertiesWidget::setProperties(const TitleBlockProperties &prope
|
||||
ui -> m_folio_le -> setText (properties.folio);
|
||||
|
||||
//About date
|
||||
on_m_fixed_date_rb_toggled(ui->m_fixed_date_rb->isChecked());
|
||||
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::setCurrentTitleBlockTemplateName (const QString
|
||||
*/
|
||||
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::changeCurrentTitleBlockTemplate(QString name) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
|
||||
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 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
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);
|
||||
|
||||
@@ -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 @@ associer le nom "volta" et la valeur "1745" remplacera %{vol
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user