2014-01-29 19:31:34 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 The QElectroTech Team
|
2014-01-29 19:31:34 +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/>.
|
|
|
|
*/
|
2012-07-01 21:54:00 +00:00
|
|
|
#ifndef DIAGRAMCONTEXTWIDGET_H
|
|
|
|
#define DIAGRAMCONTEXTWIDGET_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include "diagramcontext.h"
|
|
|
|
class QLabel;
|
|
|
|
class QTableWidget;
|
|
|
|
/**
|
|
|
|
This class provides a table which enables end users to edit the key/value
|
|
|
|
pairs of a DiagamContext.
|
|
|
|
*/
|
|
|
|
class DiagramContextWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
// Constructor, destructor
|
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
DiagramContextWidget(QWidget *parent = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~DiagramContextWidget() override;
|
2012-07-01 21:54:00 +00:00
|
|
|
private:
|
|
|
|
DiagramContextWidget(const DiagramContextWidget &);
|
|
|
|
|
|
|
|
// methods
|
|
|
|
public:
|
|
|
|
bool isReadOnly();
|
|
|
|
DiagramContext context() const;
|
|
|
|
void setContext(const DiagramContext &);
|
|
|
|
int nameLessRowsCount() const;
|
2013-01-27 16:34:34 +00:00
|
|
|
void setSorting(bool enable, int column, Qt::SortOrder order );
|
2012-07-01 21:54:00 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setReadOnly(bool);
|
|
|
|
void clear();
|
|
|
|
int highlightNonAcceptableKeys();
|
|
|
|
void refreshFormatLabel();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void checkTableRows();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initWidgets();
|
|
|
|
void initLayout();
|
|
|
|
|
|
|
|
// attributes
|
|
|
|
private:
|
|
|
|
QLabel *format_label; ///< label used to detail keys format
|
|
|
|
QTableWidget *table_; ///< table used to enter key/value pairs
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|