@@ -102,6 +102,14 QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint | |||
|
102 | 102 | qreal width = 0; |
|
103 | 103 | qreal height = 0; |
|
104 | 104 | |
|
105 | ||
|
106 | int labelWidth = 0; | |
|
107 | ||
|
108 | foreach(const QString& s, ticksList) | |
|
109 | { | |
|
110 | labelWidth=qMax(fn.width(s),labelWidth); | |
|
111 | } | |
|
112 | ||
|
105 | 113 | switch (which) { |
|
106 | 114 | case Qt::MinimumSize: { |
|
107 | 115 | width = fn.boundingRect("...").width() + labelPadding(); |
@@ -112,8 +120,7 QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint | |||
|
112 | 120 | break; |
|
113 | 121 | } |
|
114 | 122 | case Qt::PreferredSize: { |
|
115 | int count = qMax(ticksList.first().count(), ticksList.last().count()); | |
|
116 | width = count*fn.averageCharWidth() + labelPadding() + 2; //two pixels of tolerance | |
|
123 | width = labelWidth + labelPadding() + 2; //two pixels of tolerance | |
|
117 | 124 | width += base.width(); |
|
118 | 125 | height = fn.height() * ticksList.count(); |
|
119 | 126 | height = qMax(height,base.height()); |
General Comments 0
You need to be logged in to leave comments.
Login now