X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FHYDROGUI%2FHYDROGUI_StricklerTableDlg.cxx;h=b09540c4008b37c3e03578b09ca31dd06bb4a589;hb=b8b330bd3b77a53aa65978028660880d7b32412f;hp=6c14e957b622ccf0a18bf9efc689452617cb6606;hpb=eb07ab762d97ebf47adea6d62a1d7fc15d1673e3;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx index 6c14e957..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() ) { @@ -161,18 +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->horizontalHeader()->setMinimumSectionSize( 50 ); - - 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 @@ -250,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; @@ -278,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() ); @@ -321,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();