1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_PRIORITYWIDGET_H
20 #define HYDROGUI_PRIORITYWIDGET_H
24 #include <HYDROData_Entity.h>
25 #include <HYDROData_PriorityQueue.h>
27 #include <QStyledItemDelegate>
34 * \class HYDROGUI_PriorityWidget
35 * \brief The class representing widget for tuning of the objects priorities and bathymetry conflicts
37 * The widget represents a table and a set of buttons (add and remove)
38 * providing the possibility to define priority rules.
40 class HYDRO_EXPORT HYDROGUI_PriorityWidget : public QWidget
47 HYDROGUI_PriorityWidget( QWidget* theParent );
48 virtual ~HYDROGUI_PriorityWidget();
50 void setObjects( const QList<Handle(HYDROData_Entity)>& theObjects );
52 HYDROData_ListOfRules getRules() const;
53 void setRules( const HYDROData_ListOfRules& theRules );
55 QTableView* getTable() const;
57 void undoLastChange();
60 void updateControls();
70 void onSelectionChanged();
72 void onShowError( const QString& theMsg );
75 QTableView* myTable; ///< the table view
76 QToolButton* myAdd; ///< the add rule button
77 QToolButton* myRemove; ///< the remove rule button
78 QToolButton* myClear; ///< the clear all rules button
82 * \class HYDROGUI_PriorityWidget::Delegate
83 * \brief The class representing custom item delegate (combobox)
85 class HYDROGUI_PriorityWidget::Delegate : public QStyledItemDelegate
90 Delegate( QObject* theParent = 0 );
92 QWidget* createEditor( QWidget*, const QStyleOptionViewItem&,
93 const QModelIndex& ) const;
95 void setEditorData( QWidget*, const QModelIndex& ) const;
96 void setModelData( QWidget*, QAbstractItemModel*, const QModelIndex& ) const;