From: san Date: Mon, 25 Jul 2005 10:31:12 +0000 (+0000) Subject: Maintainance Mandrake porting: black rectangle in table view => correct this X-Git-Tag: T2_2_5a~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c1164075b697581cc5edb00bc3b382ac2d271de4;p=modules%2Fsuperv.git Maintainance Mandrake porting: black rectangle in table view => correct this situation. --- diff --git a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx index 63d7ac2..e0fb641 100644 --- a/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_ArrayView.cxx @@ -69,7 +69,7 @@ SUPERVGUI_ArrayView::SUPERVGUI_ArrayView(SUPERVGUI_CanvasArray* theArray, SUPERV myPopup->insertSeparator(); myPopup->insertItem(tr("MSG_CHANGE_BACKGROUND"), this, SLOT(changeBackground())); - + hide(); } @@ -104,6 +104,12 @@ void SUPERVGUI_ArrayView::changeBackground() } } +void SUPERVGUI_ArrayView::resizeEvent( QResizeEvent* e) { + QCanvasView::resizeEvent( e ); + canvas()->resize( e->size().width() > canvas()->width() ? e->size().width() : canvas()->width(), + e->size().height() > canvas()->height() ? e->size().height() : canvas()->height() ); +} + void SUPERVGUI_ArrayView::contentsMousePressEvent(QMouseEvent* theEvent) { myGlobalPoint = theEvent->globalPos(); diff --git a/src/SUPERVGUI/SUPERVGUI_ArrayView.h b/src/SUPERVGUI/SUPERVGUI_ArrayView.h index e851d56..358c27d 100644 --- a/src/SUPERVGUI/SUPERVGUI_ArrayView.h +++ b/src/SUPERVGUI/SUPERVGUI_ArrayView.h @@ -37,6 +37,9 @@ class SUPERVGUI_ArrayView: public QCanvasView { void addToStudy(); void changeBackground(); + protected: + void resizeEvent( QResizeEvent* e); + private: void contentsMousePressEvent(QMouseEvent* theEvent); void contentsMouseMoveEvent(QMouseEvent* theEvent); diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx index 7e18e79..bf01c2f 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx @@ -78,6 +78,7 @@ SUPERVGUI_CanvasArray::SUPERVGUI_CanvasArray(SUPERVGUI_Main* m): { Trace("SUPERVGUI_CanvasArray::SUPERVGUI_CanvasArray"); //resize(GRAPH_WIDTH, GRAPH_HEIGHT); + QWidget* aMainParent = (QWidget*)(myMain->parent()); resize(800, 600); setDoubleBuffering(true); @@ -142,6 +143,10 @@ bool SUPERVGUI_CanvasArray::create() { pen.setWidth(1); QBrush br(MAIN_TITLE); + // variables to resize canvas in table view + int aMaxWidth = 0; + int aMaxHeight = 0; + for (int co = 0; co < ncols; co++) { aLabel = QString("Thread %1").arg(co); QRect aRect = QRect(50 + co * (CELL_WIDTH + CELL_SPACE), 20, CELL_WIDTH, CELL_HEIGHT); @@ -157,6 +162,8 @@ bool SUPERVGUI_CanvasArray::create() { aText->setY(aRect.y() + aRect.height()/2 - aBRect.height()/2); aText->setZ(1); aText->show(); + + aMaxWidth = aRect.x() + aRect.width() + 50; } y = 60; @@ -202,6 +209,14 @@ bool SUPERVGUI_CanvasArray::create() { nodeX = 50; nodeY = y + CELL_HEIGHT*2; + aMaxHeight = nodeY; + + // if aMaxWidth and aMaxHeight is greater than the current size + // of the canvas, we resize canvas to these new width and height + if ( aMaxWidth > this->width() || aMaxHeight > this->height() ) + this->resize( aMaxWidth > this->width() ? aMaxWidth : this->width(), + aMaxHeight > this->height() ? aMaxHeight : this->height() ); + return true; }