mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Improve some code and gui
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5643 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -236,7 +236,7 @@ void SearchAndReplaceWorker::replaceConductor(Conductor *conductor)
|
||||
* 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 @@ void SearchAndReplaceWorker::setupLineEdit(QLineEdit *l, QCheckBox *cb, QString
|
||||
{
|
||||
l->setText(str);
|
||||
cb->setChecked(str == eraseText() ? true : false);
|
||||
l->setDisabled(str == eraseText() ? true : false);
|
||||
}
|
||||
|
||||
ConductorProperties SearchAndReplaceWorker::invalidConductorProperties()
|
||||
|
||||
@@ -47,10 +47,8 @@ void ReplaceElementDialog::setContext(DiagramContext context)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
typedef SearchAndReplaceWorker sarw;
|
||||
|
||||
ReplaceFolioWidget::ReplaceFolioWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ReplaceFolioWidget)
|
||||
@@ -75,13 +77,13 @@ TitleBlockProperties ReplaceFolioWidget::titleBlockProperties() const
|
||||
*/
|
||||
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);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "ui_elementinfopartwidget.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
typedef SearchAndReplaceWorker sarw;
|
||||
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::ElementInfoPartWidget
|
||||
@@ -58,8 +59,8 @@ ElementInfoPartWidget::~ElementInfoPartWidget()
|
||||
*/
|
||||
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::setDisabled(bool d) {
|
||||
*/
|
||||
void ElementInfoPartWidget::setEraseTextVisible(bool visible) {
|
||||
ui->m_erase_text->setVisible(visible);
|
||||
m_show_erase = visible;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,6 +55,7 @@ class ElementInfoPartWidget : public QWidget
|
||||
private:
|
||||
Ui::ElementInfoPartWidget *ui;
|
||||
QString key_;
|
||||
bool m_show_erase = false;
|
||||
};
|
||||
|
||||
#endif // ELEMENTINFOPARTWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user