1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Coding - Apply .clang-format formatting #286

Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -11,7 +11,7 @@
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// commercial license or contractual agreement.
#ifndef View_View_H
#define View_View_H
@@ -44,9 +44,9 @@ class View_Widget : public QWidget
public:
//! Constructor
Standard_EXPORT View_Widget (QWidget* theParent,
const Handle(AIS_InteractiveContext)& theContext,
const bool isFitAllActive);
Standard_EXPORT View_Widget(QWidget* theParent,
const Handle(AIS_InteractiveContext)& theContext,
const bool isFitAllActive);
//! Destructor
virtual ~View_Widget() {}
@@ -55,45 +55,61 @@ public:
View_Viewer* GetViewer() const { return myViewer; }
//! Sets default size that is used in sizeHint when the widget is firstly show
Standard_EXPORT void SetPredefinedSize (int theDefaultWidth, int theDefaultHeight);
Standard_EXPORT void SetPredefinedSize(int theDefaultWidth, int theDefaultHeight);
//! Creates V3d view and set Qt control for it
Standard_EXPORT void Init();
//! Returns an action for the given action type
//! \param theActionId an action index
QAction* ViewAction (const View_ViewActionType theActionId) const { return myViewActions[theActionId]; };
QAction* ViewAction(const View_ViewActionType theActionId) const
{
return myViewActions[theActionId];
};
//! Returns an action widget if exist. Implemented for fit all widget.
//! \param theActionId an action index
QWidget* GetWidget (const View_ViewActionType theActionId) const { return theActionId == View_ViewActionType_FitAllId ? myFitAllAction : 0; };
QWidget* GetWidget(const View_ViewActionType theActionId) const
{
return theActionId == View_ViewActionType_FitAllId ? myFitAllAction : 0;
};
//! \returns 0 - AIS_WireFrame, 1 - AIS_Shaded
Standard_EXPORT int DisplayMode() const;
//! Sets display mode: 0 - AIS_WireFrame, 1 - AIS_Shaded
Standard_EXPORT void SetDisplayMode (const int theMode);
Standard_EXPORT void SetDisplayMode(const int theMode);
//! Sets enable/disable view and tool bar actions depending on the parameter
//! \param theIsEnabled boolean value
Standard_EXPORT void SetEnabledView (const bool theIsEnabled);
Standard_EXPORT void SetEnabledView(const bool theIsEnabled);
//! Returns true if action is checked. It processes fit all action only.
//! \param theIsEnabled boolean value
bool IsActionChecked (const View_ViewActionType theActionId)
{ return theActionId == View_ViewActionType_FitAllId && myFitAllAction->isChecked(); }
bool IsActionChecked(const View_ViewActionType theActionId)
{
return theActionId == View_ViewActionType_FitAllId && myFitAllAction->isChecked();
}
//! Sets checked fit all action. Double click on fit all action set the action checked automatically
//! \param theIsEnabled boolean value
void SetActionChecked (const View_ViewActionType theActionId, const bool isChecked)
{ if (theActionId == View_ViewActionType_FitAllId) myFitAllAction->setChecked(isChecked); }
//! Sets checked fit all action. Double click on fit all action set the action checked
//! automatically \param theIsEnabled boolean value
void SetActionChecked(const View_ViewActionType theActionId, const bool isChecked)
{
if (theActionId == View_ViewActionType_FitAllId)
myFitAllAction->setChecked(isChecked);
}
//! Sets initial camera position
//! \param theVx direction on Ox
//! \param theVy direction on Oy
//! \param theVz direction on Oz
void SetInitProj (const Standard_Real theVx, const Standard_Real theVy, const Standard_Real theVz)
{ myHasInitProj = Standard_True; myInitVx = theVx; myInitVy = theVy; myInitVz = theVz; }
void SetInitProj(const Standard_Real theVx, const Standard_Real theVy, const Standard_Real theVz)
{
myHasInitProj = Standard_True;
myInitVx = theVx;
myInitVy = theVy;
myInitVz = theVz;
}
//! Returns paint engine for the OpenGL viewer. Avoid default execution of Qt Widget.
virtual QPaintEngine* paintEngine() const Standard_OVERRIDE { return 0; }
@@ -105,9 +121,9 @@ public:
//! \param theParameters a view instance
//! \param[out] theItems properties
//! \param thePrefix preference item prefix
Standard_EXPORT static void SaveState (View_Widget* theWidget,
QMap<QString, QString>& theItems,
const QString& thePrefix = QString());
Standard_EXPORT static void SaveState(View_Widget* theWidget,
QMap<QString, QString>& theItems,
const QString& thePrefix = QString());
//! Restores state of widget actions
//! \param theParameters a view instance
@@ -115,13 +131,15 @@ public:
//! \param theValue property value
//! \param thePrefix preference item prefix
//! \return boolean value whether the property is applied to the tree view
Standard_EXPORT static bool RestoreState (View_Widget* theWidget,
const QString& theKey, const QString& theValue,
const QString& thePrefix = QString());
Standard_EXPORT static bool RestoreState(View_Widget* theWidget,
const QString& theKey,
const QString& theValue,
const QString& thePrefix = QString());
signals:
//! Sends a signal about selection change if the left mouse button is pressed and current action does not process it
//! Sends a signal about selection change if the left mouse button is pressed and current action
//! does not process it
void selectionChanged();
//! Sends a signal about display mode change
@@ -130,7 +148,7 @@ signals:
//! Sends a signal about checked state is changed
//! \param theActionId an action index
//! \param theState the checked state
void checkedStateChanged (const int theActionId, bool theState);
void checkedStateChanged(const int theActionId, bool theState);
public slots:
@@ -138,79 +156,85 @@ public slots:
void OnFitAll() { myViewer->GetView()->FitAll(); }
//! Updates states of widget actions
//!
//!
//! - if the state is checked, uncheck all other actions
Standard_EXPORT void onCheckedStateChanged (bool isOn);
Standard_EXPORT void onCheckedStateChanged(bool isOn);
protected:
//! Avoids Qt standard execution of this method, redraw V3d view
//! \param an event
virtual void paintEvent (QPaintEvent* theEvent) Standard_OVERRIDE;
virtual void paintEvent(QPaintEvent* theEvent) Standard_OVERRIDE;
//! Avoids Qt standard execution of this method, do mustBeResized for V3d view, Init view if it is the first call
//! \param an event
virtual void resizeEvent (QResizeEvent* theEvent) Standard_OVERRIDE;
//! Avoids Qt standard execution of this method, do mustBeResized for V3d view, Init view if it is
//! the first call \param an event
virtual void resizeEvent(QResizeEvent* theEvent) Standard_OVERRIDE;
//! Left, Middle, Right button processing
//! \param an event
virtual void mousePressEvent (QMouseEvent* theEvent) Standard_OVERRIDE;
virtual void mousePressEvent(QMouseEvent* theEvent) Standard_OVERRIDE;
//! Left, Middle, Right button processing
//! \param an event
virtual void mouseReleaseEvent (QMouseEvent* theEvent) Standard_OVERRIDE;
virtual void mouseReleaseEvent(QMouseEvent* theEvent) Standard_OVERRIDE;
//! Left, Middle, Right button processing
//! \param an event
virtual void mouseMoveEvent (QMouseEvent* theEvent) Standard_OVERRIDE;
virtual void mouseMoveEvent(QMouseEvent* theEvent) Standard_OVERRIDE;
protected:
//! Creates view actions and fills an internal map
void initViewActions();
//! Empty: template to create popup menu
//! \param theX a horizontal position of mouse event
//! \param theX a vertical position of mouse event
void popup (const Standard_Integer theX, const Standard_Integer theY) { (void)theX; (void)theY; }
void popup(const Standard_Integer theX, const Standard_Integer theY)
{
(void)theX;
(void)theY;
}
private:
//! Creates action and stores it in a map of actions
//! \param theActionId an identifier of action in internal map
//! \param theIcon an icon name and place according to qrc resource file, e.g. ":/icons/view_fitall.png"
//! \param theText an action text
//! \param theToolBar a tool bar action text
//! \param theStatusBar a status bar action text
void createAction (const View_ViewActionType theActionId, const QString& theIcon, const QString& theText,
const char* theSlot, const bool isCheckable = false,
const QString& theToolBar = QString(), const QString& theStatusBar = QString());
//! \param theIcon an icon name and place according to qrc resource file, e.g.
//! ":/icons/view_fitall.png" \param theText an action text \param theToolBar a tool bar action
//! text \param theStatusBar a status bar action text
void createAction(const View_ViewActionType theActionId,
const QString& theIcon,
const QString& theText,
const char* theSlot,
const bool isCheckable = false,
const QString& theToolBar = QString(),
const QString& theStatusBar = QString());
private:
//! Converts Qt modifier key to Aspect key flag
//! \param theModifierId the event modifier
static Aspect_VKeyFlags keyFlag (const int theModifierId);
static Aspect_VKeyFlags keyFlag(const int theModifierId);
//! Converts Qt button key to Aspect key mouse
//! \param theButtonId the event button
static Aspect_VKeyMouse keyMouse (const int theButtonId);
static Aspect_VKeyMouse keyMouse(const int theButtonId);
private:
View_Viewer* myViewer; //!< connector to context, V3d viewer and V3d View
View_Viewer* myViewer; //!< connector to context, V3d viewer and V3d View
AIS_ViewController* myController; //!< controller to process view actions
QToolButton* myFitAllAction; //!< widget for fit all, processed double click to perform action automatically
QToolButton*
myFitAllAction; //!< widget for fit all, processed double click to perform action automatically
QMap<View_ViewActionType, QAction*> myViewActions; //!< tool bar view actions
Standard_Boolean myFirst; //!< flag to Init view by the first resize/paint call
Standard_Integer myDefaultWidth; //!< default width for the first sizeHint
Standard_Boolean myFirst; //!< flag to Init view by the first resize/paint call
Standard_Integer myDefaultWidth; //!< default width for the first sizeHint
Standard_Integer myDefaultHeight; //!< default height for the first sizeHint
Standard_Boolean myViewIsEnabled; //!< flag if the view and tool bar view actions are enabled/disabled
Standard_Boolean
myViewIsEnabled; //!< flag if the view and tool bar view actions are enabled/disabled
Standard_Boolean myHasInitProj; //!< is initial camera position defined
Standard_Real myInitVx; //!< initial camera position on X
Standard_Real myInitVy; //!< initial camera position on Y
Standard_Real myInitVz; //!< initial camera position on Z
Standard_Real myInitVx; //!< initial camera position on X
Standard_Real myInitVy; //!< initial camera position on Y
Standard_Real myInitVz; //!< initial camera position on Z
};
#endif