Files
qelectrotech-source-mirror/sources/ui/elementinfopartwidget.h
T
Kellermorph d5ae15f568 Add a material list lookup for the element article fields
The element description dialog only offered typing, so every article of
a catalogue had to be copied in by hand into the Artikelbeschreibung
row of each block, over and over.

Settings > General now keeps the path of a CSV material list (Créer...
writes a template with the header lines), and the Artikelbeschreibung
row of every block of the Bauteil dialog shows a "..." button opening a
searchable listing of that file. "Appliquer" fills the fields of that
block only -- the main block gets everything but label and formula, an
auxiliary block gets description, number, manufacturer, references,
supplier, quantity, unit and additional info -- and a cell that is
empty in the file never erases a value already in the element. The
symbol editor is left alone.

- sources/materiallist/: CSV reading and writing (UTF-8 BOM, ';', every
  field quoted, atomic write through QSaveFile), two header lines
  (translated labels then the canonical English keys), the selection
  window and the new entry form.
- The selection window reads the file again every time it opens, keeps
  its size, column widths, column order and sort between openings,
  shows every column of the file, scrolls all four directions with the
  wheel (Shift + wheel moves the columns) and puts back the order of
  the file when the corner above the row numbers or a row number is
  clicked.
- German translations for the new strings in lang/qet_de.ts.
2026-09-27 21:18:54 +02:00

79 lines
2.1 KiB
C++

/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ELEMENTINFOPARTWIDGET_H
#define ELEMENTINFOPARTWIDGET_H
#include <QWidget>
class QCompleter;
class QStringListModel;
namespace Ui {
class ElementInfoPartWidget;
}
/**
@brief The ElementInfoPartWidget class
gebruikt bij schema editor
als men edit dit Element aanklikt
*/
class ElementInfoPartWidget : public QWidget
{
Q_OBJECT
//METHODS
public:
explicit ElementInfoPartWidget(
QString key,
const QString& translated_key,
QWidget *parent = nullptr);
~ElementInfoPartWidget() override;
QString key () const {return key_;}
QString text () const;
bool hasAcceptableInput() const;
void setText (const QString &);
void setPlaceHolderText (const QString &text);
void setSuggestions (const QStringList &suggestions);
void setFocusTolineEdit();
void setEnabled(bool e);
void setDisabled(bool d);
void setEraseTextVisible (bool visible);
void setEraseTextChecked (bool check);
Qt::CheckState EraseTextCheckState ()const;
void setMaterialButtonVisible (bool visible);
signals:
void textEdited (const QString & text);
void textChanged (const QString & text);
void materialButtonClicked();
//ATTRIBUTES
private slots:
void on_m_erase_text_clicked();
private:
Ui::ElementInfoPartWidget *ui;
QString key_;
bool m_show_erase = false;
QCompleter *m_completer = nullptr;
QStringListModel *m_suggestions_model = nullptr;
};
#endif // ELEMENTINFOPARTWIDGET_H