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