[qet] qet/qet: [5643] Improve some code and gui

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


Revision: 5643
Author:   blacksun
Date:     2018-12-09 19:37:09 +0100 (Sun, 09 Dec 2018)
Log Message:
-----------
Improve some code and gui

Modified Paths:
--------------
    trunk/sources/SearchAndReplace/searchandreplaceworker.cpp
    trunk/sources/SearchAndReplace/ui/replaceelementdialog.cpp
    trunk/sources/SearchAndReplace/ui/replacefoliowidget.cpp
    trunk/sources/ui/elementinfopartwidget.cpp
    trunk/sources/ui/elementinfopartwidget.h

Modified: trunk/sources/SearchAndReplace/searchandreplaceworker.cpp
===================================================================
--- trunk/sources/SearchAndReplace/searchandreplaceworker.cpp	2018-12-09 14:48:56 UTC (rev 5642)
+++ trunk/sources/SearchAndReplace/searchandreplaceworker.cpp	2018-12-09 18:37:09 UTC (rev 5643)
@@ -236,7 +236,7 @@
  * With search and replace, when the variable to edit is a text,
  * the editor is always the same no matter if it is for a folio, element or conductor.
  * The editor is a QLineEdit to edit the text and checkbox to erase the text if checked.
- * This function fill the editor
+ * This function fill the editor, from the current string
  * @param l
  * @param cb
  * @param str
@@ -245,6 +245,7 @@
 {
 	l->setText(str);
 	cb->setChecked(str == eraseText() ? true : false);
+	l->setDisabled(str == eraseText() ? true : false);
 }
 
 ConductorProperties SearchAndReplaceWorker::invalidConductorProperties()

Modified: trunk/sources/SearchAndReplace/ui/replaceelementdialog.cpp
===================================================================
--- trunk/sources/SearchAndReplace/ui/replaceelementdialog.cpp	2018-12-09 14:48:56 UTC (rev 5642)
+++ trunk/sources/SearchAndReplace/ui/replaceelementdialog.cpp	2018-12-09 18:37:09 UTC (rev 5643)
@@ -47,10 +47,8 @@
 {
 	m_context = context;
 	
-	for (ElementInfoPartWidget *eipw : m_eipw_list)
-	{
+	for (ElementInfoPartWidget *eipw : m_eipw_list) {
 		eipw->setText(m_context[eipw->key()].toString());
-		eipw->setEraseTextChecked(false);
 	}
 }
 

Modified: trunk/sources/SearchAndReplace/ui/replacefoliowidget.cpp
===================================================================
--- trunk/sources/SearchAndReplace/ui/replacefoliowidget.cpp	2018-12-09 14:48:56 UTC (rev 5642)
+++ trunk/sources/SearchAndReplace/ui/replacefoliowidget.cpp	2018-12-09 18:37:09 UTC (rev 5643)
@@ -22,6 +22,8 @@
 
 #include <QDialogButtonBox>
 
+typedef SearchAndReplaceWorker sarw;
+
 ReplaceFolioWidget::ReplaceFolioWidget(QWidget *parent) :
 	QWidget(parent),
 	ui(new Ui::ReplaceFolioWidget)
@@ -75,13 +77,13 @@
  */
 void ReplaceFolioWidget::setTitleBlockProperties(const TitleBlockProperties &properties)
 {
-	ui->m_title_le ->setText (properties.title);
-	ui->m_author_le->setText (properties.author);
-	ui->m_file_le  ->setText (properties.filename);
-	ui->m_plant     ->setText (properties.plant);
-	ui->m_loc      ->setText (properties.locmach);
-	ui->m_indice   ->setText (properties.indexrev);
-	ui->m_folio_le ->setText (properties.folio);
+	sarw::setupLineEdit(ui->m_title_le, ui->m_title_cb, properties.title);
+	sarw::setupLineEdit(ui->m_author_le, ui->m_author_cb, properties.author);
+	sarw::setupLineEdit(ui->m_file_le, ui->m_file_cb, properties.filename);
+	sarw::setupLineEdit(ui->m_plant, ui->m_plant_cb, properties.plant);
+	sarw::setupLineEdit(ui->m_loc, ui->m_loc_cb, properties.locmach);
+	sarw::setupLineEdit(ui->m_indice, ui->m_indice_cb, properties.indexrev);
+	sarw::setupLineEdit(ui->m_folio_le, ui->m_folio_cb, properties.folio);
 
 		//About date	
 	ui->m_date_now_pb->setDisabled(true);

Modified: trunk/sources/ui/elementinfopartwidget.cpp
===================================================================
--- trunk/sources/ui/elementinfopartwidget.cpp	2018-12-09 14:48:56 UTC (rev 5642)
+++ trunk/sources/ui/elementinfopartwidget.cpp	2018-12-09 18:37:09 UTC (rev 5643)
@@ -21,6 +21,7 @@
 #include "ui_elementinfopartwidget.h"
 #include "searchandreplaceworker.h"
 
+typedef SearchAndReplaceWorker sarw;
 
 /**
  * @brief ElementInfoPartWidget::ElementInfoPartWidget
@@ -58,8 +59,8 @@
  */
 void ElementInfoPartWidget::setText(const QString &txt)
 {
-	if (txt == SearchAndReplaceWorker::eraseText()) {
-		ui->m_erase_text->setChecked(true);
+	if (m_show_erase) {
+		sarw::setupLineEdit(ui->line_edit, ui->m_erase_text, txt);
 	} else {
 		ui->line_edit->setText(txt);
 	}
@@ -113,6 +114,7 @@
  */
 void ElementInfoPartWidget::setEraseTextVisible(bool visible) {
 	ui->m_erase_text->setVisible(visible);
+	m_show_erase = visible;
 }
 
 /**

Modified: trunk/sources/ui/elementinfopartwidget.h
===================================================================
--- trunk/sources/ui/elementinfopartwidget.h	2018-12-09 14:48:56 UTC (rev 5642)
+++ trunk/sources/ui/elementinfopartwidget.h	2018-12-09 18:37:09 UTC (rev 5643)
@@ -48,13 +48,14 @@
 		void textEdited  (const QString & text);
 		void textChanged (const QString & text);
 
-	//ATTRIBUTES
-		private slots:
+		//ATTRIBUTES
+	private slots:
 		void on_m_erase_text_clicked();
 		
-		private:
+	private:
 		Ui::ElementInfoPartWidget *ui;
 		QString key_;
+		bool m_show_erase = false;
 };
 
 #endif // ELEMENTINFOPARTWIDGET_H


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