void HYDROGUI_ColorDelegate::paint( QPainter* thePainter, const QStyleOptionViewItem& theOption,
const QModelIndex& theIndex ) const
{
- QColor aColor = qVariantValue<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
+ QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value<QColor>();
thePainter->fillRect( theOption.rect, aColor );
}
const QStyleOptionViewItem& theOption,
const QModelIndex& theIndex ) const
{
- QColor aColor = qVariantValue<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
+ QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value<QColor>();
QColor aNewColor = QColorDialog::getColor( aColor );
if( aNewColor.isValid() )
{
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 );
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( 15 );
-
- 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
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;
}
}
-void HYDROGUI_StricklerTableDlg::setGuiData( const Handle_HYDROData_StricklerTable& theTable )
+void HYDROGUI_StricklerTableDlg::setGuiData( const Handle(HYDROData_StricklerTable)& theTable )
{
myAttrName->setText( theTable->GetAttrName() );
myTable->setItem( aRow, 3, anItem );
}
- myTable->resizeColumnToContents( 0 );
+ //myTable->resizeColumnToContents( 0 );
myTable->resizeRowsToContents();
updateControls();