Hi,

I have an applciation with a simple status bar.

normal.PNG

The issue is whenever I resize the main window, the texts in the status bar are overlapping with each other.

overlapped.PNG

I want them to be a nicely cropped like any native windows application (e.g. Windows Word). Any idea on how to achieve that?

Following code shows how I initialize the text in this status bar.

Qt Code:
  1. void SSDMainWindow::createStatusBar()
  2. {
  3. statusLabel = new QLabel(tr("Ready"));
  4. statusLabel->setIndent(3);
  5. statusBar()->addWidget(statusLabel);
  6.  
  7. gridSpacingLabel = new QLabel(tr(" Grid Spacing: "));
  8. gridSpacingLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  9. gridSpacingLabel->setMinimumSize(gridSpacingLabel->sizeHint());
  10. statusBar()->addPermanentWidget(gridSpacingLabel);
  11. //statusBar()->addWidget(gridSpacingLabel);
  12. gridSpacingLabel->setText(tr(" Grid Spacing:"));
  13.  
  14. xPosLabel = new QLabel(tr(" X: 640 "));
  15. xPosLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  16. xPosLabel->setMinimumSize(xPosLabel->sizeHint());
  17. statusBar()->addPermanentWidget(xPosLabel);
  18. // statusBar()->addWidget(xPosLabel);
  19. xPosLabel->setText(tr(" X:"));
  20.  
  21. yPosLabel = new QLabel(tr(" Y: 480 "));
  22. yPosLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  23. yPosLabel->setMinimumSize(yPosLabel->sizeHint());
  24. statusBar()->addPermanentWidget(yPosLabel);
  25. // statusBar()->addWidget(yPosLabel);
  26. yPosLabel->setText(tr(" Y:"));
  27.  
  28. widthLabel = new QLabel(tr(" Width: 640 "));
  29. widthLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  30. widthLabel->setMinimumSize(widthLabel->sizeHint());
  31. statusBar()->addPermanentWidget(widthLabel);
  32. // statusBar()->addWidget(widthLabel);
  33. widthLabel->setText(tr(" Width:"));
  34.  
  35. heightLabel = new QLabel(tr(" Height: 480 "));
  36. heightLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  37. heightLabel->setMinimumSize(heightLabel->sizeHint());
  38. statusBar()->addPermanentWidget(heightLabel);
  39. // statusBar()->addWidget(heightLabel);
  40. heightLabel->setText(tr(" Height:"));
  41.  
  42. unsavedDataLabel = new QLabel();
  43. QPixmap pixmap(":changes.png");
  44. unsavedDataLabel->setPixmap(pixmap);
  45. unsavedDataLabel->setMinimumSize(unsavedDataLabel->sizeHint());
  46. statusBar()->addPermanentWidget(unsavedDataLabel);
  47. // statusBar()->addWidget(unsavedDataLabel);
  48. unsavedDataLabel->clear();
  49.  
  50. if (statusBarManager) {
  51. statusBarManager->connectUnsavedData(this, SLOT(unsavedData(bool)));
  52. statusBarManager->connectPositionChanged(this, SLOT(positionChanged(qreal, qreal)));
  53. statusBarManager->connectSizeChanged(this, SLOT(sizeChanged(qreal, qreal)));
  54. statusBarManager->connectGridSpacingChanged(this, SLOT(gridSpacingChanged(int)));
  55. }
  56. }
To copy to clipboard, switch view to plain text mode 

Regards,
Anirban