createPopupMenu( menu );
}
+/*!
+ \brief Set 'auto-size first column' flag value.
+
+ If this flag is set to \c true (by default), the first column width is resized
+ to its contents.
+
+ \param on 'auto-size first column' flag value
+ \sa setAutoSizeColumns()
+*/
+void SUIT_DataBrowser::setAutoSizeFirstColumn( const bool on )
+{
+ myAutoSizeFirstColumn = on;
+}
+
+/*!
+ \brief Set 'auto-size columns' flag value.
+
+ If this flag is set to \c true (by default is false), columns width except
+ the first column is resized to its contents.
+
+ \param on 'auto-size columns' flag value
+ \sa setAutoSizeFirstColumn()
+*/
+void SUIT_DataBrowser::setAutoSizeColumns( const bool on )
+{
+ myAutoSizeColumns = on;
+}
+
/*!
\brief Process context menu request event.
\param e context menu event
setModel( m );
setItemDelegate( qobject_cast<SUIT_ProxyModel*>( model() )->delegate() );
- connect( treeView(), SIGNAL( sortingEnabled(bool ) ),
- model(), SLOT( setSortingEnabled( bool ) ) );
+ connect( treeView(), SIGNAL( sortingEnabled( bool ) ),
+ model(), SLOT( setSortingEnabled( bool ) ) );
+ connect( treeView(), SIGNAL( doubleClicked( const QModelIndex& ) ),
+ this, SLOT( onDblClicked( const QModelIndex& ) ) );
myShortcut = new QShortcut( Qt::Key_F5, this, SIGNAL( requestUpdate() ), SIGNAL( requestUpdate() ) );
myAutoSizeFirstColumn = true;
\sa updateKey(), setUpdateKey()
*/
+/*!
+ \fn void SUIT_DataBrowser::doubleClicked( SUIT_DataObject* o );
+ \brief This signal is emitted when a mouse button is double-clicked.
+ The data object the mouse was double-clicked on is specified by \a o.
+ The signal is only emitted when the object is valid.
+
+ \param o data object which is double-clicked
+*/
/*!
\brief Update internal modification time just after data model update
}
/*!
- \brief Set 'auto-size first column' flag value.
-
- If this flag is set to \c true (by default), the first column width is resized
- to its contents.
-
- \param on 'auto-size first column' flag value
- \sa setAutoSizeColumns()
+ \brief Called when item is double-clicked in the tree view
+ \internal
+
+ Emits signal doubleClicked( SUIT_DataObject* );
*/
-void SUIT_DataBrowser::setAutoSizeFirstColumn( const bool on )
+void SUIT_DataBrowser::onDblClicked( const QModelIndex& index )
{
- myAutoSizeFirstColumn = on;
-}
-
-/*!
- \brief Set 'auto-size columns' flag value.
-
- If this flag is set to \c true (by default is false), columns width except
- the first column is resized to its contents.
+ SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
- \param on 'auto-size columns' flag value
- \sa setAutoSizeFirstColumn()
-*/
-void SUIT_DataBrowser::setAutoSizeColumns( const bool on )
-{
- myAutoSizeColumns = on;
+ if ( m ) {
+ SUIT_DataObject* obj = m->object( index );
+ if ( obj ) emit( doubleClicked( obj ) );
+ }
}