}
myPreviewPrs->setIsTransformationPointPreview( true );
+ myPreviewPrs->setTransformationPointCursorShape( module()->getPrefEditCursor().shape() );
}
connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
this, SLOT( onPointSelected() ) );
myRefPreviewPrs->setIsByTwoPoints( aPanel->isByTwoPoints() );
+ myRefPreviewPrs->setTransformationPointCursorShape( module()->getPrefEditCursor().shape() );
+
// Add the new reference image presentation to the appropriate view
aViewPort->addItem( myRefPreviewPrs );
setPreferenceProperty( typeOfCursor, "icons", aCursorTypeIconsList );
}
+QCursor HYDROGUI_Module::getPrefEditCursor() const
+{
+ int aCursorType = SUIT_Session::session()->resourceMgr()->integerValue("preferences", "type_of_cursor", (int)CT_CrossCursor );
+ if ( aCursorType >= Qt::BlankCursor)
+ aCursorType++;
+ QCursor aCursor = QCursor( Qt::CursorShape(aCursorType) );
+ return aCursor;
+}
+
void HYDROGUI_Module::update( const int flags )
{
if( !isUpdateEnabled() )
CT_ArrowCursor = 0,
CT_UpArrowCursor,
CT_CrossCursor,
- CT_IBeamCursor,
CT_WaitCursor,
- CT_BusyCursor,
- CT_ForbiddenCursor,
- CT_PointingHandCursor,
- CT_WhatsThisCursor,
+ CT_IBeamCursor,
CT_SizeVerCursor,
CT_SizeHorCursor,
CT_SizeBDiagCursor,
CT_SizeAllCursor,
CT_SplitVCursor,
CT_SplitHCursor,
+ CT_PointingHandCursor,
+ CT_ForbiddenCursor,
+ CT_WhatsThisCursor,
+ CT_BusyCursor,
CT_OpenHandCursor,
CT_ClosedHandCursor,
CT_User
QStack<HYDROGUI_Operation*>& getActiveOperations();
HYDROGUI_Operation* activeOperation();
+ /**
+ * Returns the cursor defined for edition operations in module preferences.
+ * \return specific cursor
+ */
+ QCursor getPrefEditCursor() const;
+
protected:
CAM_DataModel* createDataModel();
#include <SUIT_MessageBox.h>
#include <SUIT_Study.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewWindow.h>
+#include <OCCViewer_ViewPort3d.h>
+
#include <QApplication>
HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule )
setPreviewZLayer( module()->getOCCDisplayer()->AddPreviewZLayer( myPreviewManager ) );
}
+void HYDROGUI_Operation::setCursor()
+{
+ if ( myPreviewManager )
+ {
+ QVector<SUIT_ViewWindow*> winList = myPreviewManager->getViews();
+ for ( QVector<SUIT_ViewWindow*>::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ OCCViewer_ViewWindow* occWin = ::qobject_cast<OCCViewer_ViewWindow*>( *it );
+ if ( occWin )
+ {
+ OCCViewer_ViewPort3d* vp = occWin->getViewPort();
+ if ( vp )
+ {
+ // Save old cursor
+ myCursor = vp->cursor();
+ // Set specific cursor chosen in preferences
+ QCursor aCursor = module()->getPrefEditCursor();
+ vp->setDefaultCursor( aCursor.shape() );
+ vp->setCursor( *vp->getDefaultCursor() );
+ }
+ }
+ }
+ }
+}
+
+void HYDROGUI_Operation::restoreCursor()
+{
+ if ( myPreviewManager )
+ {
+ QVector<SUIT_ViewWindow*> winList = myPreviewManager->getViews();
+ for ( QVector<SUIT_ViewWindow*>::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ OCCViewer_ViewWindow* occWin = ::qobject_cast<OCCViewer_ViewWindow*>( *it );
+ if ( occWin )
+ {
+ OCCViewer_ViewPort3d* vp = occWin->getViewPort();
+ if ( vp )
+ {
+ // Restore old cursor
+ vp->setDefaultCursor( myCursor.shape() );
+ vp->setCursor( myCursor );
+ }
+ }
+ }
+ }
+}
+
void HYDROGUI_Operation::startOperation()
{
LightApp_Operation::startOperation();
#include <LightApp_Operation.h>
+#include <QCursor>
+
class HYDROGUI_Module;
class HYDROGUI_InputPanel;
class HYDROGUI_Shape;
OCCViewer_ViewManager* getPreviewManager();
void setPreviewManager( OCCViewer_ViewManager* theManager );
+ /**
+ * Set specific cursor chosen in preferences for edition operations.
+ */
+ virtual void setCursor();
+ /**
+ * Restore the default cursor.
+ */
+ virtual void restoreCursor();
+
private:
HYDROGUI_Module* myModule;
bool myIsPrintErrorMessage;
bool myIsTransactionOpened;
int myPreviewZLayer;
+
+ QCursor myCursor;
};
#endif
aPanel->setOCCViewer( aViewManager ? aViewManager->getOCCViewer() : 0 );
setPreviewManager( aViewManager );
+ setCursor();
+
QString aPolylineName;
if( !myEditedObject.IsNull() )
{
void HYDROGUI_PolylineOp::abortOperation()
{
+ restoreCursor();
+
HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
if ( aPanel )
aPanel->setOCCViewer( 0 );
void HYDROGUI_PolylineOp::commitOperation()
{
+ restoreCursor();
+
HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
if ( aPanel )
aPanel->setOCCViewer( 0 );
}
}
+//================================================================
+// Function : setTransformationPointCursorShape
+// Purpose :
+//================================================================
+void HYDROGUI_PrsImage::setTransformationPointCursorShape(Qt::CursorShape theCursorShape)
+{
+ if ( myTransformationPointCursor )
+ myTransformationPointCursor->setShape(theCursorShape);
+}
+
//================================================================
// Function : boundingRect
// Purpose :
const bool theIsY,
const int theValue );
+ /**
+ * Set shape of the transformation point cursor.
+ * @param theCursorShape a cursor shape to be set
+ */
+ void setTransformationPointCursorShape(Qt::CursorShape theCursorShape);
+
public:
// from QGraphicsItem
virtual QRectF boundingRect() const;