mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-22 17:59:58 +01:00
Search and replace : Element properties can be changed (and mass changed) through the search and replace widget.
Also improve the search for element git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5576 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2017 The QElectroTech Team
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <utility>
|
||||
#include "ui_elementinfopartwidget.h"
|
||||
#include "searchandreplaceworker.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,7 @@ ElementInfoPartWidget::ElementInfoPartWidget(QString key, const QString& transla
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->label_->setText(translated_key);
|
||||
ui->m_erase_text->setVisible(false);
|
||||
|
||||
connect(ui->line_edit, &QLineEdit::textEdited, this, &ElementInfoPartWidget::textEdited);
|
||||
connect(ui->line_edit, &QLineEdit::textChanged, this, &ElementInfoPartWidget::textChanged);
|
||||
@@ -54,8 +56,13 @@ ElementInfoPartWidget::~ElementInfoPartWidget()
|
||||
* Set text to line edit
|
||||
* @param txt
|
||||
*/
|
||||
void ElementInfoPartWidget::setText(const QString &txt) {
|
||||
ui->line_edit->setText(txt);
|
||||
void ElementInfoPartWidget::setText(const QString &txt)
|
||||
{
|
||||
if (txt == SearchAndReplaceWorker::eraseText()) {
|
||||
ui->m_erase_text->setChecked(true);
|
||||
} else {
|
||||
ui->line_edit->setText(txt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,8 +86,7 @@ void ElementInfoPartWidget::setFocusTolineEdit() {
|
||||
* enable the line edit
|
||||
* @param e
|
||||
*/
|
||||
void ElementInfoPartWidget::setEnabled(bool e)
|
||||
{
|
||||
void ElementInfoPartWidget::setEnabled(bool e) {
|
||||
ui->line_edit->setEnabled(e);
|
||||
}
|
||||
|
||||
@@ -89,7 +95,36 @@ void ElementInfoPartWidget::setEnabled(bool e)
|
||||
* disable the line edit
|
||||
* @param d
|
||||
*/
|
||||
void ElementInfoPartWidget::setDisabled(bool d)
|
||||
{
|
||||
void ElementInfoPartWidget::setDisabled(bool d) {
|
||||
ui->line_edit->setDisabled(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::setEraseTextVisible
|
||||
* @param visible
|
||||
*/
|
||||
void ElementInfoPartWidget::setEraseTextVisible(bool visible) {
|
||||
ui->m_erase_text->setVisible(visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::setEraseTextChecked
|
||||
* @param check
|
||||
*/
|
||||
void ElementInfoPartWidget::setEraseTextChecked(bool check) {
|
||||
ui->m_erase_text->setChecked(check);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementInfoPartWidget::EraseTextCheckState
|
||||
* @return
|
||||
*/
|
||||
Qt::CheckState ElementInfoPartWidget::EraseTextCheckState() const {
|
||||
return ui->m_erase_text->checkState();
|
||||
}
|
||||
|
||||
void ElementInfoPartWidget::on_m_erase_text_clicked()
|
||||
{
|
||||
ui->line_edit->setText(ui->m_erase_text->isChecked() ? SearchAndReplaceWorker::eraseText() : QString());
|
||||
ui->line_edit->setDisabled(ui->m_erase_text->isChecked());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2017 The QElectroTech Team
|
||||
Copyright 2006-2018 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -39,13 +39,19 @@ class ElementInfoPartWidget : public QWidget
|
||||
void setFocusTolineEdit();
|
||||
void setEnabled(bool e);
|
||||
void setDisabled(bool d);
|
||||
void setEraseTextVisible (bool visible);
|
||||
void setEraseTextChecked (bool check);
|
||||
Qt::CheckState EraseTextCheckState ()const;
|
||||
|
||||
signals:
|
||||
void textEdited (const QString & text);
|
||||
void textChanged (const QString & text);
|
||||
|
||||
//ATTRIBUTES
|
||||
private:
|
||||
private slots:
|
||||
void on_m_erase_text_clicked();
|
||||
|
||||
private:
|
||||
Ui::ElementInfoPartWidget *ui;
|
||||
QString key_;
|
||||
};
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>400</height>
|
||||
<width>65</width>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>400</height>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -41,6 +41,13 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLineEdit" name="line_edit">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_">
|
||||
<property name="text">
|
||||
@@ -48,10 +55,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLineEdit" name="line_edit">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="m_erase_text">
|
||||
<property name="toolTip">
|
||||
<string>Supprimer ce texte</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user