Hello everyone :
I want to use QGraphicsView + QGraphicsScene combination displayed on the screen multiple waveforms.
so I use this function to create :
QGraphicsView * createView ()
{
QGraphicsView * view = new QGraphicsView ();
int width = view-> width (); / / / <==== width here is Qt default width , the width is not a good layout
int height = view-> height ();
view-> setSceneRect (0,0, width, height);
MyGraphicsScene * scene = new MyGraphicsScene (width-10, height-10, view);
scene-> setBackgroundBrush (Qt :: black);
scene-> createScale (5,5);
view-> setScene (scene);
return view;
}
But I like this create, find , Qt default width and height are the width and height , is not I good width and height of the layout , may I ask how I know after a good width and layout the height of it . Thank you !
------ Solution ------------------------------------ --------
deal with this problem in resizeEvent where you can get the right size.
------ eference --------------------------------------- < br> setMaximumSize and setMinimumSize set the size of the control , and then layout. SetMinimumSize with setMaximumSize and set the control maximum and minimum width and height are equal, then the control will not change with the size of your window changes in the layout
------ eference --------- ------------------------------
Oh, thank you reply , I mean : I hope I have a window with controls size changes, such as a control me , put two controls , so they are of equal size , if two rows of two columns of four to put the same controls , so they arranged doubled after narrowing equal .
this is my painting this control when he needs to know the actual size of the screen , so I can only further paintings, may actually I do not know, how do I ask such , thank you !
------ eference ---------------------------------------
Okay, so , thank you . Results posted .
没有评论:
发表评论