I have some more inputs. It looks like a problem of base class QMainWindow. For the same code, Qt3 and Qt4 behaves in a different manner.

Qt3:
- beheaves like native windows apps. QStatusBar::addPermanentWidget really makes the widget permamanent. The user can not resize the main window in a way so that the permanent widgets are hidden.

qt3.PNG

Qt4:
- On resizing certain texts of the supposed-to-permamnent-widget becomes hidden.

qt4.PNG

It's not recommneded to go back to Qt3. So, I need to find out how to take care of this issue in Qt4.

I'm using the portedcanvas Qt example to single out this problem. I added a private method createStatusBar() in canvas.cpp:

Qt Code:
  1. void Main::createStatusBar()
  2. {
  3. statusLabel = new QLabel(tr("Ready"));
  4. gridSpacingLabel = new QLabel(tr(" Grid Spacing: 20"));
  5. xPosLabel = new QLabel(tr(" X: 640 "));
  6. yPosLabel = new QLabel(tr(" Y: 640 "));
  7. widthLabel = new QLabel(tr(" Width: 640 "));
  8. heightLabel = new QLabel(tr(" Height: 480 "));
  9. unsavedDataLabel = new QLabel();
  10. QPixmap pixmap(":changes.png");
  11. unsavedDataLabel->setPixmap(pixmap);
  12.  
  13. statusBar()->addPermanentWidget(gridSpacingLabel);
  14. statusBar()->addPermanentWidget(xPosLabel);
  15. statusBar()->addPermanentWidget(yPosLabel);
  16. statusBar()->addPermanentWidget(widthLabel);
  17. statusBar()->addPermanentWidget(heightLabel);
  18. statusBar()->addPermanentWidget(unsavedDataLabel);
  19.  
  20. statusBar()->addWidget(statusLabel);
  21. statusBar()->showMessage(tr("Showing Message"));
  22. }
To copy to clipboard, switch view to plain text mode 

This method is called at the end of constructor. Also note the small code change to switch between Qt3 and Qt4 [ Q"3"MainWindow(parent,name,f) ]

Qt Code:
  1. Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
  2. Q3MainWindow(parent,name,f),
  3. //QMainWindow(parent,name,f),
  4. canvas(c)
  5. {
  6. editor = new FigureEditor(canvas,this);
  7. QMenuBar* menu = menuBar();
  8.  
  9. Q3PopupMenu* file = new Q3PopupMenu( menu );
  10. file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
  11. file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
  12. file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
  13. file->insertSeparator();
  14. file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
  15. file->insertSeparator();
  16. file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
  17. menu->insertItem("&File", file);
  18.  
  19. Q3PopupMenu* edit = new Q3PopupMenu( menu );
  20. edit->insertItem("Add &Circle", this, SLOT(addCircle()), Qt::ALT+Qt::Key_C);
  21. edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), Qt::ALT+Qt::Key_H);
  22. edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), Qt::ALT+Qt::Key_P);
  23. edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), Qt::ALT+Qt::Key_I);
  24. edit->insertItem("Add &Text", this, SLOT(addText()), Qt::ALT+Qt::Key_T);
  25. edit->insertItem("Add &Line", this, SLOT(addLine()), Qt::ALT+Qt::Key_L);
  26. edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), Qt::ALT+Qt::Key_R);
  27. edit->insertItem("Add &Sprite", this, SLOT(addSprite()), Qt::ALT+Qt::Key_S);
  28. edit->insertItem("Create &Mesh", this, SLOT(addMesh()), Qt::ALT+Qt::Key_M );
  29. edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), Qt::ALT+Qt::Key_A);
  30. menu->insertItem("&Edit", edit);
  31.  
  32. Q3PopupMenu* view = new Q3PopupMenu( menu );
  33. view->insertItem("&Enlarge", this, SLOT(enlarge()), Qt::SHIFT+Qt::CTRL+Qt::Key_Plus);
  34. view->insertItem("Shr&ink", this, SLOT(shrink()), Qt::SHIFT+Qt::CTRL+Qt::Key_Minus);
  35. view->insertSeparator();
  36. view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), Qt::CTRL+Qt::Key_PageDown);
  37. view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), Qt::CTRL+Qt::Key_PageUp);
  38. view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Plus);
  39. view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
  40. view->insertItem("Translate left", this, SLOT(moveL()), Qt::CTRL+Qt::Key_Left);
  41. view->insertItem("Translate right", this, SLOT(moveR()), Qt::CTRL+Qt::Key_Right);
  42. view->insertItem("Translate up", this, SLOT(moveU()), Qt::CTRL+Qt::Key_Up);
  43. view->insertItem("Translate down", this, SLOT(moveD()), Qt::CTRL+Qt::Key_Down);
  44. view->insertItem("&Mirror", this, SLOT(mirror()), Qt::CTRL+Qt::Key_Home);
  45. menu->insertItem("&View", view);
  46.  
  47. menu->insertSeparator();
  48.  
  49. Q3PopupMenu* help = new Q3PopupMenu( menu );
  50. help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
  51. help->setItemChecked(dbf_id, TRUE);
  52. menu->insertItem("&Help",help);
  53.  
  54. createStatusBar();
  55.  
  56. setCentralWidget(editor);
  57.  
  58. printer = 0;
  59.  
  60. init();
  61. }
To copy to clipboard, switch view to plain text mode 

Anyone else? any other idea?

Regards,
Anirban