Coises
1st February 2010, 01:51
I have some nested horizontal and vertical layouts. A couple elements of the layout are QLabels which contain rich (HTML) text that changes as execution of the program progresses.
It is possible to work out at compile time an HTML value for each of these QLabels which represents the maximum width and height that will ever be required.
I can define the layouts in Designer, but if I make the layouts contingent on the requisite size of the QLabels, things have a tendency to shift around disconcertingly as the contents of the QLabels change. On the other hand, were I to fix the size of the QLabels, things would probably go wrong when one system or another had different fonts available, or a different points-to-pixels display setting.
What is the most straightforward way to specify, for each QLabel containing variable rich text, a sample that represents the maximum size that will be needed, then fix the size of the QLabel to those dimensions so it doesn’t resize as different text is displayed in it?
It is possible to work out at compile time an HTML value for each of these QLabels which represents the maximum width and height that will ever be required.
I can define the layouts in Designer, but if I make the layouts contingent on the requisite size of the QLabels, things have a tendency to shift around disconcertingly as the contents of the QLabels change. On the other hand, were I to fix the size of the QLabels, things would probably go wrong when one system or another had different fonts available, or a different points-to-pixels display setting.
What is the most straightforward way to specify, for each QLabel containing variable rich text, a sample that represents the maximum size that will be needed, then fix the size of the QLabel to those dimensions so it doesn’t resize as different text is displayed in it?