c++ - Qt window resize problem -
i having problem redrawing qwidget window after size has been adjusted. have tried update()
, repaint()
, adjustsize()
, seem suffer same thing: part of window redrawn, resulting in window frame on bottom , right sides not show. window not resized entirely.
just in case makes difference, window in qmdiarea
.
thanks.
// ... subwidget resizing , moving. calibrationwindowuis[activewindow].layoutwidget2->move(qpoint(oldxleft, 30 + height + 21)); calibrationwindowuis[activewindow].layoutwidget1->move(qpoint(oldxright, 30 + height + 21)); // set window size. calibrationwindows[activewindow]->setminimumsize(calibrationwindowuis[activewindow].tabwidget->geometry().width() + 40, calibrationwindowuis[activewindow].tabwidget->geometry().height() + 40); calibrationwindows[activewindow]->update();
note: i'm new qt; perhaps i'm doing wrong layouts?
edit: may have not given enough information. alright, quite honest, still have delve deeper layouts , related material. had tried here use qt designer in order design window. i've done perhaps amounts stupid mistake: didn't use overall parent layout entire window, hacked couple of smaller layouts therefore have move , resize individually. see qt designer screen (the red rectangles sole layouts): .
what happening in frame right, playing video clip can of various resolutions. want frame resize depending on resolution, means buttons , window have move/resize accordingly. window resize comes in. i'm sure there more elegant solution doing here, trying handle several other scenarios here , hence lack of quality of code.
the result when load clip, window attempts resize, badly; following result:
if window dragged, 'pops' correct size; in meantime, however, looks ugly.
a couple further questions: use qt designer design uis? found programmatically can achieve better control of interfaces. 1 thing not in designer have layout parented main widget, i.e. equivalent of having following bit of code:
qvboxlayout* layout = new qvboxlayout; this->setlayout(layout);
a layout placed in designer seems create 'layoutwidget' subwidget, layout placed then parented to. way around that?
we use mix of designer , code create layouts, qt layout system can unintuitive @ times. not layout full series of tabs in 1 designer ui file, make each tab each own widget , assemble them either through code or in designer promoting custom classes. gives better separation of responsibilities, putting functionality of tabs 1 file guarantee large unwieldy class.
when widget has child widgets in designer can assign layout adding context menu. make sure nothing selected , click on background of widget in want create layout, select layout , of widgets children assigned layout.
what creating hierarchies of layouts. looking @ first screenshot, use vertical layout spacers on top , bottom items on right, horizontal layout spacers left , right button bar , grid layout items together. without spacers items extend when window grows. spacers let control behavior under resizing better.
Comments
Post a Comment