ok thanks, abobe codes works well for me.
But, this code works only with setModel( autoCreateColumn = false )
If i use setMode( autoCreateColumn = true ), below screenshot was results.
void CManageUnapproveSWModel::createColumns()
{
if( m_view == NULLPTR )
return;
Qtitan::GridBandedTableView* spView = qobject_cast<Qtitan::GridBandedTableView*>(m_view);
spView->beginUpdate();
Qtitan::GridTableBand* selectBand = spView->addBand( "Band Select" ); //Band index 0
Qtitan::GridTableBand* iconBand = spView->addBand( "Band Icon" ); //Band index 1
Qtitan::GridTableBand* nameBand = spView->addBand( "Band Name" ); //Band index 2
Qtitan::GridTableBand* dateBand = spView->addBand( "Band Date" ); //Band index 3
Qtitan::GridTableBand* msicBand = spView->addBand( "Band Misc" ); //Band index 4
Qtitan::GridBandedTableColumn* column0 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_SELECT );
column0->setBandIndex( selectBand->index() /* index is 0 */ );
column0->setRowSpan( 3 );
Qtitan::GridBandedTableColumn* column1 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_ICON );
column1->setBandIndex( iconBand->index() /* index is 1 */ );
column1->setRowSpan( 3 );
Qtitan::GridBandedTableColumn* column2 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_FILENAME );
column2->setBandIndex( nameBand->index() /* index is 2 */ );
column2->setRowIndex( 0 );
Qtitan::GridBandedTableColumn* column3 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_COMPANYNAME );
column3->setBandIndex( nameBand->index() /* index is 2 */ );
column3->setRowIndex( 1 );
Qtitan::GridBandedTableColumn* column4 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_PRODUCTNAME );
column4->setBandIndex( nameBand->index() /* index is 2 */ );
column4->setRowIndex( 2 );
Qtitan::GridBandedTableColumn* column5 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_APPROVESTAT );
column5->setBandIndex( dateBand->index() /* index is 3 */ );
column5->setRowIndex( 0 );
Qtitan::GridBandedTableColumn* column6 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_REQUESTDATE );
column6->setBandIndex( dateBand->index() /* index is 3 */ );
column6->setRowIndex( 1 );
Qtitan::GridBandedTableColumn* column7 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_RESPONSEDATE );
column7->setBandIndex( dateBand->index() /* index is 3 */ );
column7->setRowIndex( 2 );
Qtitan::GridBandedTableColumn* column8 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_BLOCKCOUNT );
column8->setBandIndex( msicBand->index() /* index is 4 */ );
column8->setRowIndex( 0 );
column8->setRowSpan( 2 );
Qtitan::GridBandedTableColumn* column9 = (Qtitan::GridBandedTableColumn *)spView->getColumnByCaption( TBL_AML_HDX_LASTBLOCKDATE );
column9->setBandIndex( msicBand->index() /* index is 4 */ );
column9->setRowIndex( 1 );
spView->endUpdate();
}
QVariant CManageUnapproveSWModel::headerData( int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole */ ) const
{
QVariant vtHeaderData;
do
{
if( orientation != Qt::Horizontal )
break;
if( role != Qt::DisplayRole )
break;
switch( section )
{
// ?? ??? ?? ?? ??
case 0:
vtHeaderData = TBL_AML_HDX_SELECT;
break;
case 1:
vtHeaderData = TBL_AML_HDX_ICON;
break;
case 2:
vtHeaderData = TBL_AML_HDX_FILENAME;
break;
case 3:
vtHeaderData = TBL_AML_HDX_COMPANYNAME;
break;
case 4:
vtHeaderData = TBL_AML_HDX_PRODUCTNAME;
break;
case 5:
vtHeaderData = TBL_AML_HDX_APPROVESTAT;
break;
case 6:
vtHeaderData = TBL_AML_HDX_REQUESTDATE;
break;
case 7:
vtHeaderData = TBL_AML_HDX_RESPONSEDATE;
break;
case 8:
vtHeaderData = TBL_AML_HDX_BLOCKCOUNT;
break;
case 9:
vtHeaderData = TBL_AML_HDX_LASTBLOCKDATE;
break;
}
} while (false);
return vtHeaderData;
}
CManageUnapproveSWUI::CManageUnapproveSWUI( QWidget* parent /*= 0 */ )
: QDialog( parent, Qt::FramelessWindowHint )
{
ui.setupUi( this );
// std::wstring xmlFile = nsCommon::nsCmnFormatter::tsFormat( L"%1\\%2", nsCommon::nsCmnPath::GetCurrentPath(), SVC_CONFIG_NAME );
//
// if( PathFileExistsW( xmlFile.c_str() ) != FALSE )
// _customSQLModel.init( CU2U8(xmlFile).c_str(), "//tblAmalgamationItem/column", "TBL_AMALGAMATION_LOG" );
// else
// {
// xmlFile = nsCommon::nsCmnFormatter::tsFormat( L"%1\\%2.sample", nsCommon::nsCmnPath::GetCurrentPath(), SVC_CONFIG_NAME );
// if( PathFileExistsW( xmlFile.c_str() ) != FALSE )
// _customSQLModel.init( CU2U8( xmlFile ).c_str(), "//tblAmalgamationItem/column", "TBL_AMALGAMATION_LOG" );
// }
ui.tblUnapproveSW->setViewType( Qtitan::Grid::BandedTableView );
auto tblAmalgamation = ui.tblUnapproveSW->view< Qtitan::GridBandedTableView >();
auto& tblOptions = tblAmalgamation->options();
tblOptions.setGroupsHeader( false );
tblOptions.setBandsHeader( false );
tblOptions.setColumnAutoWidth( true );
tblOptions.setRowAutoHeight( true );
_amalgamationItemModel.init( tblAmalgamation );
tblAmalgamation->setModel( &_amalgamationItemModel, QModelIndex(), true );
_amalgamationItemModel.createColumns();
}