Salome HOME
projects
/
modules
/
hydro.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7
[modules/hydro.git]
/
src
/
HYDROGUI
/
HYDROGUI_PriorityWidget.cxx
diff --git
a/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
b/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
index 1545f6673c9b16355f2f9705b7c669292ac93e73..2f84a8229570b92dfa9bd6f83734042a80a5db6f 100644
(file)
--- a/
src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
+++ b/
src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
@@
-1,12
+1,8
@@
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015 EDF-R&D
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License
, or (at your option) any later version
.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-158,12
+154,12
@@
HYDROGUI_PriorityWidget::HYDROGUI_PriorityWidget( QWidget* theParent )
// Set resize mode
myTable->horizontalHeader()->setStretchLastSection( false);
// Set resize mode
myTable->horizontalHeader()->setStretchLastSection( false);
- myTable->horizontalHeader()->setResizeMode( 0, QHeaderView::Stretch );
- myTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents );
- myTable->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
- myTable->horizontalHeader()->setResizeMode( 3, QHeaderView::ResizeToContents );
+ myTable->horizontalHeader()->set
Section
ResizeMode( 0, QHeaderView::Stretch );
+ myTable->horizontalHeader()->set
Section
ResizeMode( 1, QHeaderView::ResizeToContents );
+ myTable->horizontalHeader()->set
Section
ResizeMode( 2, QHeaderView::Stretch );
+ myTable->horizontalHeader()->set
Section
ResizeMode( 3, QHeaderView::ResizeToContents );
- myTable->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
+ myTable->verticalHeader()->set
Section
ResizeMode( QHeaderView::ResizeToContents );
// Layout
// buttons
// Layout
// buttons
@@
-189,6
+185,7
@@
HYDROGUI_PriorityWidget::HYDROGUI_PriorityWidget( QWidget* theParent )
this, SLOT( onSelectionChanged() ) );
connect( aModel, SIGNAL( showError( const QString& ) ), this, SLOT( onShowError( const QString& ) ) );
this, SLOT( onSelectionChanged() ) );
connect( aModel, SIGNAL( showError( const QString& ) ), this, SLOT( onShowError( const QString& ) ) );
+ connect( aModel, SIGNAL( ruleChanged() ), this, SIGNAL( ruleChanged() ) );
}
/**
}
/**
@@
-208,6
+205,7
@@
void HYDROGUI_PriorityWidget::onAddRule()
if ( aModel ) {
if (aModel->createNewRule()) {
updateControls();
if ( aModel ) {
if (aModel->createNewRule()) {
updateControls();
+ emit ruleChanged();
}
}
}
}
}
}
@@
-223,13
+221,16
@@
void HYDROGUI_PriorityWidget::onRemoveRule()
if (aModel) {
QList<int> aRows;
if (aModel) {
QList<int> aRows;
- QModelIndexList aSelectedIndexes = myTable->selectionModel()->selected
Row
s();
+ QModelIndexList aSelectedIndexes = myTable->selectionModel()->selected
Indexe
s();
foreach ( const QModelIndex& anIndex, aSelectedIndexes ) {
foreach ( const QModelIndex& anIndex, aSelectedIndexes ) {
- aRows << anIndex.row();
+ int aRowIndex = anIndex.row();
+ if ( !aRows.contains( aRowIndex ) )
+ aRows << aRowIndex;
}
if ( aModel->removeRows( aRows ) ) {
updateControls();
}
if ( aModel->removeRows( aRows ) ) {
updateControls();
+ emit ruleChanged();
}
}
}
}
}
}
@@
-243,6
+244,7
@@
void HYDROGUI_PriorityWidget::onClearRules()
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if ( aModel && aModel->removeAll() ) {
updateControls();
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
if ( aModel && aModel->removeAll() ) {
updateControls();
+ emit ruleChanged();
}
}
}
}
@@
-250,7
+252,7
@@
void HYDROGUI_PriorityWidget::onClearRules()
Set objects which could be used for rules definition.
@param theObjects the ordered list of objects
*/
Set objects which could be used for rules definition.
@param theObjects the ordered list of objects
*/
-void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_
Object
)>& theObjects )
+void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_
Entity
)>& theObjects )
{
HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
{
HYDROGUI_PriorityTableModel* aModel =
dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
@@
-291,12
+293,21
@@
void HYDROGUI_PriorityWidget::setRules( const HYDROData_ListOfRules& theRules )
}
}
}
}
+/**
+ Get table view.
+ @return the table view
+ */
+QTableView* HYDROGUI_PriorityWidget::getTable() const
+{
+ return myTable;
+}
+
/**
Slot called on table selection change.
*/
void HYDROGUI_PriorityWidget::onSelectionChanged()
{
/**
Slot called on table selection change.
*/
void HYDROGUI_PriorityWidget::onSelectionChanged()
{
- QModelIndexList aSelectedIndexes = myTable->selectionModel()->selected
Row
s();
+ QModelIndexList aSelectedIndexes = myTable->selectionModel()->selected
Indexe
s();
myRemove->setEnabled( aSelectedIndexes.count() > 0 );
}
myRemove->setEnabled( aSelectedIndexes.count() > 0 );
}
@@
-320,4
+331,15
@@
void HYDROGUI_PriorityWidget::updateControls()
*/
void HYDROGUI_PriorityWidget::onShowError( const QString& theMsg ) {
SUIT_MessageBox::warning( this, tr( "INCORRECT_INPUT" ), theMsg );
*/
void HYDROGUI_PriorityWidget::onShowError( const QString& theMsg ) {
SUIT_MessageBox::warning( this, tr( "INCORRECT_INPUT" ), theMsg );
-}
\ No newline at end of file
+}
+
+/**
+ Undo last change in priority rules table.
+ */
+void HYDROGUI_PriorityWidget::undoLastChange()
+{
+ HYDROGUI_PriorityTableModel* aModel =
+ dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
+ if ( aModel )
+ aModel->undoLastChange();
+}