Thu, 11/07/2024 - 15:15
Forums:
Hi everyone could somebody explain me about overloading DoResize() method, in class inherited from Aspect_Window.
As in example /OCCT/samples/qt/OCCTOverview
file:OcctWindow.h
Aspect_TypeOfResize OcctWindow::DoResize() { int aMask = 0; Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN; if (!myWidget->isMinimized()) { if (Abs(myWidget->rect().left() - myXLeft) > 2) { aMask |= 1; } if (Abs(myWidget->rect().right() - myXRight) > 2) { aMask |= 2; } if (Abs(myWidget->rect().top() - myYTop) > 2) { aMask |= 4; } if (Abs(myWidget->rect().bottom() - myYBottom) > 2) { aMask |= 8; } switch (aMask) { case 0: aMode = Aspect_TOR_NO_BORDER; break; case 1: aMode = Aspect_TOR_LEFT_BORDER; break; case 2: aMode = Aspect_TOR_RIGHT_BORDER; break; case 4: aMode = Aspect_TOR_TOP_BORDER; break; case 5: aMode = Aspect_TOR_LEFT_AND_TOP_BORDER; break; case 6: aMode = Aspect_TOR_TOP_AND_RIGHT_BORDER; break; case 8: aMode = Aspect_TOR_BOTTOM_BORDER; break; case 9: aMode = Aspect_TOR_BOTTOM_AND_LEFT_BORDER; break; case 10: aMode = Aspect_TOR_RIGHT_AND_BOTTOM_BORDER; break; default: break; } // end switch myXLeft = myWidget->rect().left(); myXRight = myWidget->rect().right(); myYTop = myWidget->rect().top(); myYBottom = myWidget->rect().bottom(); } return aMode; }
I can't understand where is updating process triggered?
Thu, 11/07/2024 - 18:27
OCCT itself never calls
Aspect_Window::DoResize()
method. You may find it's being called only within application code usingAspect_Window
subclasses in places likeViewerTest_EventManager
(ViewerTest is a DRAW Harness plugin for 3D Viewer):or
GlfwOcctView
(fromsamples/glfw
):Therefore, this method is called within routines handling resize/configure events coming from platform-specific window system.
DoResize()
usually doesn't do anything with windows itself or with 3D view - it is only one of the steps in updating the viewer, usually just updating cached values insideAspect_Window
storing window dimensions/position.Note that returned
Aspect_TypeOfResize
has no practical usage nowadays. Subclasses still implement this interface but OCCT itself ignores returned values.