Fixing problems with struct viewer and making it fit to content

parent 78d3dde7
......@@ -33,32 +33,44 @@ public:
{
m_pModel = new RedstartSessionDetailModel();
this->setModel( m_pModel );
m_pModel->setHorizontalHeaderLabels( QStringList() << "Key" << "Value" << "Type" );
SetDefaults();
//setEditTriggers( QAbstractItemView::NoEditTriggers );
//setSelectionMode( QAbstractItemView::SingleSelection );
};
inline void SetDefaults()
{
m_pModel->setHorizontalHeaderLabels( QStringList() << "Key" << "Value" << "Type" );
resizeColumnToContents( 1 );
};
void SetStruct( const CVAStruct& oStruct )
{
m_pModel->clear();
SetDefaults();
BuildStandardItemFromVAStruct( oStruct, m_pModel->invisibleRootItem() );
expandAll();
resizeColumnToContents( 0 );
resizeColumnToContents( 1 );
resizeColumnToContents( 2 );
return;
CVAStruct oMyStruct;
oMyStruct[ "hi" ] = "wo!?!";
/*rootNode->appendRow( BuildStandardItemFromVAStruct( oMyStruct ) );
//rootNode->appendRow( BuildStandardItemFromVAStruct( oMyStruct ) );
//return;
QList<QStandardItem *> qlDescriptors;
qlDescriptors << new QStandardItem( "Name" );
qlDescriptors << new QStandardItem( "Talkthrough" );
qlDescriptors << new QStandardItem( "String" );
rootNode->appendRow( qlDescriptors );
m_pModel->invisibleRootItem()->appendRow( qlDescriptors );
QList<QStandardItem *> qlDescriptor2;
qlDescriptor2 << new QStandardItem( "weiteres" );
rootNode->appendRow( qlDescriptor2 );
m_pModel->invisibleRootItem()->appendRow( qlDescriptor2 );
QList<QStandardItem *> qlDescriptor3;
qlDescriptor3 << new QStandardItem( "direction" );
......@@ -76,7 +88,7 @@ public:
qlDescriptor3.first()->appendRow( qlDescriptor4 );
qlDescriptor3.first()->appendRow( qlDescriptor5 );
*/
};
inline ~RedstartSessionDetailsTreeView() {};
......
......@@ -25,7 +25,6 @@
*/
inline void BuildStandardItemFromVAStruct( const CVAStruct& oStruct, QStandardItem* pRootNode )
{
CVAStruct::const_iterator cit = oStruct.Begin();
while( cit != oStruct.End() )
{
......@@ -71,6 +70,7 @@ inline void BuildStandardItemFromVAStruct( const CVAStruct& oStruct, QStandardIt
case CVAStructValue::STRUCT:
{
BuildStandardItemFromVAStruct( oValue, pItemList.first() );
break;
}
}
......
......@@ -72,10 +72,10 @@
<x>0</x>
<y>0</y>
<width>1029</width>
<height>666</height>
<height>660</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0,1">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="1,0,0,0,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_redstart_session" stretch="1,2">
<item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment