#include <QPaintEvent>
#include <QPainter>
#include <QFileInfo>
+#include <QApplication>
#include <V3d_OrthographicView.hxx>
#include <V3d_PerspectiveView.hxx>
if (!mapped(theView)) {
theView->SetWindow(myWindow);
- if (theView != activeView())
- theView->View()->Deactivate();
+ //if (theView != activeView())
+ //theView->View()->Deactivate();
}
/* create static trihedron (16551: EDF PAL 501) */
mapView( activeView() );
#endif
if (!myWindow.IsNull()) {
- //QGuiApplication::sync();
+ QApplication::syncX();
QRect rc = theEvent->rect();
//if ( !myPaintersRedrawing ) {
//activeView()->Redraw();
}
//***********************************************
-void XGUI_ViewPort::resizeEvent(QResizeEvent*)
+void XGUI_ViewPort::resizeEvent(QResizeEvent* theEvent)
{
#ifdef WIN32
/* Win32 : map before first show to avoid flicker */
if (!mapped(activeView()))
mapView(activeView());
#endif
- //QGuiApplication::sync();
- if (!activeView().IsNull())
+ QApplication::syncX();
+ if (!activeView().IsNull()) {
activeView()->MustBeResized();
+ }
}
//***********************************************
aWidth = theRect.width();
aHeight = theRect.height();
}
- //QApplication::syncX();
+ QApplication::syncX();
OpenGLUtils_FrameBuffer aFrameBuffer;
if (aFrameBuffer.init(aWidth, aHeight)) {
void ViewerToolbar::paintEvent(QPaintEvent* theEvent)
{
+ QApplication::syncX();
+ printf("### ViewerToolbar::paintEvent\n");
+ //QToolBar::paintEvent(theEvent);
// Paint background
QPainter aPainter(this);
QRect aRect = rect();
QPoint aGlobPnt = mapToGlobal(aRect.topLeft());
QPoint aPnt = myVPort->mapFromGlobal(aGlobPnt);
- QRect aImgRect(QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(),
+ QRect aImgRect(QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(),
aRect.width(), aRect.height()));
aPainter.drawImage(aRect, myVPort->dumpView(aImgRect, false));
myClosable(true),
myStartX(0), myStartY(0), myCurrX(0), myCurrY(0), myCurScale(0.0), myCurSketch(0),
myDrawRect(false), myEnableDrawMode(false), myCursorIsHand(false), myEventStarted(false),
+ myIsActive(false),
myLastState(WindowNormalState), myOperation(NOTHING)
{
mySelectedPoint = gp_Pnt(0., 0., 0.);
QSize aWndBarSize = myWindowBar->sizeHint();
QSize myViewBarSize = myViewBar->sizeHint();
- myWindowBar->move(aSize.width() - aWndBarSize.width() - BORDER_SIZE - 4,
- BORDER_SIZE + 2);
+ myWindowBar->setGeometry(aSize.width() - aWndBarSize.width() - BORDER_SIZE - 4, BORDER_SIZE + 2,
+ aWndBarSize.width(), aWndBarSize.height());
int aViewBarWidth = aSize.width() - aWndBarSize.width() - myGripWgt->width() - 8;
if (aViewBarWidth > myViewBarSize.width())
aViewBarWidth = myViewBarSize.width();
{
if (theEvent->type() == QEvent::WindowStateChange) {
- if (isMinimized()) {
+ if (parentWidget()->isMinimized()) {
myViewBar->hide();
myGripWgt->hide();
myWindowBar->hide();
} else {
myPicture->hide();
myViewPort->show();
- if (isMaximized()) {
+ if (parentWidget()->isMaximized()) {
myMinimizeBtn->setIcon(MinimizeIco);
myMaximizeBtn->setIcon(RestoreIco);
}
- myViewBar->setVisible(isActiveWindow());
- myWindowBar->setVisible(isActiveWindow());
- myGripWgt->setVisible(isActiveWindow() && (!isMaximized()));
+ myViewBar->setVisible(myIsActive);
+ myWindowBar->setVisible(myIsActive);
+ myGripWgt->setVisible(myIsActive && (!parentWidget()->isMaximized()));
}
} else
QWidget::changeEvent(theEvent);
+//****************************************************************
void XGUI_ViewWindow::windowActivated()
{
+ myIsActive = true;
myViewBar->show();
myWindowBar->show();
- myGripWgt->setVisible(!(isMaximized() || isMinimized()));
+ myGripWgt->setVisible(!(parentWidget()->isMaximized() || parentWidget()->isMinimized()));
}
+//****************************************************************
void XGUI_ViewWindow::windowDeactivated()
{
+ myIsActive = false;
myViewBar->hide();
myWindowBar->hide();
myGripWgt->hide();
int aNewH = int(aH / aR);
myPicture->setPixmap(aPMap.scaled(100, aNewH));
- myLastState = isMaximized() ? MaximizedState : WindowNormalState;
- showMinimized();
- parentWidget()->setGeometry(parentWidget()->x(), parentWidget()->y(),
- 100, aNewH);
+ myLastState = parentWidget()->isMaximized() ? MaximizedState : WindowNormalState;
+ parentWidget()->showMinimized();
+ parentWidget()->setGeometry(parentWidget()->x(), parentWidget()->y(), 100, aNewH);
}
//****************************************************************
void XGUI_ViewWindow::onMaximize()
{
- if (isMaximized()) {
+ if (parentWidget()->isMaximized()) {
myMaximizeBtn->setIcon(MaximizeIco);
myGripWgt->show();
- showNormal();
+ parentWidget()->showNormal();
} else {
myMaximizeBtn->setIcon(RestoreIco);
myGripWgt->hide();
- showMaximized();
+ parentWidget()->showMaximized();
}
myMinimizeBtn->setIcon(MinimizeIco);
}