myPropertyPanelDock = createPropertyPanel();
addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanelDock);
hidePropertyPanel(); //<! Invisible by default
-
+ hideObjectBrowser();
tabifyDockWidget(aObjDock, myPropertyPanelDock);
}
aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
aObjDock->setWindowTitle(tr("Object browser"));
myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
- //myObjectBrowser->setColumnCount(1);
- //myObjectBrowser->setHeaderHidden(true);
aObjDock->setWidget(myObjectBrowser);
-// fillObjectBrowser();
return aObjDock;
}
class XGUI_Command;
class QGridLayout;
+/**\class XGUI_MenuGroupPanel
+ * \ingroup GUI
+ * \brief Represents a one group in a page of main menu (workbench)
+ */
class XGUI_MenuGroupPanel: public QWidget
{
Q_OBJECT
public:
explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
+ //! Adding a new feature (Command) in the group
XGUI_Command* addFeature(const QString& theId, const QString& theTitle, const QString& theTip,
const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence());
class XGUI_DocumentDataModel;
-class XGUI_ObjectsBrowser : public QTreeView
+/**\class XGUI_ObjectsBrowser
+ * \ingroup GUI
+ * \brief Object browser window object. Represents data tree of current data structure
+ */
+ class XGUI_ObjectsBrowser : public QTreeView
{
Q_OBJECT
public:
XGUI_ObjectsBrowser(QWidget* theParent);
virtual ~XGUI_ObjectsBrowser();
+ //! Returns Model which provides access to data objects
XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
+ //! Returns list of currently selected features
QFeatureList selectedData() const { return mySelectedData; }
signals:
+ //! Emited when selection is changed
void selectionChanged();
private slots:
+ //! Called when selection in Data Tree is changed
void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
private:
+ //! Internal model
XGUI_DocumentDataModel* myDocModel;
+ //! List of currently selected data
QFeatureList mySelectedData;
};
FeaturePtr aFeature = mySelectedData.first();
std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- aMgr->setCurrentDocument(aFeature->data()->docRef("PartDocument")->value());
+ std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+ if (aDocRef)
+ aMgr->setCurrentDocument(aDocRef->value());
}
emit selectionChanged();
class XGUI_Workshop;
+/**\class XGUI_SelectionMgr
+ * \ingroup GUI
+ * \brief Selection manager. Provides selection event on selection in
+ * Object Browser and Viewer
+ */
class XGUI_SelectionMgr : public QObject
{
Q_OBJECT
XGUI_SelectionMgr(XGUI_Workshop* theParent);
virtual ~XGUI_SelectionMgr();
+ //! Returns list of currently selected objects
QFeatureList selectedData() const { return mySelectedData; }
-
signals:
+ //! Emited when selection in a one of viewers was changed
void selectionChanged();
public slots:
private:
XGUI_Workshop* myWorkshop;
+ //! List of selected features
QFeatureList mySelectedData;
};
\param on - new state
*/
-void XGUI_Viewer::setTrihedronShown(const bool on)
+void XGUI_Viewer::setTrihedronShown(bool on)
{
if (myTrihedron.IsNull())
return;
class QMouseEvent;
class QKeyEvent;
+/**\class XGUI_Viewer
+ * \ingroup GUI
+ * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
+ * when each of view window is a one point of view on this scene.
+ */
class XGUI_Viewer: public QObject
{
Q_OBJECT
XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
~XGUI_Viewer();
+ //! Creates a new view window
QMdiSubWindow* createView(V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
+ //! Return pointer on a main window - parent of the Viewer
XGUI_MainWindow* mainWindow() const
{
return myMainWindow;
}
+ //! Returns OCCT object which manages 3d scene
Handle(V3d_Viewer) v3dViewer() const
{
return myV3dViewer;
}
+ //! Returns OCCT object which manages displaying and selection in 3d scene
Handle(AIS_InteractiveContext) AISContext() const
{
return myAISContext;
}
+ //! Trihedron 3d object shown in the viewer
Handle(AIS_Trihedron) trihedron() const
{
return myTrihedron;
}
+ //! On/Off visibility of the trihedron object
void toggleTrihedron();
+
+ //! Returns true if trihedron is visible
bool isTrihedronVisible() const;
- void setTrihedronShown(const bool on);
+
+ //! Returns true if trihedron is visible
+ void setTrihedronShown(bool on);
+
+ //! Returns trihedron size
double trihedronSize() const;
+
+ //! Sets trihedron size
void setTrihedronSize(const double sz, bool isRelative);
+
bool trihedronRelative() const
{
return myIsRelative;
}
+ //! Update trihedron
void updateTrihedron();
+
+ //! Compute trihedron size dependent on 3d scene size
bool computeTrihedronSize(double& theNewSize, double& theSize);
static void setHotButton(XGUI::InteractionStyle theInteractionStyle, XGUI::HotOperation theOper,
static InteractionStyle2ButtonsMap myButtonMap;
signals:
- void lastViewClosed();
- void tryCloseView(XGUI_ViewWindow* theWindow);
- void deleteView(XGUI_ViewWindow* theWindow);
- void viewCreated(XGUI_ViewWindow* theWindow);
- void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
- void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
- void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
- void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
- void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
- void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
- void activated(XGUI_ViewWindow* theWindow);
+ void lastViewClosed();
+ void tryCloseView(XGUI_ViewWindow* theWindow);
+ void deleteView(XGUI_ViewWindow* theWindow);
+ void viewCreated(XGUI_ViewWindow* theWindow);
+ void mousePress(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+ void mouseRelease(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+ void mouseDoubleClick(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+ void mouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
+ void keyPress(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+ void keyRelease(XGUI_ViewWindow* theWindow, QKeyEvent* theEvent);
+ void activated(XGUI_ViewWindow* theWindow);
private slots:
- void onViewClosed(QMdiSubWindow*);
- //void onViewMapped();
- void onWindowActivated(QMdiSubWindow*);
+ void onViewClosed(QMdiSubWindow*);
+ //void onViewMapped();
+ void onWindowActivated(QMdiSubWindow*);
private:
- void addView(QMdiSubWindow* theView);
+ void addView(QMdiSubWindow* theView);
- /*! Removes the View from internal Views list.*/
- void removeView(QMdiSubWindow* theView);
+ /*! Removes the View from internal Views list.*/
+ void removeView(QMdiSubWindow* theView);
private:
XGUI_MainWindow* myMainWindow;
aLoop->registerListener(this, aPartSetId);
activateModule();
myMainWindow->show();
- QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
- aWnd->showMaximized();
- myMainWindow->showPythonConsole();
// Testing of document creation
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
- std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
- aPart->execute();
- aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
- std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
- aPoint2 = aMgr->rootDocument()->addFeature("Point");
-
- aPart = aMgr->rootDocument()->addFeature("Part");
- aPart->execute();
+ //std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ //std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
+ //std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
+ //aPart->execute();
+ //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
+ //std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
+ //aPoint2 = aMgr->rootDocument()->addFeature("Point");
+
+ //aPart = aMgr->rootDocument()->addFeature("Part");
+ //aPart->execute();
}
//******************************************************
//******************************************************
void XGUI_Workshop::onNew()
{
+ QApplication::setOverrideCursor(Qt::WaitCursor);
myMainWindow->showObjectBrowser();
+ myMainWindow->showPythonConsole();
+ QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
+ aWnd->showMaximized();
+ QApplication::restoreOverrideCursor();
}
//******************************************************