#include <SUIT_TreeModel.h>
#include <QtxTreeView.h>
+#include <QTimer>
#include <QShortcut>
#include <QModelIndex>
\param parent parent widget
*/
SUIT_DataBrowser::SUIT_DataBrowser( SUIT_DataObject* root, QWidget* parent )
-: OB_Browser( parent )
+ : OB_Browser( parent )
{
init( root );
+
+ myExpandTimer = new QTimer( this );
+ connect( myExpandTimer, SIGNAL( timeout() ), this, SLOT( onExpandUpdate() ) );
}
/*!
*/
void SUIT_DataBrowser::onExpanded( const QModelIndex& index )
{
- if (myResizeOnExpandItem) {
- adjustFirstColumnWidth();
- adjustColumnsWidth();
- }
+ if ( myResizeOnExpandItem )
+ triggerExpandUpdate();
+}
+
+/*!
+ \brief Set the delayed update for expanding items event.
+ \internal
+*/
+void SUIT_DataBrowser::triggerExpandUpdate()
+{
+ myExpandTimer->stop();
+ myExpandTimer->start( 0 );
}
+/*!
+ \brief Update for expanding items event. Called after the required items were expanded.
+ \internal
+*/
+void SUIT_DataBrowser::onExpandUpdate()
+{
+ adjustFirstColumnWidth();
+ adjustColumnsWidth();
+}
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::disconnect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
delete myRoot;
}
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::disconnect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
delete myRoot;
}
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::disconnect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
+
myAutoUpdate = on;
if ( myAutoUpdate ) {
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::connect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
if ( updateImmediately )
updateTree();
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::disconnect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
if ( autoUpdate() ) {
SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ SUIT_DataObject::connect( SIGNAL( changed( SUIT_DataObject* ) ), this, SLOT( onChanged( SUIT_DataObject* ) ) );
}
myItems.clear(); // ????? is it really necessary