There is a window with custom widgets-diagrams and widgets-time-scales:
Initially, the size of the widget-digram is set in the constructor as follows relative to its scroll, in which the widget is located:
setGeometry(0, 0, max<int>(static_cast<int>(outputData->maxArrivingTime() / dialog->commonSAGridSpacing * dialog->commonSAScale) + 20, parent->width()), max<int>(static_cast<int>(outputData->outputSettings.flowQuantity * (rowHeight + 1)), parent->height())); Then, using the buttons for controlling the grid spacing in time ( gridaSpacing ) and the scale in pixels ( scale ), the diagram is redrawn, it is set to the geometry in the redrawing method:
setGeometry(0, 0, max<int>(static_cast<int>(outputData->maxArrivingTime() / dialog->commonSAGridSpacing * dialog->commonSAScale) + 20, dynamic_cast<QScrollArea *>(parent())->width()), max<int>(static_cast<int>(outputData->outputSettings.flowQuantity * (rowHeight + 1)), dynamic_cast<QScrollArea *>(parent())->height())); Gradually with breakpoints, the widget's geometry becomes larger than the scroll geometry, the parents are specified neatly, but the widget does not scroll, scroll bars do not appear, although setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded) .