#include <time.h>
/*!
- Class: OB_Browser::ToolTip
- Descr: Tool tip for OB_Browser.
+ \class OB_Browser::ToolTip
+ Tool tip for OB_Browser.
*/
class OB_Browser::ToolTip : public QToolTip
OB_Browser* myBrowser;
};
+/*!
+ Constructor
+*/
OB_Browser::ToolTip::ToolTip( OB_Browser* b, QWidget* p )
: QToolTip( p ),
myBrowser( b )
{
}
+/*!
+ Destructor
+*/
OB_Browser::ToolTip::~ToolTip()
{
}
+/*!
+ It is called when there is a possibility that a tool tip
+ should be shown and must decide whether there is a tool tip for the point
+ in the widget that this QToolTip object relates to.
+ \param pos - point co-ordinates
+*/
void OB_Browser::ToolTip::maybeTip( const QPoint& pos )
{
if ( !parentWidget() || !myBrowser || !myBrowser->isShowToolTips() )
typedef SUIT_DataObject* ObjPtr;
typedef OB_ListItem* ItemPtr;
+
/*!
- Class: OB_BrowserSync
- Descr: Auxiliary class for synchronizing tree of SUIT_DataObjects and list view items
+ \class OB_BrowserSync
+ Auxiliary class for synchronizing tree of SUIT_DataObjects and list view items
*/
-
class OB_BrowserSync
{
public:
};
+/*!
+ Constructor
+*/
OB_BrowserSync::OB_BrowserSync( OB_Browser* ob )
: myBrowser( ob )
{
}
+/*!
+ \return true if item must be updated
+ \param item - item to be checked
+*/
bool OB_BrowserSync::needUpdate( const ItemPtr& item ) const
{
bool update = false;
return update;
}
+/*!
+ Updates item
+ \param p - item
+*/
void OB_BrowserSync::updateItem( const ItemPtr& p ) const
{
if ( p && needUpdate( p ) ) {
}
}
+/*!
+ Creates item by SUIT object
+ \param src - corresponding SUIT object
+ \param parent - parent for item
+ \param after - previous sibling for item
+ \param prepend - item must be added to start of children list
+*/
ItemPtr OB_BrowserSync::createItem( const ObjPtr& src,
const ItemPtr& parent, const ItemPtr& after,
const bool prepend ) const
return i;
}
+/*!
+ Deletes object with all children
+ \param i - item
+*/
void OB_BrowserSync::deleteItemWithChildren( const ItemPtr& i ) const
{
if( myBrowser && myBrowser->myItems.contains( i->dataObject() ) )
}
}
+/*!
+ \return true if objects correspond each other at all
+ \param p - suit object
+ \param q - object browser item
+*/
bool OB_BrowserSync::isEqual( const ObjPtr& p, const ItemPtr& q ) const
{
bool isRoot = p==myBrowser->getRootObject() && !q,
return isRoot || ( !p && !q ) || isEq;
}
+/*!
+ \return null suit object
+*/
ObjPtr OB_BrowserSync::nullSrc() const
{
return 0;
}
+/*!
+ \return null item
+*/
ItemPtr OB_BrowserSync::nullTrg() const
{
return 0;
}
+/*!
+ Fills list with children of SUIT object
+ \param p - SUIT object
+ \param ch - list to be filled
+*/
void OB_BrowserSync::children( const ObjPtr& p, QValueList<ObjPtr>& ch ) const
{
DataObjectList l;
}
}
+/*!
+ Fills list with children of item
+ \param p - item
+ \param ch - list to be filled
+*/
void OB_BrowserSync::children( const ItemPtr& p, QValueList<ItemPtr>& ch ) const
{
for( QListViewItem* item = p ? p->firstChild() : myBrowser->listView()->firstChild(); item; item = item->nextSibling() )
}
}
+/*!
+ \return parent of item
+ \param p - item
+*/
ItemPtr OB_BrowserSync::parent( const ItemPtr& p ) const
{
return p ? dynamic_cast<ItemPtr>( p->parent() ) : 0;
/*!
- Class: OB_Browser
- Descr: Hierarchical tree object browser.
+ Constructor
*/
-
OB_Browser::OB_Browser( QWidget* parent, SUIT_DataObject* root )
: QFrame( parent ),
setModified();
}
+/*!
+ Destructor
+*/
OB_Browser::~OB_Browser()
{
myItems.clear();
delete myTooltip;
}
+/*!
+ \return true if root is decorated by +
+*/
bool OB_Browser::rootIsDecorated() const
{
return myRootDecorated;
}
+/*!
+ Sets state "root is recorated"
+ \param decor - new value of state
+*/
void OB_Browser::setRootIsDecorated( const bool decor )
{
if ( decor == rootIsDecorated() )
updateTree( 0, false );
}
+/*!
+ \return number of levels to be auto opened on update tree
+*/
int OB_Browser::autoOpenLevel() const
{
return myAutoOpenLevel;
}
+/*!
+ Changes number of levels to be auto opened on update tree
+ \param level - new number of levels
+*/
void OB_Browser::setAutoOpenLevel( const int level )
{
if ( myAutoOpenLevel == level )
autoOpenBranches();
}
+/*!
+ \return state "are tooltips shown"
+*/
bool OB_Browser::isShowToolTips()
{
return myShowToolTips;
}
+/*!
+ Sets new value of state "are tooltips shown"
+ \param theDisplay - new value
+*/
void OB_Browser::setShowToolTips( const bool theDisplay )
{
myShowToolTips = theDisplay;
}
+/*!
+ \return true if object browser automatically updates tree after SUIT object removing
+*/
bool OB_Browser::isAutoUpdate() const
{
return myAutoUpdate;
}
+/*!
+ Sets new value of "auto update": whether object browser automatically updates tree after SUIT object removing
+*/
void OB_Browser::setAutoUpdate( const bool on )
{
myAutoUpdate = on;
}
+/*!
+ \return true if object browser must delete old tree on setRootObject(), replaceTree()
+ \sa setRootObject(), replaceTree()
+*/
bool OB_Browser::isAutoDeleteObjects() const
{
return myAutoDelObjs;
}
+/*!
+ Sets whether object browser must delete old tree on setRootObject(), replaceTree()
+ \sa setRootObject(), replaceTree()
+*/
void OB_Browser::setAutoDeleteObjects( const bool on )
{
myAutoDelObjs = on;
}
+/*!
+ \return root SUIT object of browser
+*/
SUIT_DataObject* OB_Browser::getRootObject() const
{
return myRoot;
}
+/*!
+ Sets new root SUIT object of browser
+ \param theRoot - new root object
+*/
void OB_Browser::setRootObject( SUIT_DataObject* theRoot )
{
DataObjectKey curKey;
emit selectionChanged();
}
+/*!
+ \return number of selected items
+*/
int OB_Browser::numberOfSelected() const
{
int count = 0;
return count;
}
+/*!
+ \return list of selected objects
+*/
DataObjectList OB_Browser::getSelected() const
{
DataObjectList lst;
return lst;
}
+/*!
+ Fills list with selected objects
+*/
void OB_Browser::getSelected( DataObjectList& theObjList ) const
{
theObjList.clear();
}
}
+/*!
+ Sets selected object
+ \param theObject - new selected object
+ \param append - if it is true, then other selected objects are left as selected,
+ otherwise only 'theObject' will be selected
+*/
void OB_Browser::setSelected( const SUIT_DataObject* theObject, const bool append )
{
DataObjectList lst;
setSelected( lst, append );
}
+/*!
+ Sets selected objects
+ \param theObjLst - new selected objects
+ \param append - if it is true, then other selected objects are left as selected,
+ otherwise only 'theObjLst' will be selected
+*/
void OB_Browser::setSelected( const DataObjectList& theObjLst, const bool append )
{
QListView* lv = listView();
}
}
+/*!
+ \return true if item corresponding to object is opened
+ \param theObject - object to be checked
+*/
bool OB_Browser::isOpen( SUIT_DataObject* theObject ) const
{
bool res = false;
return res;
}
+/*!
+ Sets opened state of item
+ \param theObject - object corresponding to item
+ \param theOpen - new opened state
+*/
void OB_Browser::setOpen( SUIT_DataObject* theObject, const bool theOpen )
{
if ( listView() )
listView()->setOpen( listViewItem( theObject ), theOpen );
}
+/*!
+ \return SUIT object correspondint to item at position 'pos'
+ \param pos - position
+*/
SUIT_DataObject* OB_Browser::dataObjectAt( const QPoint& pos ) const
{
SUIT_DataObject* obj = 0;
return obj;
}
+/*!
+ \return filter of list view
+*/
OB_Filter* OB_Browser::filter() const
{
return myView->filter();
}
+/*!
+ Changes filter of list view
+ \param f - new filter
+*/
void OB_Browser::setFilter( OB_Filter* f )
{
myView->setFilter( f );
}
+/*!
+ Adds new column to list view
+ \param label - title of column
+ \param id - id of column
+ \param width - width of column
+*/
int OB_Browser::addColumn( const QString& label, const int id, const int width )
{
return addColumn( QIconSet(), label, id, width );
}
+/*!
+ Adds new column to list view
+ \param icon - icon of column
+ \param label - title of column
+ \param id - id of column
+ \param width - width of column
+*/
int OB_Browser::addColumn( const QIconSet& icon, const QString& label, const int id, const int width )
{
QListView* lv = listView();
return theId;
}
+/*!
+ Removes column
+ \param id - id of column
+*/
void OB_Browser::removeColumn( const int id )
{
QListView* lv = listView();
updateText();
}
+/*!
+ Sets title of first column (name column)
+ \param label - new title
+*/
void OB_Browser::setNameTitle( const QString& label )
{
setNameTitle( QIconSet(), label );
}
+/*!
+ Sets title and icon of first column (name column)
+ \param icon - new icon
+ \param label - new title
+*/
void OB_Browser::setNameTitle( const QIconSet& icon, const QString& label )
{
QListView* lv = listView();
lv->setColumnText( 0, icon, label );
}
+/*!
+ Sets title of column
+ \param id - column id
+ \param label - new column title
+*/
void OB_Browser::setColumnTitle( const int id, const QString& label )
{
setColumnTitle( id, QIconSet(), label );
}
+/*!
+ Sets title and icon of column
+ \param id - column id
+ \param icon - new column icon
+ \param label - new column title
+*/
void OB_Browser::setColumnTitle( const int id, const QIconSet& icon, const QString& label )
{
QListView* lv = listView();
lv->setColumnText( myColumnIds[id], icon, label );
}
+/*!
+ \return title of first column (name column)
+*/
QString OB_Browser::nameTitle() const
{
return myView->columnText( 0 );
}
+/*!
+ \return title of first column (name column)
+ \param id - column id
+*/
QString OB_Browser::columnTitle( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return true if column is visible
+ \param id - column id
+*/
bool OB_Browser::isColumnVisible( const int id ) const
{
return myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] );
}
+/*!
+ Sets visibility of column
+ \param id - column id
+ \param on - new visibility state
+*/
void OB_Browser::setColumnShown( const int id, const bool on )
{
if ( !myColumnIds.contains( id ) )
myView->setColumnWidthMode( myColumnIds[id], QListView::Manual );
}
+/*!
+ Sets global width mode
+ \param mode - new width mode
+*/
void OB_Browser::setWidthMode( QListView::WidthMode mode )
{
for ( int i = 0, n = myView->columns(); i < n; i++ )
myView->setColumnWidthMode( i, mode );
}
+/*!
+ \return list of columns ids
+*/
QValueList<int> OB_Browser::columns() const
{
QValueList<int> lst;
return lst;
}
+/*!
+ \return true if it is possible to show/hide column by popup
+ \param id - column id
+*/
bool OB_Browser::appropriateColumn( const int id ) const
{
bool res = false;
return res;
}
+/*!
+ Sets "appropriate state": is it possible to show/hide column by popup
+ \param id - column id
+ \param on - new state
+*/
void OB_Browser::setAppropriateColumn( const int id, const bool on )
{
if ( !myColumnIds.contains( id ) )
myView->setAppropriate( myColumnIds[id], on );
}
+/*!
+ Updates tree
+ \param obj - start object
+ \param autoOpen - to open automatically branches of autoOpenLevel()
+ \sa autoOpenLevel()
+*/
void OB_Browser::updateTree( SUIT_DataObject* obj, const bool autoOpen )
{
// QTime t1 = QTime::currentTime();
// qDebug( QString( "update tree time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) );
}
+/*!
+ Replaces part of tree starting at object 'src' by tree starting at object 'trg'
+*/
void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg )
{
if ( !src || !trg || src == trg || src->root() != getRootObject() )
emit selectionChanged();
}
+/*!
+ Updates view
+ \param startObj - start object
+*/
void OB_Browser::updateView( SUIT_DataObject* startObj )
{
QListView* lv = listView();
}
}
+/*!
+ Creates new list item
+ \return new item
+ \param o - corresponding SUIT object
+ \param parent - parent item
+ \param after - item after that new item must be added
+ \param prepend - new item must be added as first
+*/
QListViewItem* OB_Browser::createItem( const SUIT_DataObject* o, QListViewItem* parent,
QListViewItem* after, const bool prepend )
{
return item;
}
+/*!
+ Adjusts width by root item
+*/
void OB_Browser::adjustWidth()
{
if ( !listView() )
adjustWidth( listView()->firstChild() );
}
+/*!
+ Adjusts width by item
+ \param item
+*/
void OB_Browser::adjustWidth( QListViewItem* item )
{
while ( item )
}
}
+/*!
+ \return SUIT object corresponding to item
+ \param item
+*/
SUIT_DataObject* OB_Browser::dataObject( const QListViewItem* item ) const
{
SUIT_DataObject* obj = 0;
return obj;
}
+/*!
+ \return item corresponding to SUIT object
+ \param obj - SUIT object
+*/
QListViewItem* OB_Browser::listViewItem( const SUIT_DataObject* obj ) const
{
QListViewItem* item = 0;
return item;
}
+/*!
+ \return list view of object browser
+*/
QListView* OB_Browser::listView() const
{
return myView;
}
+/*!
+ \remove all items referencing current (through data objects)
+*/
void OB_Browser::removeReferences( QListViewItem* item )
{
if ( !item )
}
}
+/*!
+ Connects all children to SLOT onDestroyed
+*/
void OB_Browser::createConnections( SUIT_DataObject* obj )
{
if ( !obj )
it.current()->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
}
+/*!
+ Disconnects all children from SLOT onDestroyed
+*/
void OB_Browser::removeConnections( SUIT_DataObject* obj )
{
if ( !obj )
it.current()->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
}
+/*!
+ Stores states (opened, selected) of current tree items
+ \return current item
+ \param selObjs, selKeys - maps of selected objects
+ \param openObjs, openKeys - maps of opened objects
+ \param curKey - map of current objects
+*/
SUIT_DataObject* OB_Browser::storeState( DataObjectMap& selObjs, DataObjectMap& openObjs,
DataObjectKeyMap& selKeys, DataObjectKeyMap& openKeys,
DataObjectKey& curKey ) const
return curObj;
}
+/*!
+ Restores states (opened, selected) of current tree items
+ \param selObjs, selKeys - maps of selected objects
+ \param openObjs, openKeys - maps of opened objects
+ \param curKey - map of current objects
+*/
void OB_Browser::restoreState( const DataObjectMap& selObjs, const DataObjectMap& openObjs,
const SUIT_DataObject* curObj, const DataObjectKeyMap& selKeys,
const DataObjectKeyMap& openKeys, const DataObjectKey& curKey )
lv->blockSignals( block );
}
+/*!
+ Creates object key by tree item
+*/
OB_Browser::DataObjectKey OB_Browser::objectKey( QListViewItem* i ) const
{
return objectKey( dataObject( i ) );
}
+/*!
+ Creates object key by SUIT object
+*/
OB_Browser::DataObjectKey OB_Browser::objectKey( SUIT_DataObject* obj ) const
{
if ( !obj )
return DataObjectKey( obj->key() );
}
+/*!
+ Custom key press event handler, updates tree by F5
+*/
void OB_Browser::keyPressEvent( QKeyEvent* e )
{
if ( e->key() == Qt::Key_F5 )
QFrame::keyPressEvent( e );
}
+/*!
+ SLOT: called if action "Expand all" is activated
+*/
void OB_Browser::onExpand()
{
DataObjectList selected;
expand( listViewItem( itr.current() ) );
}
+/*!
+ SLOT: called if action "Show/hide column" is activated by popup
void OB_Browser::onColumnVisible( int id )
{
setColumnShown( id, !isColumnVisible( id ) );
}
+/*!
+ SLOT: called if SUIT object is destroyed
+*/
void OB_Browser::onDestroyed( SUIT_DataObject* obj )
{
removeObject( obj );
}
+/*!
+ SLOT: called on finish of drag-n-drop operation
+ \param items - dragged items
+ \param item - destination (item on that they were dropped)
+ \param action - QDropEvent::Action
+*/
void OB_Browser::onDropped( QPtrList<QListViewItem> items, QListViewItem* item, int action )
{
SUIT_DataObject* obj = dataObject( item );
emit dropped( lst, obj, action );
}
+/*!
+ Updates texts of items
+*/
void OB_Browser::updateText()
{
if ( myColumnIds.isEmpty() )
}
}
+/*!
+ \return true if item must be updated
+ \param item - item to be checked
+*/
bool OB_Browser::needToUpdateTexts( QListViewItem* item ) const
{
SUIT_DataObject* obj = dataObject( item );
return false;
}
+/*!
+ Updates texts of item
+ \param item - item to be updated
+*/
void OB_Browser::updateText( QListViewItem* item )
{
SUIT_DataObject* obj = dataObject( item );
item->setText( it.data(), obj->text( it.key() ) );
}
+/*!
+ Custom event filter
+*/
bool OB_Browser::eventFilter( QObject* o, QEvent* e )
{
if ( o == myView && e->type() == QEvent::ContextMenu )
return QFrame::eventFilter( o, e );
}
+/*!
+ Adds custom actions to popup
+ \param menu - popup menu
+*/
void OB_Browser::contextMenuPopup( QPopupMenu* menu )
{
/* QValueList<int> cols;
}
}
+/*!
+ Expands item with all it's children
+*/
void OB_Browser::expand( QListViewItem* item )
{
if ( !item )
expand( child );
}
+/*!
+ \return true if item or one of it's children isn't opened
+*/
bool OB_Browser::hasClosed( QListViewItem* item ) const
{
if ( !item )
return has;
}
+/*!
+ Removes SUIT object
+ \param obj - SUIT object to be removed
+ \param autoUpd - auto tree updating
+*/
void OB_Browser::removeObject( SUIT_DataObject* obj, const bool autoUpd )
{
if ( !obj )
delete item;
}
+/*!
+ Opens branches from 1 to autoOpenLevel()
+ \sa autoOpenLevel()
+*/
void OB_Browser::autoOpenBranches()
{
int level = autoOpenLevel();
}
}
+/*!
+ Opens branch
+ \param item
+ \param level
+*/
void OB_Browser::openBranch( QListViewItem* item, const int level )
{
if ( level < 1 )
}
}
+/*!
+ SLOT: called on double click on item, emits signal
+*/
void OB_Browser::onDoubleClicked( QListViewItem* item )
{
if ( item )
emit doubleClicked( dataObject( item ) );
}
+/*!
+ Stores time of last modification
+*/
void OB_Browser::setModified()
{
myModifiedTime = clock();
using namespace std;
/*!
- Class: ListItem
- Descr: base template class
+ Constructor
*/
-
template<class T>
ListItemF<T>::ListItemF( T* theT, SUIT_DataObject* obj ) :
myT( theT ),
}
/*!
- Class: OB_ListItem
- Descr: List view item for OB_Browser.
+ Constructor
*/
-
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent )
: ListItemF<QListViewItem>( this, obj ),
QListViewItem(parent)
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent )
: ListItemF<QListViewItem>( this, obj ),
QListViewItem(parent)
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after )
: ListItemF<QListViewItem>( this, obj),
QListViewItem(parent, after )
update();
}
+/*!
+ Constructor
+*/
OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after )
: ListItemF<QListViewItem>( this,obj),
QListViewItem(parent, after )
update();
}
+/*!
+ Destructor
+*/
OB_ListItem::~OB_ListItem()
{
}
+/*!
+ Sets selection state of item
+ \param s - new state
+*/
void OB_ListItem::setSelected( bool s )
{
setSel( s );
QListViewItem::setSelected( s );
}
+/*!
+ Paints focus
+ \param p - painter
+ \param cg - color group
+ \param r - focus rectangle
+*/
void OB_ListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r )
{
QColorGroup col_group( cg );
QListViewItem::paintFocus( p, col_group, R );
}
+/*!
+ Paints item
+ \param p - painter
+ \param cg - color group
+ \param c - not used
+ \param w - width of item
+ \param align - alignment
+*/
void OB_ListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align )
{
QColorGroup col_group( cg );
QListViewItem::paintCell( p, col_group, c, min( W, w ), align );
}
+/*!
+ \return custom RTTI info
+*/
int OB_ListItem::RTTI()
{
return 1000;
}
+/*!
+ \return custom RTTI info
+*/
int OB_ListItem::rtti() const
{
return RTTI();
}
+/*!
+ Sets item text
+ \param column - column index
+ \param text - new text
+*/
void OB_ListItem::setText( int column, const QString& text )
{
QListViewItem::setText( column, text );
}
/*!
- Class: OB_CheckListItem
- Descr: Check list view item for OB_Browser.
+ Constructor
*/
-
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, Type type )
: ListItemF<QCheckListItem>( this, obj),
QCheckListItem( parent, "", type )
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, Type type )
: ListItemF<QCheckListItem>( this, obj),
QCheckListItem( parent, "", type )
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after, Type type )
: ListItemF<QCheckListItem>( this, obj),
#if defined(QT_VERSION) && QT_VERSION >= 0x030101
update();
}
+/*!
+ Constructor
+*/
OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after, Type type )
: ListItemF<QCheckListItem>( this, obj),
#if defined(QT_VERSION) && QT_VERSION >= 0x030101
update();
}
+/*!
+ Destructor
+*/
OB_CheckListItem::~OB_CheckListItem()
{
}
+/*!
+ Sets selection state of item
+ \param s - new state
+*/
void OB_CheckListItem::setSelected( bool s )
{
setSel( s );
QCheckListItem::setSelected( s );
}
+/*!
+ Paints focus
+ \param p - painter
+ \param cg - color group
+ \param r - focus rectangle
+*/
void OB_CheckListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r )
{
QColorGroup col_group( cg );
QCheckListItem::paintFocus( p, col_group, R );
}
+/*!
+ Paints item
+ \param p - painter
+ \param cg - color group
+ \param c - not used
+ \param w - width of item
+ \param align - alignment
+*/
void OB_CheckListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align )
{
QColorGroup col_group( cg );
QCheckListItem::paintCell( p, col_group, c, min( W, w ), align );
}
+/*!
+ \return custom RTTI info
+*/
int OB_CheckListItem::RTTI()
{
return OB_ListItem::RTTI() + 1;
}
+/*!
+ \return custom RTTI info
+*/
int OB_CheckListItem::rtti() const
{
return RTTI();
}
+/*!
+ SLOT: called if checked state is changed, changes corresponding state of SUIT object
+*/
void OB_CheckListItem::stateChange( bool on )
{
QCheckListItem::stateChange( on );
#include <qdragobject.h>
+/*!
+ Constructor
+*/
OB_ListView::OB_ListView( QWidget* parent, const char* name, WFlags f )
: QtxListView( parent, name, f ),
myFilter( 0 )
{
}
+/*!
+ Constructor
+*/
OB_ListView::OB_ListView( const int state, QWidget* parent, const char* name, WFlags f )
: QtxListView( state, parent, name, f ),
myFilter( 0 )
{
}
+/*!
+ Destructor
+*/
OB_ListView::~OB_ListView()
{
delete myFilter;
}
+/*!
+ \return filter
+*/
OB_Filter* OB_ListView::filter() const
{
return myFilter;
}
+/*!
+ Changes filter
+ \param f - new filter
+*/
void OB_ListView::setFilter( OB_Filter* f )
{
if ( myFilter == f )
myFilter = f;
}
+/*!
+ \return true if item passes filter
+*/
bool OB_ListView::isOk( QListViewItem* item ) const
{
bool ok = true;
return ok;
}
+/*!
+ Creates new drag object
+*/
QDragObject* OB_ListView::dragObject()
{
myItems.clear();
return new QTextDrag( "", this );
}
+/*!
+ Custom drag enter event filter
+*/
void OB_ListView::dragEnterEvent( QDragEnterEvent* e )
{
e->accept();
}
+/*!
+ Custom drag move event filter
+*/
void OB_ListView::dragMoveEvent( QDragMoveEvent* e )
{
QListViewItem* item = dropItem( e );
e->accept( false );
}
+/*!
+ Custom drop event filter
+*/
void OB_ListView::dropEvent( QDropEvent* e )
{
QListViewItem* item = dropItem( e );
myItems.clear();
}
+/*!
+ Custom key press event filter
+*/
void OB_ListView::keyPressEvent( QKeyEvent* ke )
{
if ( ( ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Minus ) && ke->state() & ControlButton )
QtxListView::keyPressEvent( ke );
}
+/*!
+ Finds item, in that dragged objects are dropped by QDropEvent
+ \return tree item
+*/
QListViewItem* OB_ListView::dropItem( QDropEvent* e ) const
{
QListViewItem* item = 0;
return item;
}
+/*!
+ \return SUIT object by tree item
+ \param item - tree item
+*/
SUIT_DataObject* OB_ListView::dataObject( QListViewItem* item ) const
{
if ( !item )
return obj;
}
+/*!
+ \return true if it is possible to drop into item
+ \param item - tree item to be checked
+*/
bool OB_ListView::isDropAccepted( QListViewItem* item ) const
{
bool res = true;
return res;
}
+/*!
+ \return true if it is possible to drop one item into other
+ \param drag - dragged item
+ \param drop - destination item
+*/
bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) const
{
SUIT_DataObject* dragObj = dataObject( drag );
return dropObj->isDropAccepted( dragObj );
}
+/*!
+ Sets column width
+ \param col - column index
+ \param width - column width
+*/
void OB_ListView::setColumnWidth( int col, int width )
{
int max = columnMaxWidth( col );
QListView::setColumnWidth( col, width );
}
+/*!
+ \return column max width
+ \param col - column index
+*/
int OB_ListView::columnMaxWidth( const int col ) const
{
int res = -1;
return res;
}
+/*!
+ Changes column max width
+ \param col - column index
+ \param w - column max width
+*/
void OB_ListView::setColumnMaxWidth( const int col, const int w )
{
myMaxColWidth.insert( col, w );
}
+/*!
+ \return column max ratio
+ \param col - column index
+*/
double OB_ListView::columnMaxRatio( const int col ) const
{
double res = 0.0;
return res;
}
+/*!
+ Changes column max ratio
+ \param col - column index
+ \param w - column max ratio
+*/
void OB_ListView::setColumnMaxRatio( const int col, const double r )
{
myMaxColRatio.insert( col, r );
//
// See http://www.salome-platform.org/
//
-//*********************************************************************************
-// SUIT_FileDlg class is the extension of the Qt's Open/Save file dialog box.
-// To get the file/directory name(s) call static methods:
-//
-// to invoke "Open file" or "Save file" dialog box
-// static QString getFileName(QWidget* parent, const QString& initial, const QStringList& filters,
-// const QString& caption, const bool open, const bool showQuickDir = true,
-// SUIT_FileValidator* validator = 0);
-//
-// to invoke "Open files" dialog box (to get the multiple file selection)
-// static QStringList getOpenFileNames(QWidget* parent, const QString& initial, const QStringList& filters,
-// const QString& caption, bool showQuickDir = true,
-// SUIT_FileValidator* validator = 0);
-//
-// to invoke "Select directory" dialog box
-// static QString getExistingDirectory(QWidget* parent, const QString& initial,
-// const QString& caption, const bool showQuickDir = true);
-//
-// The parameters:
-// - parent parent widget (if 0, the current desktop is used)
-// - initial starting directory or file name (if null, last visited directory is used)
-// - filters file filters list; patterns inside the filter can be separated by ';','|' or ' '
-// symbols
-// - caption dialog box's caption: if null, the default one is used
-// - open open flag - true for "Open File" and false for "Save File" dialog box
-// - showQuickDir this flag enables/disables "Quick directory list" controls
-// - validator you can provide custom file validator with this parameter
-//
-// Examples:
-// ...
-// QStringList flist;
-// flist.append( "Image files (*.bmp *.gif *.jpg )" );
-// flist.append( "All files (*.*)" );
-// QMyFileValidator* v = new QMyFileValidator( 0 );
-// QString fileName = SUIT_FileDlg::getFileName( 0, QString::null, flist, "Dump view", false, true, v );
-// if ( !fileName.isEmpty() ) {
-// ... writing image to the file
-// }
-// ...
-// QStringList flist;
-// flist.append( "*.cpp | *.cxx | *.c++" );
-// flist.append( "*.h | *.hpp | *.hxx" );
-// QString fileName = SUIT_FileDlg::getFileName( desktop(), QString::null, flist, QString::null, true, true );
-//
-//*********************************************************************************
+
+/*!
+ SUIT_FileDlg class is the extension of the Qt's Open/Save file dialog box.
+ To get the file/directory name(s) call static methods:
+
+ to invoke "Open file" or "Save file" dialog box
+ static QString getFileName(QWidget* parent, const QString& initial, const QStringList& filters,
+ const QString& caption, const bool open, const bool showQuickDir = true,
+ SUIT_FileValidator* validator = 0);
+
+ to invoke "Open files" dialog box (to get the multiple file selection)
+ static QStringList getOpenFileNames(QWidget* parent, const QString& initial, const QStringList& filters,
+ const QString& caption, bool showQuickDir = true,
+ SUIT_FileValidator* validator = 0);
+
+ to invoke "Select directory" dialog box
+ static QString getExistingDirectory(QWidget* parent, const QString& initial,
+ const QString& caption, const bool showQuickDir = true);
+
+ The parameters:
+ - parent parent widget (if 0, the current desktop is used)
+ - initial starting directory or file name (if null, last visited directory is used)
+ - filters file filters list; patterns inside the filter can be separated by ';','|' or ' '
+ symbols
+ - caption dialog box's caption: if null, the default one is used
+ - open open flag - true for "Open File" and false for "Save File" dialog box
+ - showQuickDir this flag enables/disables "Quick directory list" controls
+ - validator you can provide custom file validator with this parameter
+
+ Examples:
+ ...
+ QStringList flist;
+ flist.append( "Image files (*.bmp *.gif *.jpg )" );
+ flist.append( "All files (*.*)" );
+ QMyFileValidator* v = new QMyFileValidator( 0 );
+ QString fileName = SUIT_FileDlg::getFileName( 0, QString::null, flist, "Dump view", false, true, v );
+ if ( !fileName.isEmpty() ) {
+ ... writing image to the file
+ }
+ ...
+ QStringList flist;
+ flist.append( "*.cpp | *.cxx | *.c++" );
+ flist.append( "*.h | *.hpp | *.hxx" );
+ QString fileName = SUIT_FileDlg::getFileName( desktop(), QString::null, flist, QString::null, true, true );
+*/
#include "SUIT_FileDlg.h"