Hi

I'va a simple window (QMainWindow):

Qt Code:
  1. FormTransportOperacje::FormTransportOperacje(QString ID_transport, QWidget *parent) : QMainWindow(parent)
  2. {
  3. this->setMaximumHeight(400);
  4. QWidget *base = new QWidget();
  5. QGridLayout *layout = new QGridLayout(base);
  6. QSqlQuery query("SELECT Imie, Nazwisko, Data_operacji, Nazwa_operacji FROM m_transporty_operacje AS Top LEFT JOIN m_uzytkownicy AS U ON (U.ID_u=Top.ID_uzytkownik) WHERE ID_transport="+ID_transport+" ORDER BY Data_operacji DESC");
  7.  
  8. int i = 0;
  9. while (query.next()) {
  10. QGroupBox *GbTMP= new QGroupBox(query.value(3).toString());
  11. GbTMP->setMinimumHeight(70);
  12. GbTMP->setMaximumHeight(70);
  13. QGridLayout *layoutTMP = new QGridLayout();
  14. QDateTime DTData = query.value(2).toDateTime();
  15.  
  16. QLabel *Uzytkownik = new QLabel(query.value(0).toString()+" "+query.value(1).toString());
  17. QLabel *Data_operacji = new QLabel(DTData.toString("yyyy-MM-dd HH:mm:ss"));
  18.  
  19. GbTMP->setLayout(layoutTMP);
  20. layout->addWidget(GbTMP,i++,0,1,1);
  21. }
  22.  
  23. base->show();
  24. this->setCentralWidget(base);
  25. this->move(((QApplication::desktop()->width()-this->width())/2),((QApplication::desktop()->height()-this->height())/2));
  26.  
  27. }
To copy to clipboard, switch view to plain text mode 

And when there are many records, the window extends beyond the boundary of screen.

How can I "freez" the size of window, and add the verticalslider when the content does not fit in the window?