Salome HOME
Fix for bug IPAL9558 : Maintainance Mandrake porting: black rectangle in table view. current25072005
authormkr <mkr@opencascade.com>
Mon, 25 Jul 2005 11:17:33 +0000 (11:17 +0000)
committermkr <mkr@opencascade.com>
Mon, 25 Jul 2005 11:17:33 +0000 (11:17 +0000)
src/SUPERVGUI/SUPERVGUI_ArrayView.cxx
src/SUPERVGUI/SUPERVGUI_ArrayView.h
src/SUPERVGUI/SUPERVGUI_Canvas.cxx
src/SUPERVGUI/SUPERVGUI_CanvasArray.cxx

index 63d7ac2e0e91829293ded06e10803a99ebd93795..de53d8c3ed88212557ce7c55d15679e832e363c3 100644 (file)
@@ -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 732a0f9ef5179f70f2dce669b4120c114bfaa906..156e7486c65bce437f2574897e083a8b65685a69 100644 (file)
@@ -86,7 +86,7 @@ SUPERVGUI_Canvas::SUPERVGUI_Canvas(SUPERVGUI_Main* m):
   Trace("SUPERVGUI_Canvas::SUPERVGUI_Canvas");
   myIsControlView = false;
   // resize(GRAPH_WIDTH, GRAPH_HEIGHT);
-  resize(1000, 725);
+  resize(1050, 750);
   setDoubleBuffering(true);
 
   QColor aColor(MAIN_COLOR);
index cf9404719e9f5a9ab41f3c3dc6622aa43a8138bf..01aeec5cf5acbee727446acc6a8790dcc399e233 100644 (file)
@@ -18,6 +18,8 @@ using namespace std;
 #include <qtooltip.h>
 #define TEXT_MARGIN 5
 
+#include <iostream.h> //for debug only
+
 #define ADDNODES(NodesName,LevelHasDiffNT) \
     ncols = nodes->NodesName.length(); \
     for (int co=0; co<ncols; co++) {  \
@@ -132,8 +134,11 @@ bool SUPERVGUI_CanvasArray::create() {
   SUPERVGUI_CanvasCellNode* cell;
   QString         aLabel;
   int             x, y;
   int             nligs = myMain->getDataflow()->LevelMax();
+  cout<<"-> myMain->getDataflow()->LevelMax() = "<<myMain->getDataflow()->LevelMax()<<endl;
   int             ncols = myMain->getDataflow()->ThreadsMax();
+  cout<<"-> myMain->getDataflow()->ThreadsMax() = "<<myMain->getDataflow()->ThreadsMax()<<endl;
   
   // there is no any calculations
   if (ncols == 0) return false;
@@ -142,6 +147,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 +166,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 +213,13 @@ 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;
 
 }