2014-01-29 19:14:04 +00:00
|
|
|
/*
|
2020-06-15 17:42:37 +02:00
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
2014-01-29 19:14:04 +00:00
|
|
|
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/>.
|
|
|
|
*/
|
2013-05-18 18:39:53 +00:00
|
|
|
#ifndef NUMPARTEDITORW_H
|
|
|
|
#define NUMPARTEDITORW_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QValidator>
|
|
|
|
#include "numerotationcontext.h"
|
|
|
|
|
2013-06-28 11:29:36 +00:00
|
|
|
/**
|
|
|
|
*This class represent a single part num widget. By this widget, we can define and edit
|
|
|
|
*how the num auto must work .
|
|
|
|
*This widget is called by selectautonumw.
|
2020-08-16 11:19:36 +02:00
|
|
|
*/
|
2013-05-18 18:39:53 +00:00
|
|
|
namespace Ui {
|
|
|
|
class NumPartEditorW;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NumPartEditorW : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2017-02-26 18:30:34 +00:00
|
|
|
//METHODS
|
2013-05-18 18:39:53 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
explicit NumPartEditorW(int type, QWidget *parent = nullptr);
|
|
|
|
NumPartEditorW (NumerotationContext &, int, int type, QWidget *parent=nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~NumPartEditorW() override;
|
2013-05-18 18:39:53 +00:00
|
|
|
|
2017-02-26 18:30:34 +00:00
|
|
|
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
|
2018-12-04 22:33:11 +00:00
|
|
|
string,idfolio,folio,plant,locmach,
|
2017-02-26 18:30:34 +00:00
|
|
|
elementline,elementcolumn,elementprefix,
|
|
|
|
};
|
|
|
|
NumerotationContext toNumContext();
|
|
|
|
bool isValid ();
|
|
|
|
type type_;
|
2013-05-18 18:39:53 +00:00
|
|
|
|
2016-07-26 18:52:49 +00:00
|
|
|
private:
|
2017-02-26 18:30:34 +00:00
|
|
|
void setVisibleItems();
|
|
|
|
void disableItem(int index);
|
|
|
|
void setCurrentIndex(NumPartEditorW::type);
|
2016-07-26 18:52:49 +00:00
|
|
|
|
2013-05-18 18:39:53 +00:00
|
|
|
private slots:
|
2017-02-26 18:30:34 +00:00
|
|
|
void on_type_cb_activated(int);
|
|
|
|
void on_value_field_textEdited();
|
|
|
|
void on_increase_spinBox_valueChanged(int);
|
|
|
|
void setType (NumPartEditorW::type t, bool=false);
|
2013-05-18 18:39:53 +00:00
|
|
|
|
|
|
|
signals:
|
2017-02-26 18:30:34 +00:00
|
|
|
void changed ();
|
2013-05-18 18:39:53 +00:00
|
|
|
|
|
|
|
private:
|
2017-02-26 18:30:34 +00:00
|
|
|
Ui::NumPartEditorW *ui;
|
|
|
|
QValidator *intValidator;
|
|
|
|
int m_edited_type = -1; //0 == element : 1 == conductor : 2 == folio
|
|
|
|
|
2016-07-10 01:33:49 +00:00
|
|
|
|
2013-05-18 18:39:53 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NUMPARTEDITORW_H
|