X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_StricklerTableDlg.cxx;h=b09540c4008b37c3e03578b09ca31dd06bb4a589;hb=445cca2de7e4814cdc8d6cb7727b5bf2e3170220;hp=4de59f35df93721f32e43156d1f5c515b8bd305a;hpb=f993e4d01e9bb9de221db4c90d7a6c617696f3ec;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx index 4de59f35..b09540c4 100644 --- a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx @@ -46,7 +46,7 @@ HYDROGUI_ColorDelegate::~HYDROGUI_ColorDelegate() void HYDROGUI_ColorDelegate::paint( QPainter* thePainter, const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const { - QColor aColor = qVariantValue( theIndex.data( Qt::BackgroundColorRole ) ); + QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value(); thePainter->fillRect( theOption.rect, aColor ); } @@ -54,7 +54,7 @@ QWidget* HYDROGUI_ColorDelegate::createEditor( QWidget* theParent, const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const { - QColor aColor = qVariantValue( theIndex.data( Qt::BackgroundColorRole ) ); + QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value(); QColor aNewColor = QColorDialog::getColor( aColor ); if( aNewColor.isValid() ) { @@ -119,6 +119,7 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu myName = new QLineEdit( aNameGroup ); QGroupBox* aAttrNameGroup = new QGroupBox( tr( "STRICKLER_TABLE_ATTR_NAME" ), this ); + aAttrNameGroup->setVisible( theType == Edit ); QLabel* aAttrNameLabel = new QLabel( tr( "ATTR_NAME" ), aAttrNameGroup ); myAttrName = new QLineEdit( aAttrNameGroup ); @@ -160,17 +161,24 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu QAbstractItemView::EditKeyPressed ); myTable->setColumnCount( COLUMNS_COUNT ); + QStringList aColumnNames; aColumnNames << tr( "STRICKLER_TYPE" ) << tr( "STRICKLER_COEFFICIENT" ) << tr( "ATTR_VALUE" ) << tr( "COLOR" ); myTable->setHorizontalHeaderLabels( aColumnNames ); myTable->horizontalHeader()->setStretchLastSection( false ); - myTable->horizontalHeader()->setResizeMode( 0, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 2, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch ); - - myTable->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); + myTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Interactive ); + myTable->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Interactive ); + myTable->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Interactive ); + myTable->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Interactive ); + myTable->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ); + + const int default_size = 50; + myTable->horizontalHeader()->setMinimumSectionSize( default_size ); + myTable->horizontalHeader()->resizeSection( 0, 300 ); + myTable->horizontalHeader()->resizeSection( 1, 75 ); + myTable->horizontalHeader()->resizeSection( 2, 75 ); + myTable->horizontalHeader()->resizeSection( 3, 75 ); // Layout // buttons @@ -248,7 +256,7 @@ void HYDROGUI_StricklerTableDlg::setTableNameReadOnly( bool on ) myName->setReadOnly( on ); } -void HYDROGUI_StricklerTableDlg::getGuiData( Handle_HYDROData_StricklerTable& theTable ) const +void HYDROGUI_StricklerTableDlg::getGuiData( Handle(HYDROData_StricklerTable)& theTable ) const { if( theTable.IsNull() ) return; @@ -276,7 +284,7 @@ void HYDROGUI_StricklerTableDlg::getGuiData( Handle_HYDROData_StricklerTable& th } } -void HYDROGUI_StricklerTableDlg::setGuiData( const Handle_HYDROData_StricklerTable& theTable ) +void HYDROGUI_StricklerTableDlg::setGuiData( const Handle(HYDROData_StricklerTable)& theTable ) { myAttrName->setText( theTable->GetAttrName() ); @@ -319,7 +327,7 @@ void HYDROGUI_StricklerTableDlg::setGuiData( const Handle_HYDROData_StricklerTab myTable->setItem( aRow, 3, anItem ); } - myTable->resizeColumnToContents( 0 ); + //myTable->resizeColumnToContents( 0 ); myTable->resizeRowsToContents(); updateControls();