Version: 9.16.0
SUIT_DataBrowser.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File : SUIT_DataBrowser.h
21// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22//
23#ifndef SUIT_DATABROWSER_H
24#define SUIT_DATABROWSER_H
25
26#include "SUIT.h"
27#include "SUIT_PopupClient.h"
28#include "SUIT_DataObject.h"
29#include <OB_Browser.h>
30
31class QShortcut;
32
34{
35 Q_OBJECT
36
37public:
41
42 enum {UpdateShortcut = 0, RenameShortcut};
43
44 virtual QString popupClientType() const;
45
46 SUIT_DataObject* root() const;
47 void setRoot( SUIT_DataObject* );
48
49 bool autoUpdate() const;
50 void setAutoUpdate( const bool );
51
52 bool updateModified() const;
53 void setUpdateModified( const bool );
54
55 void updateTree( SUIT_DataObject* = 0, const bool = true );
56
57 int shortcutKey(const int) const;
58 void setShortcutKey( const int, const int );
59
60 DataObjectList getSelected() const;
61 void getSelected( DataObjectList& ) const;
62
63 void setSelected( const SUIT_DataObject*, const bool = false );
64 void setSelected( const DataObjectList&, const bool = false );
65
66 virtual void contextMenuPopup( QMenu* );
67
68 void setAutoSizeFirstColumn( const bool on );
69 void setAutoSizeColumns( const bool on );
70 void setResizeOnExpandItem( const bool on );
71
72 void ensureVisible( SUIT_DataObject* );
73 void ensureVisible( const DataObjectList& );
74
75protected:
76 virtual void contextMenuEvent( QContextMenuEvent* );
77
78private:
79 void init( SUIT_DataObject* );
80
81signals:
86 void updated();
87
88private slots:
89 void onModelUpdated();
90 void onClicked( const QModelIndex& );
91 void onDblClicked( const QModelIndex& );
92 void onExpanded( const QModelIndex& );
93 void onStartEditing();
94
95private:
96 typedef QMap<int, QShortcut*> ShortcutMap;
98
102};
103
104#endif // SUIT_BROWSER_H
QList< SUIT_DataObject * > DataObjectList
Definition: SALOME_PYQT_PyModule.h:47
#define SUIT_EXPORT
Definition: SUIT.h:36
Object browser widget which can be used to handle tree-like data model.
Definition: OB_Browser.h:48
virtual void onExpanded(const QModelIndex &)
Definition: OB_Browser.h:129
virtual void contextMenuEvent(QContextMenuEvent *)
Process context menu request event.
Definition: OB_Browser.cxx:859
Object browser customization.
Definition: SUIT_DataBrowser.h:34
bool myAutoSizeFirstColumn
Definition: SUIT_DataBrowser.h:99
void clicked(SUIT_DataObject *)
This signal is emitted when a mouse button is clicked.
bool myAutoSizeColumns
Definition: SUIT_DataBrowser.h:100
ShortcutMap myShortcutMap
Definition: SUIT_DataBrowser.h:97
QMap< int, QShortcut * > ShortcutMap
Definition: SUIT_DataBrowser.h:96
bool myResizeOnExpandItem
Definition: SUIT_DataBrowser.h:101
void requestUpdate()
The signal is emitted when the key accelerator assigned for the update operation is pressed by the us...
void doubleClicked(SUIT_DataObject *)
This signal is emitted when a mouse button is double-clicked.
Data object representing the data instance in the tree-like hierarchy.
Definition: SUIT_DataObject.h:49
Definition: SUIT_PopupClient.h:37
virtual void contextMenuPopup(QMenu *)
Definition: SUIT_PopupClient.h:49
virtual QString popupClientType() const =0