! Sets the format that will be used to display time in the tick labels. The available patterns are: - %%z for milliseconds - %%s for seconds - %%m for minutes - %%h for hours - %%d for days The field width (zero padding) can be controlled for each unit with \ref setFieldWidth. The largest unit that appears in \a format will carry all the remaining time of a certain tick
| 6231 | carry to the hour digit. |
| 6232 | */ |
| 6233 | void QCPAxisTickerTime::setTimeFormat(const QString &format) |
| 6234 | { |
| 6235 | mTimeFormat = format; |
| 6236 | |
| 6237 | // determine smallest and biggest unit in format, to optimize unit replacement and allow biggest |
| 6238 | // unit to consume remaining time of a tick value and grow beyond its modulo (e.g. min > 59) |
| 6239 | mSmallestUnit = tuMilliseconds; |
| 6240 | mBiggestUnit = tuMilliseconds; |
| 6241 | bool hasSmallest = false; |
| 6242 | for (int i = tuMilliseconds; i <= tuDays; ++i) |
| 6243 | { |
| 6244 | TimeUnit unit = static_cast<TimeUnit>(i); |
| 6245 | if (mTimeFormat.contains(mFormatPattern.value(unit))) |
| 6246 | { |
| 6247 | if (!hasSmallest) |
| 6248 | { |
| 6249 | mSmallestUnit = unit; |
| 6250 | hasSmallest = true; |
| 6251 | } |
| 6252 | mBiggestUnit = unit; |
| 6253 | } |
| 6254 | } |
| 6255 | } |
| 6256 | |
| 6257 | /*! |
| 6258 | Sets the field widh of the specified \a unit to be \a width digits, when displayed in the tick |
no test coverage detected