##// END OF EJS Templates
test better layout calcuation
Michal Klocek -
r2353:f0ebc1456fe5
parent child
Show More
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -95,16 +95,12 QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c
95 qreal width = 0;
95 qreal width = 0;
96 qreal height = 0;
96 qreal height = 0;
97
97
98 int count = 1;
99
100 if(!ticksList.empty()) {
101 count = qMax(ticksList.last().count(),ticksList.first().count());
102 }
103
98
104 switch (which) {
99 switch (which) {
105 case Qt::MinimumSize:{
100 case Qt::MinimumSize: {
106 count = qMin(count,5);
101 if(!ticksList.empty()) {
107 width = fn.averageCharWidth() * count;
102 width = qMax(fn.boundingRect(ticksList.last()).width(),fn.boundingRect(ticksList.first()).width());
103 }
108 height = fn.height() + labelPadding();
104 height = fn.height() + labelPadding();
109 width = qMax(width,base.width());
105 width = qMax(width,base.width());
110 height += base.height();
106 height += base.height();
@@ -112,7 +108,11 QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c
112 break;
108 break;
113 }
109 }
114 case Qt::PreferredSize:{
110 case Qt::PreferredSize: {
115 width=fn.averageCharWidth() * count;
111 if(!ticksList.empty()) {
112 foreach(QString label,ticksList) {
113 width+=fn.boundingRect(label).width();
114 }
115 }
116 height=fn.height()+labelPadding();
116 height=fn.height()+labelPadding();
117 width=qMax(width,base.width());
117 width=qMax(width,base.width());
118 height+=base.height();
118 height+=base.height();
General Comments 0
You need to be logged in to leave comments. Login now