"ObjectBrowser", "auto_size_first" );
pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool,
"ObjectBrowser", "auto_size" );
+ pref->addPreference( tr( "PREF_RESIZE_ON_EXPAND_ITEM" ), objSetGroup, LightApp_Preferences::Bool,
+ "ObjectBrowser", "resize_on_expand_item" );
// theme values
Style_Model* aSModel = 0;
if( sec=="ObjectBrowser" )
{
- if( param=="auto_size" || param=="auto_size_first" )
- {
- SUIT_DataBrowser* ob = objectBrowser();
- if( !ob )
- return;
+ SUIT_DataBrowser* ob = objectBrowser();
+ if( !ob )
+ return;
- bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ),
- autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
-
+ if ( param=="auto_size_first" ) {
+ bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
ob->setAutoSizeFirstColumn(autoSizeFirst);
- ob->setAutoSizeColumns(autoSize);
-
if ( autoSizeFirst )
ob->adjustFirstColumnWidth();
+ }
+ else if( param=="auto_size" ) {
+ bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
+ ob->setAutoSizeColumns(autoSize);
if ( autoSize )
ob->adjustColumnsWidth();
}
- else if ( param == "auto_hide_search_tool" )
- {
- objectBrowser()->searchTool()->enableAutoHide( resMgr->booleanValue( "ObjectBrowser", "auto_hide_search_tool" ) );
+ else if ( param=="resize_on_expand_item" ) {
+ bool resizeOnExpandItem = resMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false );
+ ob->setResizeOnExpandItem(resizeOnExpandItem);
+ }
+ else if ( param == "auto_hide_search_tool" ) {
+ ob->searchTool()->enableAutoHide( resMgr->booleanValue( "ObjectBrowser", "auto_hide_search_tool" ) );
}
}
<source>PREF_AUTO_SIZE_FIRST</source>
<translation>Auto size for first column</translation>
</message>
+ <message>
+ <source>PREF_RESIZE_ON_EXPAND_ITEM</source>
+ <translation>Resize columns after expanding an item</translation>
+ </message>
<message>
<source>PREF_GROUP_SUPERV</source>
<translation>Graph Supervisor</translation>
contextMenuRequest( e );
}
+/*!
+ \brief Set 'resize on expand item' flag value.
+
+ If this flag is set to \c true (by default is false), after
+ expanding an item columns will be resized to its contents.
+
+ \param on 'resize on expand item' flag value
+*/
+void SUIT_DataBrowser::setResizeOnExpandItem( const bool on )
+{
+ myResizeOnExpandItem = on;
+}
+
/*!
\brief Initialize object browser.
\param root root data object
model(), SLOT( setSortingEnabled( bool ) ) );
connect( treeView(), SIGNAL( doubleClicked( const QModelIndex& ) ),
this, SLOT( onDblClicked( const QModelIndex& ) ) );
+ connect( treeView(), SIGNAL( expanded( const QModelIndex& ) ),
+ this, SLOT( onExpanded( const QModelIndex& ) ) );
myShortcut = new QShortcut( Qt::Key_F5, this, SIGNAL( requestUpdate() ), SIGNAL( requestUpdate() ) );
myAutoSizeFirstColumn = true;
myAutoSizeColumns = false;
+ myResizeOnExpandItem = false;
}
/*!
if ( obj ) emit( doubleClicked( obj ) );
}
}
+
+/*!
+ \brief Called when item specified by index is expanded.
+ \internal
+*/
+void SUIT_DataBrowser::onExpanded( const QModelIndex& index )
+{
+ if (myResizeOnExpandItem) {
+ adjustFirstColumnWidth();
+ adjustColumnsWidth();
+ }
+}
+
void setAutoSizeFirstColumn( const bool on );
void setAutoSizeColumns( const bool on );
+ void setResizeOnExpandItem( const bool on );
protected:
virtual void contextMenuEvent( QContextMenuEvent* );
private slots:
void onModelUpdated();
void onDblClicked( const QModelIndex& );
+ void onExpanded( const QModelIndex& );
private:
QShortcut* myShortcut;
bool myAutoSizeFirstColumn;
bool myAutoSizeColumns;
+ bool myResizeOnExpandItem;
};
#endif // SUIT_BROWSER_H
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
+ bool resizeOnExpandItem = resMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", true );
ob->setAutoSizeFirstColumn(autoSizeFirst);
ob->setAutoSizeColumns(autoSize);
+ ob->setResizeOnExpandItem(resizeOnExpandItem);
// temporary commented
/*