[qet] qet/qet: [5334] Element info widget : remove the check box 'visible'

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5334
Author:   blacksun
Date:     2018-04-14 14:21:07 +0200 (Sat, 14 Apr 2018)
Log Message:
-----------
Element info widget : remove the check box 'visible'

Modified Paths:
--------------
    trunk/sources/ui/elementinfopartwidget.cpp
    trunk/sources/ui/elementinfopartwidget.h
    trunk/sources/ui/elementinfopartwidget.ui
    trunk/sources/ui/elementinfowidget.cpp

Modified: trunk/sources/ui/elementinfopartwidget.cpp
===================================================================
--- trunk/sources/ui/elementinfopartwidget.cpp	2018-04-12 17:59:05 UTC (rev 5333)
+++ trunk/sources/ui/elementinfopartwidget.cpp	2018-04-14 12:21:07 UTC (rev 5334)
@@ -33,11 +33,9 @@
 {
 	ui->setupUi(this);
 	ui->label_->setText(translated_key);
-	if(key == "label") ui->checkBox->setChecked(true);
 
 	connect(ui->line_edit, &QLineEdit::textEdited,  this, &ElementInfoPartWidget::textEdited);
 	connect(ui->line_edit, &QLineEdit::textChanged, this, &ElementInfoPartWidget::textChanged);
-	connect(ui->checkBox,  &QCheckBox::clicked,     this, &ElementInfoPartWidget::showClicked);
 }
 
 /**
@@ -67,32 +65,6 @@
 }
 
 /**
- * @brief ElementInfoPartWidget::mustShow
- * @return return true if the value must be show, else false
- */
-bool ElementInfoPartWidget::mustShow() const  {
-	return (ui->checkBox->isChecked());
-}
-
-/**
- * @brief ElementInfoPartWidget::setShow
- * Check or not the ckeck box
- * @param s true-> checked
- */
-void ElementInfoPartWidget::setShow(const bool &s) {
-	ui->checkBox->setChecked(s);
-}
-
-/**
- * @brief ElementInfoPartWidget::setHideShow
- * Hide or not the check box
- * @param hide true -> hidden
- */
-void ElementInfoPartWidget::setHideShow(const bool &hide) {
-	ui -> checkBox -> setHidden(hide);
-}
-
-/**
  * @brief ElementInfoPartWidget::setFocusTolineEdit
  * Set the focus to the line edit
  */

Modified: trunk/sources/ui/elementinfopartwidget.h
===================================================================
--- trunk/sources/ui/elementinfopartwidget.h	2018-04-12 17:59:05 UTC (rev 5333)
+++ trunk/sources/ui/elementinfopartwidget.h	2018-04-14 12:21:07 UTC (rev 5334)
@@ -36,9 +36,6 @@
 		QString key         () const {return key_;}
 		void    setText     (const QString &);
 		QString text        () const;
-		bool    mustShow    () const;
-		void    setShow     (const bool &);
-		void    setHideShow (const bool &);
 		void    setFocusTolineEdit();
 		void    setEnabled(bool e);
 		void    setDisabled(bool d);
@@ -46,7 +43,6 @@
 	signals:
 		void textEdited  (const QString & text);
 		void textChanged (const QString & text);
-		void showClicked (bool checked);
 
 	//ATTRIBUTES
 	private:

Modified: trunk/sources/ui/elementinfopartwidget.ui
===================================================================
--- trunk/sources/ui/elementinfopartwidget.ui	2018-04-12 17:59:05 UTC (rev 5333)
+++ trunk/sources/ui/elementinfopartwidget.ui	2018-04-14 12:21:07 UTC (rev 5334)
@@ -48,19 +48,6 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="1">
-    <widget class="QCheckBox" name="checkBox">
-     <property name="focusPolicy">
-      <enum>Qt::NoFocus</enum>
-     </property>
-     <property name="toolTip">
-      <string>Visible</string>
-     </property>
-     <property name="text">
-      <string/>
-     </property>
-    </widget>
-   </item>
    <item row="2" column="0">
     <widget class="QLineEdit" name="line_edit">
      <property name="clearButtonEnabled">

Modified: trunk/sources/ui/elementinfowidget.cpp
===================================================================
--- trunk/sources/ui/elementinfowidget.cpp	2018-04-12 17:59:05 UTC (rev 5333)
+++ trunk/sources/ui/elementinfowidget.cpp	2018-04-14 12:21:07 UTC (rev 5334)
@@ -157,11 +157,8 @@
  */
 void ElementInfoWidget::enableLiveEdit()
 {
-	foreach (ElementInfoPartWidget *eipw, m_eipw_list)
-	{
+	for (ElementInfoPartWidget *eipw : m_eipw_list)
 		connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
-		connect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
-	}
 }
 
 /**
@@ -170,11 +167,8 @@
  */
 void ElementInfoWidget::disableLiveEdit()
 {
-	foreach (ElementInfoPartWidget *eipw, m_eipw_list)
-	{
+	for (ElementInfoPartWidget *eipw : m_eipw_list)
 		disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
-		disconnect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
-	}
 }
 
 /**
@@ -219,23 +213,14 @@
 	if (m_live_edit) disableLiveEdit();
 
 	DiagramContext element_info = m_element->elementInformations();
-	foreach (ElementInfoPartWidget *eipw, m_eipw_list)
-	{
-
+	
+	for (ElementInfoPartWidget *eipw : m_eipw_list) {
 		eipw -> setText (element_info[eipw->key()].toString());
-		eipw -> setShow (element_info.keyMustShow(eipw->key()));
+	}
 
-			//If the current eipw is for label or comment and the text is empty
-			//we force the checkbox to ckecked
-		if (eipw -> key() == "label" || eipw -> key() == "comment" || eipw -> key() == "location" ) {
-			if (element_info[eipw->key()].toString().isEmpty())
-				eipw->setShow(true);
-		}
-		else //< for other eipw we hide the checkbox
-			eipw->setHideShow(true);
+	if (m_live_edit) {
+		enableLiveEdit();
 	}
-
-	if (m_live_edit) enableLiveEdit();
 }
 
 /**
@@ -246,9 +231,11 @@
 {
 	DiagramContext info_;
 
-	foreach (ElementInfoPartWidget *eipw, m_eipw_list)
-		if (!eipw->text().isEmpty()) //add value only if they're something to store
-			info_.addValue(eipw->key(), eipw->text(), eipw->mustShow());
+	for (ElementInfoPartWidget *eipw : m_eipw_list) {
+		if (!eipw->text().isEmpty()) { //add value only if they're something to store
+			info_.addValue(eipw->key(), eipw->text());
+		}
+	}
 
 	return info_;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/