From 64cb828489d907970f667ec18d1e149ea335f9c6 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 21 Apr 2014 11:23:42 +0400 Subject: [PATCH] Adaptation of toolbar size corrected (issue #32) --- src/XGUI/XGUI_ViewPort.cpp | 2 ++ src/XGUI/XGUI_ViewWindow.cpp | 9 ++++++++- src/XGUI/XGUI_ViewWindow.h | 6 ++++-- src/XGUI/XGUI_Viewer.cpp | 2 -- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/XGUI/XGUI_ViewPort.cpp b/src/XGUI/XGUI_ViewPort.cpp index d0cfa2d55..c71796465 100644 --- a/src/XGUI/XGUI_ViewPort.cpp +++ b/src/XGUI/XGUI_ViewPort.cpp @@ -178,6 +178,8 @@ OpenGLUtils_FrameBuffer::~OpenGLUtils_FrameBuffer() bool OpenGLUtils_FrameBuffer::init(const GLsizei& xSize, const GLsizei& ySize) { char* ext = (char*) glGetString(GL_EXTENSIONS); + if (!ext) + return false; if (!IsEXTInitialized || strstr(ext, "GL_EXT_framebuffer_object") == NULL) { //qDebug( "Initializing OpenGL FrameBuffer extension failed"); return false; diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index b8b90d696..5e56d61db 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -259,7 +259,6 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) myWindowBar = new ViewerToolbar(this, myViewPort); myWindowBar->setCursor(Qt::PointingHandCursor); aToolLay->addWidget(myWindowBar); - myWindowBar->setFixedWidth(100); myMinimizeBtn = new QAction(myWindowBar); myMinimizeBtn->setIcon(MinimizeIco); @@ -289,6 +288,14 @@ XGUI_ViewWindow::~XGUI_ViewWindow() { } + +//**************************************************************** +void XGUI_ViewWindow::showEvent(QShowEvent* theEvent) +{ + QFrame::showEvent(theEvent); + myWindowBar->setFixedSize(myWindowBar->sizeHint()); +} + //**************************************************************** void XGUI_ViewWindow::changeEvent(QEvent* theEvent) { diff --git a/src/XGUI/XGUI_ViewWindow.h b/src/XGUI/XGUI_ViewWindow.h index 0af119b37..e528138a3 100644 --- a/src/XGUI/XGUI_ViewWindow.h +++ b/src/XGUI/XGUI_ViewWindow.h @@ -190,6 +190,8 @@ protected: virtual bool eventFilter(QObject *theObj, QEvent *theEvent); + virtual void showEvent(QShowEvent* theEvent); + private slots: void onClose(); void onMinimize(); @@ -302,7 +304,7 @@ public: { setBackgroundRole(QPalette::NoRole); setAttribute(Qt::WA_NoSystemBackground); - setAttribute(Qt::WA_PaintOnScreen); + //setAttribute(Qt::WA_PaintOnScreen); setAutoFillBackground(false); } @@ -328,7 +330,7 @@ public: { setBackgroundRole(QPalette::NoRole); setAttribute(Qt::WA_NoSystemBackground); - setAttribute(Qt::WA_PaintOnScreen); + //setAttribute(Qt::WA_PaintOnScreen); setAutoFillBackground(false); } diff --git a/src/XGUI/XGUI_Viewer.cpp b/src/XGUI/XGUI_Viewer.cpp index 30ac2e1d3..917b3d552 100644 --- a/src/XGUI/XGUI_Viewer.cpp +++ b/src/XGUI/XGUI_Viewer.cpp @@ -415,10 +415,8 @@ void XGUI_Viewer::addView(QMdiSubWindow* theView) /*! Emit activated for view \a view. */ -static int AA = 0; void XGUI_Viewer::onWindowActivated(QMdiSubWindow* view) { - qDebug("### windowActivated %i\n", AA++); if (view && (view != myActiveView)) { myActiveView = view; ((XGUI_ViewWindow*)myActiveView->widget())->windowActivated(); -- 2.39.2