]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Maintainance Mandrake porting: black rectangle in table view => correct this
authorsan <san@opencascade.com>
Mon, 25 Jul 2005 10:31:12 +0000 (10:31 +0000)
committersan <san@opencascade.com>
Mon, 25 Jul 2005 10:31:12 +0000 (10:31 +0000)
situation.

src/SUPERVGUI/SUPERVGUI_ArrayView.cxx
src/SUPERVGUI/SUPERVGUI_ArrayView.h
src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx

index 63d7ac2e0e91829293ded06e10803a99ebd93795..e0fb6418bbf55ed4785137f47176211b05a9bb4d 100644 (file)
@@ -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();
 
index e851d568c8f23cca9bb33c27b6045e7bfd3e59e8..358c27d80e72e8565deb03119eea28ca7d5b598f 100644 (file)
@@ -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);
index 7e18e792eac976573c43c2df0e400731b4456857..bf01c2fc8d6c80dbe5244d90c9d8a885b8869b40 100644 (file)
@@ -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;
 
 }