QwtAbstractScaleDraw.3 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. .TH "QwtAbstractScaleDraw" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtAbstractScaleDraw \- A abstract base class for drawing scales\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_abstract_scale_draw\&.h>\fP
  11. .PP
  12. Inherited by \fBQwtRoundScaleDraw\fP, and \fBQwtScaleDraw\fP\&.
  13. .SS "Public Types"
  14. .in +1c
  15. .ti -1c
  16. .RI "enum \fBScaleComponent\fP { \fBBackbone\fP = 0x01, \fBTicks\fP = 0x02, \fBLabels\fP = 0x04 }"
  17. .br
  18. .ti -1c
  19. .RI "typedef QFlags< \fBScaleComponent\fP > \fBScaleComponents\fP"
  20. .br
  21. .RI "Scale components\&. "
  22. .in -1c
  23. .SS "Public Member Functions"
  24. .in +1c
  25. .ti -1c
  26. .RI "\fBQwtAbstractScaleDraw\fP ()"
  27. .br
  28. .RI "Constructor\&. "
  29. .ti -1c
  30. .RI "virtual \fB~QwtAbstractScaleDraw\fP ()"
  31. .br
  32. .RI "Destructor\&. "
  33. .ti -1c
  34. .RI "void \fBsetScaleDiv\fP (const \fBQwtScaleDiv\fP &)"
  35. .br
  36. .ti -1c
  37. .RI "const \fBQwtScaleDiv\fP & \fBscaleDiv\fP () const"
  38. .br
  39. .ti -1c
  40. .RI "void \fBsetTransformation\fP (\fBQwtTransform\fP *)"
  41. .br
  42. .ti -1c
  43. .RI "const \fBQwtScaleMap\fP & \fBscaleMap\fP () const"
  44. .br
  45. .ti -1c
  46. .RI "\fBQwtScaleMap\fP & \fBscaleMap\fP ()"
  47. .br
  48. .ti -1c
  49. .RI "void \fBenableComponent\fP (\fBScaleComponent\fP, bool enable=true)"
  50. .br
  51. .ti -1c
  52. .RI "bool \fBhasComponent\fP (\fBScaleComponent\fP) const"
  53. .br
  54. .ti -1c
  55. .RI "void \fBsetTickLength\fP (\fBQwtScaleDiv::TickType\fP, double length)"
  56. .br
  57. .ti -1c
  58. .RI "double \fBtickLength\fP (\fBQwtScaleDiv::TickType\fP) const"
  59. .br
  60. .ti -1c
  61. .RI "double \fBmaxTickLength\fP () const"
  62. .br
  63. .ti -1c
  64. .RI "void \fBsetSpacing\fP (double)"
  65. .br
  66. .RI "Set the spacing between tick and labels\&. "
  67. .ti -1c
  68. .RI "double \fBspacing\fP () const"
  69. .br
  70. .RI "Get the spacing\&. "
  71. .ti -1c
  72. .RI "void \fBsetPenWidth\fP (int width)"
  73. .br
  74. .RI "Specify the width of the scale pen\&. "
  75. .ti -1c
  76. .RI "int \fBpenWidth\fP () const"
  77. .br
  78. .ti -1c
  79. .RI "virtual void \fBdraw\fP (QPainter *, const QPalette &) const"
  80. .br
  81. .RI "Draw the scale\&. "
  82. .ti -1c
  83. .RI "virtual \fBQwtText\fP \fBlabel\fP (double) const"
  84. .br
  85. .RI "Convert a value into its representing label\&. "
  86. .ti -1c
  87. .RI "virtual double \fBextent\fP (const QFont &font) const =0"
  88. .br
  89. .ti -1c
  90. .RI "void \fBsetMinimumExtent\fP (double)"
  91. .br
  92. .RI "Set a minimum for the extent\&. "
  93. .ti -1c
  94. .RI "double \fBminimumExtent\fP () const"
  95. .br
  96. .in -1c
  97. .SS "Protected Member Functions"
  98. .in +1c
  99. .ti -1c
  100. .RI "virtual void \fBdrawTick\fP (QPainter *painter, double value, double len) const =0"
  101. .br
  102. .ti -1c
  103. .RI "virtual void \fBdrawBackbone\fP (QPainter *painter) const =0"
  104. .br
  105. .ti -1c
  106. .RI "virtual void \fBdrawLabel\fP (QPainter *painter, double value) const =0"
  107. .br
  108. .ti -1c
  109. .RI "void \fBinvalidateCache\fP ()"
  110. .br
  111. .ti -1c
  112. .RI "const \fBQwtText\fP & \fBtickLabel\fP (const QFont &, double value) const"
  113. .br
  114. .RI "Convert a value into its representing label and cache it\&. "
  115. .in -1c
  116. .SH "Detailed Description"
  117. .PP
  118. A abstract base class for drawing scales\&.
  119. \fBQwtAbstractScaleDraw\fP can be used to draw linear or logarithmic scales\&.
  120. .PP
  121. After a scale division has been specified as a \fBQwtScaleDiv\fP object using \fBsetScaleDiv()\fP, the scale can be drawn with the \fBdraw()\fP member\&.
  122. .SH "Member Enumeration Documentation"
  123. .PP
  124. .SS "enum \fBQwtAbstractScaleDraw::ScaleComponent\fP"
  125. Components of a scale
  126. .PP
  127. \fBSee also\fP
  128. .RS 4
  129. \fBenableComponent()\fP, \fBhasComponent\fP
  130. .RE
  131. .PP
  132. .PP
  133. \fBEnumerator\fP
  134. .in +1c
  135. .TP
  136. \fB\fIBackbone \fP\fP
  137. Backbone = the line where the ticks are located\&.
  138. .TP
  139. \fB\fITicks \fP\fP
  140. Ticks\&.
  141. .TP
  142. \fB\fILabels \fP\fP
  143. Labels\&.
  144. .SH "Constructor & Destructor Documentation"
  145. .PP
  146. .SS "QwtAbstractScaleDraw::QwtAbstractScaleDraw ()"
  147. .PP
  148. Constructor\&. The range of the scale is initialized to [0, 100], The spacing (distance between ticks and labels) is set to 4, the tick lengths are set to 4,6 and 8 pixels
  149. .SH "Member Function Documentation"
  150. .PP
  151. .SS "void QwtAbstractScaleDraw::draw (QPainter * painter, const QPalette & palette) const\fC [virtual]\fP"
  152. .PP
  153. Draw the scale\&.
  154. .PP
  155. \fBParameters\fP
  156. .RS 4
  157. \fIpainter\fP The painter
  158. .br
  159. \fIpalette\fP Palette, text color is used for the labels, foreground color for ticks and backbone
  160. .RE
  161. .PP
  162. .SS "virtual void QwtAbstractScaleDraw::drawBackbone (QPainter * painter) const\fC [protected]\fP, \fC [pure virtual]\fP"
  163. Draws the baseline of the scale
  164. .PP
  165. \fBParameters\fP
  166. .RS 4
  167. \fIpainter\fP Painter
  168. .RE
  169. .PP
  170. \fBSee also\fP
  171. .RS 4
  172. \fBdrawTick()\fP, \fBdrawLabel()\fP
  173. .RE
  174. .PP
  175. .PP
  176. Implemented in \fBQwtScaleDraw\fP, and \fBQwtRoundScaleDraw\fP\&.
  177. .SS "virtual void QwtAbstractScaleDraw::drawLabel (QPainter * painter, double value) const\fC [protected]\fP, \fC [pure virtual]\fP"
  178. Draws the label for a major scale tick
  179. .PP
  180. \fBParameters\fP
  181. .RS 4
  182. \fIpainter\fP Painter
  183. .br
  184. \fIvalue\fP Value
  185. .RE
  186. .PP
  187. \fBSee also\fP
  188. .RS 4
  189. \fBdrawTick()\fP, \fBdrawBackbone()\fP
  190. .RE
  191. .PP
  192. .PP
  193. Implemented in \fBQwtScaleDraw\fP, and \fBQwtRoundScaleDraw\fP\&.
  194. .SS "virtual void QwtAbstractScaleDraw::drawTick (QPainter * painter, double value, double len) const\fC [protected]\fP, \fC [pure virtual]\fP"
  195. Draw a tick
  196. .PP
  197. \fBParameters\fP
  198. .RS 4
  199. \fIpainter\fP Painter
  200. .br
  201. \fIvalue\fP Value of the tick
  202. .br
  203. \fIlen\fP Length of the tick
  204. .RE
  205. .PP
  206. \fBSee also\fP
  207. .RS 4
  208. \fBdrawBackbone()\fP, \fBdrawLabel()\fP
  209. .RE
  210. .PP
  211. .PP
  212. Implemented in \fBQwtScaleDraw\fP, and \fBQwtRoundScaleDraw\fP\&.
  213. .SS "void QwtAbstractScaleDraw::enableComponent (\fBScaleComponent\fP component, bool enable = \fCtrue\fP)"
  214. En/Disable a component of the scale
  215. .PP
  216. \fBParameters\fP
  217. .RS 4
  218. \fIcomponent\fP Scale component
  219. .br
  220. \fIenable\fP On/Off
  221. .RE
  222. .PP
  223. \fBSee also\fP
  224. .RS 4
  225. \fBhasComponent()\fP
  226. .RE
  227. .PP
  228. .SS "virtual double QwtAbstractScaleDraw::extent (const QFont & font) const\fC [pure virtual]\fP"
  229. Calculate the extent
  230. .PP
  231. The extent is the distance from the baseline to the outermost pixel of the scale draw in opposite to its orientation\&. It is at least \fBminimumExtent()\fP pixels\&.
  232. .PP
  233. \fBParameters\fP
  234. .RS 4
  235. \fIfont\fP Font used for drawing the tick labels
  236. .RE
  237. .PP
  238. \fBReturns\fP
  239. .RS 4
  240. Number of pixels
  241. .RE
  242. .PP
  243. \fBSee also\fP
  244. .RS 4
  245. \fBsetMinimumExtent()\fP, \fBminimumExtent()\fP
  246. .RE
  247. .PP
  248. .PP
  249. Implemented in \fBQwtScaleDraw\fP, and \fBQwtRoundScaleDraw\fP\&.
  250. .SS "bool QwtAbstractScaleDraw::hasComponent (\fBScaleComponent\fP component) const"
  251. Check if a component is enabled
  252. .PP
  253. \fBParameters\fP
  254. .RS 4
  255. \fIcomponent\fP Component type
  256. .RE
  257. .PP
  258. \fBReturns\fP
  259. .RS 4
  260. true, when component is enabled
  261. .RE
  262. .PP
  263. \fBSee also\fP
  264. .RS 4
  265. \fBenableComponent()\fP
  266. .RE
  267. .PP
  268. .SS "void QwtAbstractScaleDraw::invalidateCache ()\fC [protected]\fP"
  269. Invalidate the cache used by \fBtickLabel()\fP
  270. .PP
  271. The cache is invalidated, when a new \fBQwtScaleDiv\fP is set\&. If the labels need to be changed\&. while the same \fBQwtScaleDiv\fP is set, \fBinvalidateCache()\fP needs to be called manually\&.
  272. .SS "\fBQwtText\fP QwtAbstractScaleDraw::label (double value) const\fC [virtual]\fP"
  273. .PP
  274. Convert a value into its representing label\&. The value is converted to a plain text using QLocale()\&.toString(value)\&. This method is often overloaded by applications to have individual labels\&.
  275. .PP
  276. \fBParameters\fP
  277. .RS 4
  278. \fIvalue\fP Value
  279. .RE
  280. .PP
  281. \fBReturns\fP
  282. .RS 4
  283. Label string\&.
  284. .RE
  285. .PP
  286. .PP
  287. Reimplemented in \fBQwtDateScaleDraw\fP, and \fBQwtCompassScaleDraw\fP\&.
  288. .SS "double QwtAbstractScaleDraw::maxTickLength () const"
  289. .PP
  290. \fBReturns\fP
  291. .RS 4
  292. Length of the longest tick
  293. .RE
  294. .PP
  295. Useful for layout calculations
  296. .PP
  297. \fBSee also\fP
  298. .RS 4
  299. \fBtickLength()\fP, \fBsetTickLength()\fP
  300. .RE
  301. .PP
  302. .SS "double QwtAbstractScaleDraw::minimumExtent () const"
  303. Get the minimum extent
  304. .PP
  305. \fBReturns\fP
  306. .RS 4
  307. Minimum extent
  308. .RE
  309. .PP
  310. \fBSee also\fP
  311. .RS 4
  312. \fBextent()\fP, \fBsetMinimumExtent()\fP
  313. .RE
  314. .PP
  315. .SS "int QwtAbstractScaleDraw::penWidth () const"
  316. .PP
  317. \fBReturns\fP
  318. .RS 4
  319. Scale pen width
  320. .RE
  321. .PP
  322. \fBSee also\fP
  323. .RS 4
  324. \fBsetPenWidth()\fP
  325. .RE
  326. .PP
  327. .SS "const \fBQwtScaleDiv\fP & QwtAbstractScaleDraw::scaleDiv () const"
  328. .PP
  329. \fBReturns\fP
  330. .RS 4
  331. scale division
  332. .RE
  333. .PP
  334. .SS "\fBQwtScaleMap\fP & QwtAbstractScaleDraw::scaleMap ()"
  335. .PP
  336. \fBReturns\fP
  337. .RS 4
  338. Map how to translate between scale and pixel values
  339. .RE
  340. .PP
  341. .SS "const \fBQwtScaleMap\fP & QwtAbstractScaleDraw::scaleMap () const"
  342. .PP
  343. \fBReturns\fP
  344. .RS 4
  345. Map how to translate between scale and pixel values
  346. .RE
  347. .PP
  348. .SS "void QwtAbstractScaleDraw::setMinimumExtent (double minExtent)"
  349. .PP
  350. Set a minimum for the extent\&. The extent is calculated from the components of the scale draw\&. In situations, where the labels are changing and the layout depends on the extent (f\&.e scrolling a scale), setting an upper limit as minimum extent will avoid jumps of the layout\&.
  351. .PP
  352. \fBParameters\fP
  353. .RS 4
  354. \fIminExtent\fP Minimum extent
  355. .RE
  356. .PP
  357. \fBSee also\fP
  358. .RS 4
  359. \fBextent()\fP, \fBminimumExtent()\fP
  360. .RE
  361. .PP
  362. .SS "void QwtAbstractScaleDraw::setPenWidth (int width)"
  363. .PP
  364. Specify the width of the scale pen\&.
  365. .PP
  366. \fBParameters\fP
  367. .RS 4
  368. \fIwidth\fP Pen width
  369. .RE
  370. .PP
  371. \fBSee also\fP
  372. .RS 4
  373. \fBpenWidth()\fP
  374. .RE
  375. .PP
  376. .SS "void QwtAbstractScaleDraw::setScaleDiv (const \fBQwtScaleDiv\fP & scaleDiv)"
  377. Change the scale division
  378. .PP
  379. \fBParameters\fP
  380. .RS 4
  381. \fIscaleDiv\fP New scale division
  382. .RE
  383. .PP
  384. .SS "void QwtAbstractScaleDraw::setSpacing (double spacing)"
  385. .PP
  386. Set the spacing between tick and labels\&. The spacing is the distance between ticks and labels\&. The default spacing is 4 pixels\&.
  387. .PP
  388. \fBParameters\fP
  389. .RS 4
  390. \fIspacing\fP Spacing
  391. .RE
  392. .PP
  393. \fBSee also\fP
  394. .RS 4
  395. \fBspacing()\fP
  396. .RE
  397. .PP
  398. .SS "void QwtAbstractScaleDraw::setTickLength (\fBQwtScaleDiv::TickType\fP tickType, double length)"
  399. Set the length of the ticks
  400. .PP
  401. \fBParameters\fP
  402. .RS 4
  403. \fItickType\fP Tick type
  404. .br
  405. \fIlength\fP New length
  406. .RE
  407. .PP
  408. \fBWarning\fP
  409. .RS 4
  410. the length is limited to [0\&.\&.1000]
  411. .RE
  412. .PP
  413. .SS "void QwtAbstractScaleDraw::setTransformation (\fBQwtTransform\fP * transformation)"
  414. Change the transformation of the scale
  415. .PP
  416. \fBParameters\fP
  417. .RS 4
  418. \fItransformation\fP New scale transformation
  419. .RE
  420. .PP
  421. .SS "double QwtAbstractScaleDraw::spacing () const"
  422. .PP
  423. Get the spacing\&. The spacing is the distance between ticks and labels\&. The default spacing is 4 pixels\&.
  424. .PP
  425. \fBReturns\fP
  426. .RS 4
  427. Spacing
  428. .RE
  429. .PP
  430. \fBSee also\fP
  431. .RS 4
  432. \fBsetSpacing()\fP
  433. .RE
  434. .PP
  435. .SS "const \fBQwtText\fP & QwtAbstractScaleDraw::tickLabel (const QFont & font, double value) const\fC [protected]\fP"
  436. .PP
  437. Convert a value into its representing label and cache it\&. The conversion between value and label is called very often in the layout and painting code\&. Unfortunately the calculation of the label sizes might be slow (really slow for rich text in Qt4), so it's necessary to cache the labels\&.
  438. .PP
  439. \fBParameters\fP
  440. .RS 4
  441. \fIfont\fP Font
  442. .br
  443. \fIvalue\fP Value
  444. .RE
  445. .PP
  446. \fBReturns\fP
  447. .RS 4
  448. Tick label
  449. .RE
  450. .PP
  451. .SS "double QwtAbstractScaleDraw::tickLength (\fBQwtScaleDiv::TickType\fP tickType) const"
  452. .PP
  453. \fBReturns\fP
  454. .RS 4
  455. Length of the ticks
  456. .RE
  457. .PP
  458. \fBSee also\fP
  459. .RS 4
  460. \fBsetTickLength()\fP, \fBmaxTickLength()\fP
  461. .RE
  462. .PP
  463. .SH "Author"
  464. .PP
  465. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.