[Qt-interest] setMinimumSize()

phil prentice philp.cheer at talktalk.net
Tue Jul 6 13:34:49 CEST 2010


Hi
  I have a strange problem with the function setMinimumSize(). I have a column 
of buttons with different text. I use the layout classes to display them...

m_WsineBut = new QPushButton("Sine");
m_WsquareBut = new QPushButton("Square")
m_WtriangleBut = new QPushButton("Triangle");
m_WsawToothBut = new QPushButton("Saw-Tooth");

I then set there minimum size as
m_WsineBut->setMinimumSize(m_WsawToothBut->sizeHint());
m_WsquareBut->setMinimumSize(m_WsawToothBut->sizeHint());
m_WtriangleBut->setMinimumSize(m_WsawToothBut->sizeHint());
//m_WsawToothBut->setMinimumSize(m_WsawToothBut->sizeHint());

to try and make them appear the same size.

Seems to make no difference. However if I multiply the sizehint by 1.1 for 
example all the pushbuttons come out with the same size (more or less what I 
wanted) i.e.
m_WsineBut->setMinimumSize(1.1 * m_WsawToothBut->sizeHint());
m_WsquareBut->setMinimumSize(1.1 * m_WsawToothBut->sizeHint());
m_WtriangleBut->setMinimumSize(1.1 * m_WsawToothBut->sizeHint());
m_WsawToothBut->setMinimumSize(1.1 * m_WsawToothBut->sizeHint());
works i.e. the buton sizes are now the same???

Am I doing something stupid or could it be it was a bug in my version of Qt 
i.e. 4.2.1

Thanks





More information about the Qt-interest-old mailing list