X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_StricklerTableDlg.cxx;h=4282490f65b55dd5dfe3d92d7287b3f883ddfca4;hb=d6bfe7c45ecf0dc6ed9819a40ce28b73b49d9592;hp=85897ffeea60ec70554f3043e3d47c603061ce26;hpb=3794ebe1a6e6574238912e725efce8eacca89ff9;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx index 85897ffe..4282490f 100644 --- a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx @@ -16,29 +16,24 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "HYDROGUI_StricklerTableDlg.h" - -#include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" -#include "HYDROGUI_LineEditDoubleValidator.h" -#include "HYDROData_StricklerTable.h" - -#include - -#include -#include +#include +#include +#include +#include #include -#include -#include - +#ifndef LIGHT_MODE +#include +#include +#endif +#include +#include #include -#include -#include -#include +#include #include +#include +#include #include -#include -#include +#include HYDROGUI_ColorDelegate::HYDROGUI_ColorDelegate( QWidget* theParent ) { @@ -86,13 +81,13 @@ QSize HYDROGUI_ColorDelegate::sizeHint( const QStyleOptionViewItem& theOption, c +const int COLUMNS_COUNT = 4; + HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle, int theType ) : HYDROGUI_InputPanel( theModule, theTitle ), myType( theType ) { - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QString fileGroupTitle = theType == Export ? tr( "EXPORT_STRICKLER_TABLE_FILE" ) : tr( "IMPORT_STRICKLER_TABLE_FILE" ); // Import Strickler table from file @@ -105,7 +100,10 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu myFileName->setReadOnly( true ); QToolButton* aBrowseBtn = new QToolButton( aFileNameGroup ); +#ifndef LIGHT_MODE + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) ); +#endif QBoxLayout* aFileNameLayout = new QHBoxLayout( aFileNameGroup ); aFileNameLayout->setMargin( 5 ); @@ -161,7 +159,7 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu QAbstractItemView::SelectedClicked | QAbstractItemView::EditKeyPressed ); - myTable->setColumnCount( 4 ); + myTable->setColumnCount( COLUMNS_COUNT ); QStringList aColumnNames; aColumnNames << tr( "STRICKLER_TYPE" ) << tr( "STRICKLER_COEFFICIENT" ) << tr( "ATTR_VALUE" ) << tr( "COLOR" ); myTable->setHorizontalHeaderLabels( aColumnNames ); @@ -171,6 +169,7 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu myTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents ); myTable->horizontalHeader()->setResizeMode( 2, QHeaderView::ResizeToContents ); myTable->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch ); + myTable->horizontalHeader()->setMinimumSectionSize( 15 ); myTable->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); @@ -371,6 +370,11 @@ void HYDROGUI_StricklerTableDlg::onAddCoefficient() int aRow = myTable->rowCount(); myTable->insertRow( aRow ); + for( int i=0; isetItem( aRow, i, new QTableWidgetItem() ); + } + // Set default type (=> generate unique type name) and coefficient //... @@ -383,9 +387,11 @@ Remove the selected Strickler coefficient. void HYDROGUI_StricklerTableDlg::onRemoveCoefficient() { QList aRows; - QModelIndexList aSelectedIndexes = myTable->selectionModel()->selectedRows(); + QModelIndexList aSelectedIndexes = myTable->selectionModel()->selectedIndexes(); foreach ( const QModelIndex& anIndex, aSelectedIndexes ) { - aRows << anIndex.row(); + int aRowIndex = anIndex.row(); + if ( !aRows.contains( aRowIndex ) ) + aRows << aRowIndex; } removeRows( aRows ); @@ -409,6 +415,6 @@ Slot called on table selection change. */ void HYDROGUI_StricklerTableDlg::onSelectionChanged() { - QModelIndexList aSelectedIndexes = myTable->selectionModel()->selectedRows(); + QModelIndexList aSelectedIndexes = myTable->selectionModel()->selectedIndexes(); myRemoveBtn->setEnabled( aSelectedIndexes.count() > 0 ); }