../Config
${CAS_INCLUDE_DIRS}
)
+
+INSTALL(TARGETS Model DESTINATION bin)
ENDIF(WIN32)
INSTALL(TARGETS _ModelAPI DESTINATION swig)
+INSTALL(TARGETS ModelAPI DESTINATION bin)
#INSTALL(TARGETS ${SWIG_SCRIPTS} DESTINATION swig)
class PyConsole_EnhInterp;
class QMenu;
-class PYCONSOLE_EXPORT PyConsole_Console : public QWidget//, public SUIT_PopupClient
+//PYCONSOLE_EXPORT
+class PyConsole_Console : public QWidget//, public SUIT_PopupClient
{
Q_OBJECT
* Similar to PyConsole_Console except that an enhanced interpreter and enhanced editor
* are encapsulated.
*/
-class PYCONSOLE_EXPORT PyConsole_EnhConsole: public PyConsole_Console
+//PYCONSOLE_EXPORT
+class PyConsole_EnhConsole: public PyConsole_Console
{
Q_OBJECT
class PyInterp_Request;
class QEventLoop;
-class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
+//PYCONSOLE_EXPORT
+class PyConsole_Editor : public QTextEdit
{
Q_OBJECT;
/**
* Enhanced Python editor handling tab completion.
*/
-class PYCONSOLE_EXPORT PyConsole_EnhEditor: public PyConsole_Editor
+//PYCONSOLE_EXPORT
+class PyConsole_EnhEditor: public PyConsole_Editor
{
Q_OBJECT;
* Enhanced Python interpreter used for auto-completion.
* This extends PyConsole_Interp with an API wrapping the Python dir() command nicely.
*/
-class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp
+//PYCONSOLE_EXPORT
+class PyConsole_EnhInterp: public PyConsole_Interp
{
public:
PyConsole_EnhInterp()
#include <PyInterp_Interp.h> /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
-class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp
+//PYCONSOLE_EXPORT
+class PyConsole_Interp : public PyInterp_Interp
{
public:
PyConsole_Interp();
//! SALOME custom event type
#define PyEvent_EVENT QEvent::Type( QEvent::User + 10000 )
-class PYEVENT_EXPORT PyEvent_CustomEvent : public QEvent
+// PYEVENT_EXPORT
+class PyEvent_CustomEvent : public QEvent
{
public:
PyEvent_CustomEvent( int type );
class QSemaphore;
-class PYEVENT_EXPORT PyEvent_Event
+//PYEVENT_EXPORT
+class PyEvent_Event
{
public:
PyEvent_Event();
This event filter can be installed by any application that intends to use PyEvent_Event mechanism asynchronously.
This class replaced SalomeApp_EventFilter.
*/
-class PYEVENT_EXPORT PyEvent_EventFilter: public QObject
+//PYEVENT_EXPORT
+class PyEvent_EventFilter: public QObject
{
public:
static void Init();
class QObject;
class PyInterp_Watcher;
-class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread
+//PYINTERP_EXPORT
+class PyInterp_Dispatcher : protected QThread
{
PyInterp_Dispatcher(); // private constructor
* Events thrown by the interpreter having executed a command and indicating
* the return status.
*/
-class PYINTERP_EXPORT PyInterp_Event : public QEvent
+//PYINTERP_EXPORT
+class PyInterp_Event : public QEvent
{
PyInterp_Event();
PyInterp_Event( const PyInterp_Event& );
#include <list>
#include <string>
-class PYINTERP_EXPORT PyLockWrapper
+//PYINTERP_EXPORT
+class PyLockWrapper
{
PyThreadState* myThreadState;
PyThreadState* mySaveThreadState;
typedef void PyOutChanged(void* data,char * c);
-class PYINTERP_EXPORT PyInterp_Interp
+//PYINTERP_EXPORT
+class PyInterp_Interp
{
public:
static int _argc;
virtual bool initContext() = 0;
};
-class PYINTERP_EXPORT PyObjWrapper
+//PYINTERP_EXPORT
+class PyObjWrapper
{
PyObject* myObject;
public:
class PyInterp_ExecuteEvent;
class PyConsole_Editor;
-class PYINTERP_EXPORT PyInterp_Request
+// PYINTERP_EXPORT
+class PyInterp_Request
{
friend class PyInterp_Dispatcher;
friend class PyInterp_ExecuteEvent;
QObject* myListener;
};
-class PYINTERP_EXPORT PyInterp_LockRequest : public PyInterp_Request
+//PYINTERP_EXPORT
+class PyInterp_LockRequest : public PyInterp_Request
{
public:
#include <QObject>
// Private class that keeps track of destructions of request listeners
-class PYINTERP_EXPORT PyInterp_Watcher : public QObject
+//PYINTERP_EXPORT
+class PyInterp_Watcher : public QObject
{
Q_OBJECT
XGUI_RubberBand.h
XGUI_Constants.h
XGUI_ViewBackground.h
+ XGUI_DocumentDataModel.h
+ XGUI_DataModel.h
+ XGUI_ObjectsBrowser.h
)
SET(PROJECT_AUTOMOC
XGUI_Viewer.cpp
XGUI_RubberBand.cpp
XGUI_ViewBackground.cpp
+ XGUI_DocumentDataModel.cpp
+ XGUI_DataModel.cpp
+ XGUI_ObjectsBrowser.cpp
)
SET(PROJECT_RESOURCES
PyConsole
PyInterp
PyEvent
+ ModelAPI
)
QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES})
${PROJECT_SOURCE_DIR}/src/Config
${PROJECT_SOURCE_DIR}/src/PyInterp
${PROJECT_SOURCE_DIR}/src/PyConsole
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
${CAS_INCLUDE_DIRS})
LINK_DIRECTORIES($ENV{PYTHON_LIB_DIR})
${QM_RESOURCES}
)
+ADD_DEPENDENCIES(XGUI ModelAPI)
+
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
TARGET_LINK_LIBRARIES(XGUI ${PROJECT_LIBRARIES})
--- /dev/null
+#include "XGUI_DataModel.h"
+
+
+XGUI_DataModel::XGUI_DataModel(QObject* theParent)
+ : QAbstractItemModel(theParent)
+{
+}
+
+
+XGUI_DataModel::~XGUI_DataModel()
+{
+}
--- /dev/null
+
+#ifndef XGUI_DataModel_H
+#define XGUI_DataModel_H
+
+#include <QAbstractItemModel>
+
+class XGUI_DataModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ XGUI_DataModel(QObject* theParent);
+ virtual ~XGUI_DataModel();
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+#include "XGUI_DocumentDataModel.h"
+
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Iterator.h>
+#include <ModelAPI_Document.h>
+
+
+
+
+XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
+ : QAbstractItemModel(theParent),
+ myParamsFolder(0),
+ myConstructFolder(0)
+{
+ //std::shared_ptr<ModelAPI_Feature> myRoot = aMgr->createFeature("Point");
+ std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ myDocument = aMgr->currentDocument();
+}
+
+
+XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
+{
+}
+
+
+QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole) const
+{
+ switch (theRole) {
+ case Qt::DisplayRole:
+ // return a name
+ if (theIndex.internalId() == quintptr(&myParamsFolder))
+ return "Parameters";
+ else if (theIndex.internalId() == quintptr(&myConstructFolder))
+ return "Constructions";
+ else if (theIndex.internalId() == 0) {
+ return "Part";
+ }
+ break;
+ case Qt::DecorationRole:
+ // return an Icon
+ break;
+ case Qt::ToolTipRole:
+ // return Tooltip
+ break;
+ }
+ return QVariant();
+}
+
+
+QVariant XGUI_DocumentDataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ return QVariant();
+}
+
+int XGUI_DocumentDataModel::rowCount(const QModelIndex &parent) const
+{
+ std::shared_ptr<ModelAPI_Iterator> aIt = myDocument->featuresIterator(PARTS_GROUP);
+ return aIt->numIterationsLeft() + 2;
+}
+
+int XGUI_DocumentDataModel::columnCount(const QModelIndex &parent) const
+{
+ return 1;
+}
+
+QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const
+{
+ switch (theRow) {
+ case 0:
+ return createIndex(theRow, theColumn, (quintptr) &myParamsFolder);
+ case 1:
+ return createIndex(theRow, theColumn, (quintptr) &myConstructFolder);
+ default:
+ {
+ std::shared_ptr<ModelAPI_Iterator> aIt = myDocument->featuresIterator(PARTS_GROUP);
+ if (aIt->numIterationsLeft() <= (theRow - 1)) {
+ return createIndex(theRow, theColumn, (quintptr) 0);
+ }
+ }
+ }
+ return QModelIndex();
+}
+
+
+QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex &index) const
+{
+ return QModelIndex();
+}
+
+bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
+{
+ if (!theParent.isValid())
+ return true;
+
+ if (theParent.internalId() == quintptr(&myParamsFolder))
+ return myDocument->featuresIterator(PARAMETERS_GROUP)->more();
+ if (theParent.internalId() == quintptr(&myConstructFolder))
+ return myDocument->featuresIterator(CONSTRUCTIONS_GROUP)->more();
+ if (theParent.internalId() == 0)
+ return false;
+ return false;
+}
\ No newline at end of file
--- /dev/null
+
+#ifndef XGUI_DocumentDataModel_H
+#define XGUI_DocumentDataModel_H
+
+#include <QAbstractItemModel>
+
+class ModelAPI_Document;
+
+class XGUI_DocumentDataModel : public QAbstractItemModel
+{
+ Q_OBJECT
+public:
+ XGUI_DocumentDataModel(QObject* theParent);
+ virtual ~XGUI_DocumentDataModel();
+
+
+ virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ virtual QModelIndex index(int theRow, int theColumn,
+ const QModelIndex &parent = QModelIndex()) const;
+
+ virtual QModelIndex parent(const QModelIndex &index) const;
+
+ virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+
+private:
+ //std::shared_ptr<ModelAPI_Feature> myRoot;
+ short myParamsFolder;
+ short myConstructFolder;
+
+ std::shared_ptr<ModelAPI_Document> myDocument;
+};
+
+#endif
\ No newline at end of file
#include "XGUI_MainMenu.h"
#include "XGUI_ViewWindow.h"
#include "XGUI_Viewer.h"
+#include "XGUI_ObjectsBrowser.h"
#include <PyConsole_Console.h>
#include <PyConsole_EnhInterp.h>
QDockWidget* aDoc = new QDockWidget(this);
aDoc->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
aDoc->setWindowTitle(tr("OBJECT_BROWSER_TITLE"));
- myObjectBrowser = new QTreeWidget(aDoc);
- myObjectBrowser->setColumnCount(1);
- myObjectBrowser->setHeaderHidden(true);
+
+ myObjectBrowser = new XGUI_ObjectsBrowser(aDoc);
+ //myObjectBrowser->setColumnCount(1);
+ //myObjectBrowser->setHeaderHidden(true);
aDoc->setWidget(myObjectBrowser);
addDockWidget(Qt::LeftDockWidgetArea, aDoc);
//aDoc->hide();
// TEST FUNCTIONS
//******************************************************
-void XGUI_MainWindow::fillObjectBrowser()
+/*void XGUI_MainWindow::fillObjectBrowser()
{
QStringList aNames;
aNames << "Parameters" << "Constructions";
aItem->setText(0, "Features");
aItem->setIcon(0, QIcon(":pictures/features.png"));
}
-}
+}*/
void XGUI_MainWindow::addPropertyPanel()
{
class XGUI_MainMenu;
class XGUI_Viewer;
-class QTreeWidget;
+class XGUI_ObjectsBrowser;
class QMdiArea;
class PyConsole_EnhConsole;
return myMenuBar;
}
- QTreeWidget* objectBrowser() const
+ XGUI_ObjectsBrowser* objectBrowser() const
{
return myObjectBrowser;
}
private:
//!! For test purposes only
- void fillObjectBrowser();
+ //void fillObjectBrowser();
void addPropertyPanel();
XGUI_MainMenu* myMenuBar;
- QTreeWidget* myObjectBrowser;
+ XGUI_ObjectsBrowser* myObjectBrowser;
XGUI_Viewer* myViewer;
--- /dev/null
+#include "XGUI_ObjectsBrowser.h"
+#include "XGUI_DocumentDataModel.h"
+
+
+XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
+ : QTreeView(theParent)
+{
+ setHeaderHidden(true);
+ myDocModel = new XGUI_DocumentDataModel(this);
+ setModel(myDocModel);
+}
+
+
+XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
+{
+}
+
--- /dev/null
+
+#ifndef XGUI_ObjectsBrowser_H
+#define XGUI_ObjectsBrowser_H
+
+#include <QTreeView>
+
+class XGUI_DocumentDataModel;
+
+class XGUI_ObjectsBrowser : public QTreeView
+{
+ Q_OBJECT
+public:
+ XGUI_ObjectsBrowser(QWidget* theParent);
+ virtual ~XGUI_ObjectsBrowser();
+
+ XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
+
+private:
+
+ XGUI_DocumentDataModel* myDocModel;
+};
+
+#endif
\ No newline at end of file