[qet] [3995] Master properties widget : enable live edit mode |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 3995
Author: blacksun
Date: 2015-05-29 09:28:58 +0200 (Fri, 29 May 2015)
Log Message:
-----------
Master properties widget : enable live edit mode
Modified Paths:
--------------
trunk/sources/PropertiesEditor/propertieseditorwidget.h
trunk/sources/ui/masterpropertieswidget.cpp
trunk/sources/ui/masterpropertieswidget.h
Modified: trunk/sources/PropertiesEditor/propertieseditorwidget.h
===================================================================
--- trunk/sources/PropertiesEditor/propertieseditorwidget.h 2015-05-27 21:40:32 UTC (rev 3994)
+++ trunk/sources/PropertiesEditor/propertieseditorwidget.h 2015-05-29 07:28:58 UTC (rev 3995)
@@ -42,7 +42,7 @@
virtual bool setLiveEdit (bool live_edit);
bool isLiveEdit() const;
- private:
+ protected:
virtual void enableLiveEdit() {}
virtual void disableLiveEdit() {}
Modified: trunk/sources/ui/masterpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/masterpropertieswidget.cpp 2015-05-27 21:40:32 UTC (rev 3994)
+++ trunk/sources/ui/masterpropertieswidget.cpp 2015-05-29 07:28:58 UTC (rev 3995)
@@ -70,8 +70,12 @@
}
else m_project = nullptr;
+ //Keep up to date this widget when the linked elements of m_element change
+ if (m_element) disconnect(m_element, &Element::linkedElementChanged, this, &MasterPropertiesWidget::updateUi);
m_element = element;
- buildInterface();
+ connect(m_element, &Element::linkedElementChanged, this, &MasterPropertiesWidget::updateUi);
+
+ updateUi();
}
/**
@@ -95,7 +99,7 @@
delete lwi;
}
lwi_hash.clear();
- buildInterface();
+ updateUi();
}
/**
@@ -145,10 +149,22 @@
}
/**
- * @brief MasterPropertiesWidget::buildInterface
+ * @brief MasterPropertiesWidget::setLiveEdit
+ * @param live_edit = true : live edit is enable
+ * else false : live edit is disable.
+ * @return always true because live edit is handled by this editor widget
+ */
+bool MasterPropertiesWidget::setLiveEdit(bool live_edit)
+{
+ m_live_edit = live_edit;
+ return true;
+}
+
+/**
+ * @brief MasterPropertiesWidget::updateUi
* Build the interface of the widget
*/
-void MasterPropertiesWidget::buildInterface()
+void MasterPropertiesWidget::updateUi()
{
ui->free_list->clear();
ui->linked_list->clear();
@@ -193,22 +209,28 @@
* @brief MasterPropertiesWidget::on_link_button_clicked
* move curent item in the free_list to linked_list
*/
-void MasterPropertiesWidget::on_link_button_clicked() {
- //take the curent item from free_list and push it to linked_list
+void MasterPropertiesWidget::on_link_button_clicked()
+{
+ //take the curent item from free_list and push it to linked_list
ui->linked_list->addItem(
ui->free_list->takeItem(
ui->free_list->currentRow()));
+
+ if(m_live_edit) apply();
}
/**
* @brief MasterPropertiesWidget::on_unlink_button_clicked
* move curent item in linked_list to free_list
*/
-void MasterPropertiesWidget::on_unlink_button_clicked() {
- //take the curent item from linked_list and push it to free_list
+void MasterPropertiesWidget::on_unlink_button_clicked()
+{
+ //take the curent item from linked_list and push it to free_list
ui->free_list->addItem(
ui->linked_list->takeItem(
ui->linked_list->currentRow()));
+
+ if(m_live_edit) apply();
}
/**
@@ -247,5 +269,5 @@
{
//We use a timer because if the removed diagram contain slave element linked to the edited element
//we must to wait for this elements be unlinked, else the linked list provide deleted elements.
- QTimer::singleShot(10, this, SLOT(buildInterface()));
+ QTimer::singleShot(10, this, SLOT(updateUi()));
}
Modified: trunk/sources/ui/masterpropertieswidget.h
===================================================================
--- trunk/sources/ui/masterpropertieswidget.h 2015-05-27 21:40:32 UTC (rev 3994)
+++ trunk/sources/ui/masterpropertieswidget.h 2015-05-29 07:28:58 UTC (rev 3995)
@@ -43,17 +43,20 @@
Q_OBJECT
public:
- explicit MasterPropertiesWidget(Element *elmt, QWidget *parent = 0);
- ~MasterPropertiesWidget();
+ explicit MasterPropertiesWidget(Element *elmt, QWidget *parent = 0);
+ ~MasterPropertiesWidget();
- void setElement (Element *element);
- void apply();
- void reset();
- QUndoCommand *associatedUndo () const;
- QString title() const {return tr("Référence croisée (maitre)");}
+ void setElement (Element *element);
+ void apply();
+ void reset();
+ QUndoCommand *associatedUndo () const;
+ QString title() const {return tr("Référence croisée (maitre)");}
+ bool setLiveEdit(bool live_edit);
+ public slots:
+ void updateUi();
+
private slots:
- void buildInterface();
void on_link_button_clicked();
void on_unlink_button_clicked();
void showElementFromLWI(QListWidgetItem *lwi);
- Messages sorted by: [ date | thread ]
- Prev by Date:
[qet] [3994] Add new symbols, thanks cbh41600, Angelescu, eb3pas, Baboune, mathdabomb, titus, Yes, Julkien
- Next by Date:
[qet] [3996] Element info widget : enable the use of live edit mode
- Previous by thread:
[qet] [3994] Add new symbols, thanks cbh41600, Angelescu, eb3pas, Baboune, mathdabomb, titus, Yes, Julkien
- Next by thread:
[qet] [3996] Element info widget : enable the use of live edit mode