2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 The QElectroTech Team
|
2009-04-03 19:30:25 +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/>.
|
|
|
|
*/
|
|
|
|
#ifndef DIAGRAMS_CHOOSER_H
|
|
|
|
#define DIAGRAMS_CHOOSER_H
|
2015-03-02 20:14:56 +00:00
|
|
|
#include <QtWidgets>
|
2009-04-03 19:30:25 +00:00
|
|
|
class QETProject;
|
|
|
|
class Diagram;
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a widget which allows users to select 0 to n diagrams
|
|
|
|
among those of a particular project.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
2010-01-10 20:22:52 +00:00
|
|
|
class DiagramsChooser : public QScrollArea {
|
2009-04-03 19:30:25 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
DiagramsChooser(QETProject *, QWidget * = nullptr);
|
2009-04-03 19:30:25 +00:00
|
|
|
virtual ~DiagramsChooser();
|
|
|
|
private:
|
|
|
|
DiagramsChooser(const DiagramsChooser &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
|
|
|
QETProject *project() const;
|
|
|
|
QList<Diagram *> selectedDiagrams() const;
|
|
|
|
QList<Diagram *> nonSelectedDiagrams() const;
|
|
|
|
bool diagramIsSelected(Diagram * const) const;
|
|
|
|
void setSelectedDiagrams(const QList<Diagram *> &, bool = true, bool = true);
|
|
|
|
void setSelectedAllDiagrams(bool = true);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void updateList();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void selectionChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void buildLayout();
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
|
|
|
QETProject *project_;
|
2010-01-10 20:22:52 +00:00
|
|
|
QWidget *widget0_;
|
2009-04-03 19:30:25 +00:00
|
|
|
QVBoxLayout *vlayout0_;
|
|
|
|
QHash<Diagram *, QCheckBox *> diagrams_;
|
|
|
|
};
|
|
|
|
#endif
|