[Qt-interest] aspect-ratio for graphs

phil prentice philp.cheer at talktalk.net
Thu Jul 15 21:13:18 CEST 2010


Thanks Sean & Jason
  I've got to do a bit more testing and tidying up, but I think that I have a 
solution that seems to work reasonably well. I re-implemented the 
resizeEvent() i.e.

void VIwindow::resizeEvent ( QResizeEvent * event )
{
  //qDebug("%d,%d\n", m_graph[0]->width(),m_graph[0]->height());
  if(m_graph[0]->height() != m_graph[0]->width())
  {
    for(int i = 0; i < 6; i++)
      m_graph[i]->setMinimumHeight(m_graph[i]->width());
  }
}

I tried looking at the link you sent me but could not download the tarfile; 
got error:-
The requested URL /qt-interest/2004-10/binPP1WN90x4o.bin was not found on this 
server.

Got to do more testing, but I think it will be good.

Thanks Jason, I will take a look at the QxtLetterBox. The company I am doing 
work for is unsure about the real meaning of LGPL.  But I will have a read of 
the code

Thanks again for all your help

Phil
On Thursday 15 July 2010 18:41, Murphy, Sean M. wrote:
> >   With your help I am now closer to what I would like.  I think that
> > part of my problem was the wish that the frame would always have an
> > aspect ratio of 1:1.  This mechanism does not achieve this. If you
> > take your example you can obviously squeeze the vertical height to
> > make the frames no longer square, I was half hoping that by some magic
> > the horizontal width could also be made to reduce, but I think that
> > asking to much (or is it?).
> > Anyway I guess it would be nice to be able to set the min-height of
> > the main window to ensure that you cannot squeeze the height to the
> > point of destroying the aspect ratio.  I tried re-implementing the
> > sizeHint() function for the frame but that did not help.
> > Should I try catching the resize event (have not looked at this yet)
> > and see if I can stop the main window from being resized to far using
> > that method?
> > My other  problem is that depending on the mode I need to display
> > either 6 graphs across the screen or just 3.
>
> If you want to go the resize event route, you can look at this that I wrote
> a looooong time ago!
>
> http://lists.trolltech.com/qt-interest/2004-10/thread00121-0.html
>
> Sean
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list