2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2015-02-20 14:56:22 +00:00
|
|
|
Copyright 2006-2015 The QElectroTech Team
|
2007-12-01 10:47:15 +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/>.
|
|
|
|
*/
|
2007-04-13 11:50:16 +00:00
|
|
|
#ifndef NAMES_LIST_WIDGET_H
|
|
|
|
#define NAMES_LIST_WIDGET_H
|
2015-03-02 20:14:56 +00:00
|
|
|
#include <QtWidgets>
|
2007-04-13 15:48:00 +00:00
|
|
|
#include "nameslist.h"
|
2007-04-07 02:37:57 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a widget enabling users to enter localized names for
|
|
|
|
categories and elements.
|
2007-04-07 02:37:57 +00:00
|
|
|
*/
|
2007-04-13 11:50:16 +00:00
|
|
|
class NamesListWidget : public QWidget {
|
2007-04-07 02:37:57 +00:00
|
|
|
Q_OBJECT
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2007-04-07 02:37:57 +00:00
|
|
|
public:
|
2007-04-13 11:50:16 +00:00
|
|
|
NamesListWidget(QWidget * = 0);
|
|
|
|
virtual ~NamesListWidget();
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2007-04-13 11:50:16 +00:00
|
|
|
NamesListWidget(const NamesListWidget &);
|
2007-04-07 02:37:57 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2007-04-07 02:37:57 +00:00
|
|
|
private:
|
|
|
|
QTreeWidget *tree_names;
|
|
|
|
QPushButton *button_add_line;
|
2007-04-13 15:48:00 +00:00
|
|
|
NamesList hash_names;
|
2007-06-30 17:41:07 +00:00
|
|
|
bool read_only;
|
2007-04-07 02:37:57 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2007-04-07 02:37:57 +00:00
|
|
|
public:
|
|
|
|
bool checkOneName();
|
2007-04-13 15:48:00 +00:00
|
|
|
NamesList names();
|
|
|
|
void setNames(const NamesList &);
|
2007-06-30 17:41:07 +00:00
|
|
|
void setReadOnly(bool);
|
|
|
|
bool isReadOnly() const;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2007-04-07 02:37:57 +00:00
|
|
|
private:
|
|
|
|
void clean();
|
|
|
|
void updateHash();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void addLine();
|
2007-06-30 17:41:07 +00:00
|
|
|
void check();
|
|
|
|
|
|
|
|
signals:
|
2007-12-16 14:05:39 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
Signal emitted after the widget successfully checked there was at least one
|
|
|
|
name entered
|
2007-12-16 14:05:39 +00:00
|
|
|
*/
|
2007-06-30 17:41:07 +00:00
|
|
|
void inputChecked();
|
2007-04-07 02:37:57 +00:00
|
|
|
};
|
|
|
|
#endif
|