QwtLegend.3 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. .TH "QwtLegend" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtLegend \- The legend widget\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_legend\&.h>\fP
  11. .PP
  12. Inherits \fBQwtAbstractLegend\fP\&.
  13. .SS "Public Slots"
  14. .in +1c
  15. .ti -1c
  16. .RI "virtual void \fBupdateLegend\fP (const QVariant &, const QList< \fBQwtLegendData\fP > &)"
  17. .br
  18. .RI "Update the entries for an item\&. "
  19. .in -1c
  20. .SS "Signals"
  21. .in +1c
  22. .ti -1c
  23. .RI "void \fBclicked\fP (const QVariant &\fBitemInfo\fP, int index)"
  24. .br
  25. .ti -1c
  26. .RI "void \fBchecked\fP (const QVariant &\fBitemInfo\fP, bool on, int index)"
  27. .br
  28. .in -1c
  29. .SS "Public Member Functions"
  30. .in +1c
  31. .ti -1c
  32. .RI "\fBQwtLegend\fP (QWidget *parent=NULL)"
  33. .br
  34. .ti -1c
  35. .RI "virtual \fB~QwtLegend\fP ()"
  36. .br
  37. .RI "Destructor\&. "
  38. .ti -1c
  39. .RI "void \fBsetMaxColumns\fP (uint numColums)"
  40. .br
  41. .RI "Set the maximum number of entries in a row\&. "
  42. .ti -1c
  43. .RI "uint \fBmaxColumns\fP () const"
  44. .br
  45. .ti -1c
  46. .RI "void \fBsetDefaultItemMode\fP (\fBQwtLegendData::Mode\fP)"
  47. .br
  48. .RI "Set the default mode for legend labels\&. "
  49. .ti -1c
  50. .RI "\fBQwtLegendData::Mode\fP \fBdefaultItemMode\fP () const"
  51. .br
  52. .ti -1c
  53. .RI "QWidget * \fBcontentsWidget\fP ()"
  54. .br
  55. .ti -1c
  56. .RI "const QWidget * \fBcontentsWidget\fP () const"
  57. .br
  58. .ti -1c
  59. .RI "QWidget * \fBlegendWidget\fP (const QVariant &) const"
  60. .br
  61. .ti -1c
  62. .RI "QList< QWidget * > \fBlegendWidgets\fP (const QVariant &) const"
  63. .br
  64. .ti -1c
  65. .RI "QVariant \fBitemInfo\fP (const QWidget *) const"
  66. .br
  67. .ti -1c
  68. .RI "virtual bool \fBeventFilter\fP (QObject *, QEvent *)"
  69. .br
  70. .ti -1c
  71. .RI "virtual QSize \fBsizeHint\fP () const"
  72. .br
  73. .RI "Return a size hint\&. "
  74. .ti -1c
  75. .RI "virtual int \fBheightForWidth\fP (int width) const"
  76. .br
  77. .ti -1c
  78. .RI "QScrollBar * \fBhorizontalScrollBar\fP () const"
  79. .br
  80. .ti -1c
  81. .RI "QScrollBar * \fBverticalScrollBar\fP () const"
  82. .br
  83. .ti -1c
  84. .RI "virtual void \fBrenderLegend\fP (QPainter *, const QRectF &, bool fillBackground) const"
  85. .br
  86. .ti -1c
  87. .RI "virtual void \fBrenderItem\fP (QPainter *, const QWidget *, const QRectF &, bool fillBackground) const"
  88. .br
  89. .ti -1c
  90. .RI "virtual bool \fBisEmpty\fP () const"
  91. .br
  92. .ti -1c
  93. .RI "virtual int \fBscrollExtent\fP (Qt::Orientation) const"
  94. .br
  95. .in -1c
  96. .SS "Protected Slots"
  97. .in +1c
  98. .ti -1c
  99. .RI "void \fBitemClicked\fP ()"
  100. .br
  101. .ti -1c
  102. .RI "void \fBitemChecked\fP (bool)"
  103. .br
  104. .in -1c
  105. .SS "Protected Member Functions"
  106. .in +1c
  107. .ti -1c
  108. .RI "virtual QWidget * \fBcreateWidget\fP (const \fBQwtLegendData\fP &) const"
  109. .br
  110. .RI "Create a widget to be inserted into the legend\&. "
  111. .ti -1c
  112. .RI "virtual void \fBupdateWidget\fP (QWidget *widget, const \fBQwtLegendData\fP &)"
  113. .br
  114. .RI "Update the widget\&. "
  115. .in -1c
  116. .SH "Detailed Description"
  117. .PP
  118. The legend widget\&.
  119. The \fBQwtLegend\fP widget is a tabular arrangement of legend items\&. Legend items might be any type of widget, but in general they will be a \fBQwtLegendLabel\fP\&.
  120. .PP
  121. \fBSee also\fP
  122. .RS 4
  123. \fBQwtLegendLabel\fP, \fBQwtPlotItem\fP, \fBQwtPlot\fP
  124. .RE
  125. .PP
  126. .SH "Constructor & Destructor Documentation"
  127. .PP
  128. .SS "QwtLegend::QwtLegend (QWidget * parent = \fCNULL\fP)\fC [explicit]\fP"
  129. Constructor
  130. .PP
  131. \fBParameters\fP
  132. .RS 4
  133. \fIparent\fP Parent widget
  134. .RE
  135. .PP
  136. .SH "Member Function Documentation"
  137. .PP
  138. .SS "void QwtLegend::checked (const QVariant & itemInfo, bool on, int index)\fC [signal]\fP"
  139. A signal which is emitted when the user has clicked on a legend label, which is in \fBQwtLegendData::Checkable\fP mode
  140. .PP
  141. \fBParameters\fP
  142. .RS 4
  143. \fIitemInfo\fP Info for the item of the selected legend label
  144. .br
  145. \fIindex\fP Index of the legend label in the list of widgets that are associated with the plot item
  146. .br
  147. \fIon\fP True when the legend label is checked
  148. .RE
  149. .PP
  150. \fBNote\fP
  151. .RS 4
  152. clicks are disabled as default
  153. .RE
  154. .PP
  155. \fBSee also\fP
  156. .RS 4
  157. \fBsetDefaultItemMode()\fP, \fBdefaultItemMode()\fP, \fBQwtPlot::itemToInfo()\fP
  158. .RE
  159. .PP
  160. .SS "void QwtLegend::clicked (const QVariant & itemInfo, int index)\fC [signal]\fP"
  161. A signal which is emitted when the user has clicked on a legend label, which is in \fBQwtLegendData::Clickable\fP mode\&.
  162. .PP
  163. \fBParameters\fP
  164. .RS 4
  165. \fIitemInfo\fP Info for the item item of the selected legend item
  166. .br
  167. \fIindex\fP Index of the legend label in the list of widgets that are associated with the plot item
  168. .RE
  169. .PP
  170. \fBNote\fP
  171. .RS 4
  172. clicks are disabled as default
  173. .RE
  174. .PP
  175. \fBSee also\fP
  176. .RS 4
  177. \fBsetDefaultItemMode()\fP, \fBdefaultItemMode()\fP, \fBQwtPlot::itemToInfo()\fP
  178. .RE
  179. .PP
  180. .SS "QWidget * QwtLegend::contentsWidget ()"
  181. The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items\&.
  182. .PP
  183. \fBReturns\fP
  184. .RS 4
  185. Container widget of the legend items
  186. .RE
  187. .PP
  188. .SS "const QWidget * QwtLegend::contentsWidget () const"
  189. The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items\&.
  190. .PP
  191. \fBReturns\fP
  192. .RS 4
  193. Container widget of the legend items
  194. .RE
  195. .PP
  196. .SS "QWidget * QwtLegend::createWidget (const \fBQwtLegendData\fP & legendData) const\fC [protected]\fP, \fC [virtual]\fP"
  197. .PP
  198. Create a widget to be inserted into the legend\&. The default implementation returns a \fBQwtLegendLabel\fP\&.
  199. .PP
  200. \fBParameters\fP
  201. .RS 4
  202. \fIlegendData\fP Attributes of the legend entry
  203. .RE
  204. .PP
  205. \fBReturns\fP
  206. .RS 4
  207. Widget representing data on the legend
  208. .RE
  209. .PP
  210. \fBNote\fP
  211. .RS 4
  212. \fBupdateWidget()\fP will called soon after \fBcreateWidget()\fP with the same attributes\&.
  213. .RE
  214. .PP
  215. .SS "\fBQwtLegendData::Mode\fP QwtLegend::defaultItemMode () const"
  216. .PP
  217. \fBReturns\fP
  218. .RS 4
  219. Default item mode
  220. .RE
  221. .PP
  222. \fBSee also\fP
  223. .RS 4
  224. \fBsetDefaultItemMode()\fP
  225. .RE
  226. .PP
  227. .SS "bool QwtLegend::eventFilter (QObject * object, QEvent * event)\fC [virtual]\fP"
  228. Handle QEvent::ChildRemoved andQEvent::LayoutRequest events for the \fBcontentsWidget()\fP\&.
  229. .PP
  230. \fBParameters\fP
  231. .RS 4
  232. \fIobject\fP Object to be filtered
  233. .br
  234. \fIevent\fP Event
  235. .RE
  236. .PP
  237. \fBReturns\fP
  238. .RS 4
  239. Forwarded to QwtAbstractLegend::eventFilter()
  240. .RE
  241. .PP
  242. .SS "int QwtLegend::heightForWidth (int width) const\fC [virtual]\fP"
  243. .PP
  244. \fBReturns\fP
  245. .RS 4
  246. The preferred height, for a width\&.
  247. .RE
  248. .PP
  249. \fBParameters\fP
  250. .RS 4
  251. \fIwidth\fP Width
  252. .RE
  253. .PP
  254. .SS "QScrollBar * QwtLegend::horizontalScrollBar () const"
  255. .PP
  256. \fBReturns\fP
  257. .RS 4
  258. Horizontal scrollbar
  259. .RE
  260. .PP
  261. \fBSee also\fP
  262. .RS 4
  263. \fBverticalScrollBar()\fP
  264. .RE
  265. .PP
  266. .SS "bool QwtLegend::isEmpty () const\fC [virtual]\fP"
  267. .PP
  268. \fBReturns\fP
  269. .RS 4
  270. True, when no item is inserted
  271. .RE
  272. .PP
  273. .PP
  274. Implements \fBQwtAbstractLegend\fP\&.
  275. .SS "void QwtLegend::itemChecked (bool on)\fC [protected]\fP, \fC [slot]\fP"
  276. Called internally when the legend has been checked Emits a \fBchecked()\fP signal\&.
  277. .SS "void QwtLegend::itemClicked ()\fC [protected]\fP, \fC [slot]\fP"
  278. Called internally when the legend has been clicked on\&. Emits a \fBclicked()\fP signal\&.
  279. .SS "QVariant QwtLegend::itemInfo (const QWidget * widget) const"
  280. Find the item that is associated to a widget
  281. .PP
  282. \fBParameters\fP
  283. .RS 4
  284. \fIwidget\fP Widget on the legend
  285. .RE
  286. .PP
  287. \fBReturns\fP
  288. .RS 4
  289. Associated item info
  290. .RE
  291. .PP
  292. \fBSee also\fP
  293. .RS 4
  294. \fBlegendWidget()\fP
  295. .RE
  296. .PP
  297. .SS "QWidget * QwtLegend::legendWidget (const QVariant & itemInfo) const"
  298. .PP
  299. \fBReturns\fP
  300. .RS 4
  301. First widget in the list of widgets associated to an item
  302. .RE
  303. .PP
  304. \fBParameters\fP
  305. .RS 4
  306. \fIitemInfo\fP Info about an item
  307. .RE
  308. .PP
  309. \fBSee also\fP
  310. .RS 4
  311. \fBitemInfo()\fP, \fBQwtPlot::itemToInfo()\fP
  312. .RE
  313. .PP
  314. \fBNote\fP
  315. .RS 4
  316. Almost all types of items have only one widget
  317. .RE
  318. .PP
  319. .SS "QList< QWidget * > QwtLegend::legendWidgets (const QVariant & itemInfo) const"
  320. .PP
  321. \fBReturns\fP
  322. .RS 4
  323. List of widgets associated to a item
  324. .RE
  325. .PP
  326. \fBParameters\fP
  327. .RS 4
  328. \fIitemInfo\fP Info about an item
  329. .RE
  330. .PP
  331. \fBSee also\fP
  332. .RS 4
  333. \fBlegendWidget()\fP, \fBitemInfo()\fP, \fBQwtPlot::itemToInfo()\fP
  334. .RE
  335. .PP
  336. .SS "uint QwtLegend::maxColumns () const"
  337. .PP
  338. \fBReturns\fP
  339. .RS 4
  340. Maximum number of entries in a row
  341. .RE
  342. .PP
  343. \fBSee also\fP
  344. .RS 4
  345. \fBsetMaxColumns()\fP, \fBQwtDynGridLayout::maxColumns()\fP
  346. .RE
  347. .PP
  348. .SS "void QwtLegend::renderItem (QPainter * painter, const QWidget * widget, const QRectF & rect, bool fillBackground) const\fC [virtual]\fP"
  349. Render a legend entry into a given rectangle\&.
  350. .PP
  351. \fBParameters\fP
  352. .RS 4
  353. \fIpainter\fP Painter
  354. .br
  355. \fIwidget\fP Widget representing a legend entry
  356. .br
  357. \fIrect\fP Bounding rectangle
  358. .br
  359. \fIfillBackground\fP When true, fill rect with the widget background
  360. .RE
  361. .PP
  362. \fBNote\fP
  363. .RS 4
  364. When widget is not derived from \fBQwtLegendLabel\fP renderItem does nothing beside the background
  365. .RE
  366. .PP
  367. .SS "void QwtLegend::renderLegend (QPainter * painter, const QRectF & rect, bool fillBackground) const\fC [virtual]\fP"
  368. Render the legend into a given rectangle\&.
  369. .PP
  370. \fBParameters\fP
  371. .RS 4
  372. \fIpainter\fP Painter
  373. .br
  374. \fIrect\fP Bounding rectangle
  375. .br
  376. \fIfillBackground\fP When true, fill rect with the widget background
  377. .RE
  378. .PP
  379. \fBSee also\fP
  380. .RS 4
  381. \fBrenderLegend()\fP is used by \fBQwtPlotRenderer\fP - not by \fBQwtLegend\fP itself
  382. .RE
  383. .PP
  384. .PP
  385. Implements \fBQwtAbstractLegend\fP\&.
  386. .SS "int QwtLegend::scrollExtent (Qt::Orientation orientation) const\fC [virtual]\fP"
  387. Return the extent, that is needed for the scrollbars
  388. .PP
  389. \fBParameters\fP
  390. .RS 4
  391. \fIorientation\fP Orientation
  392. .RE
  393. .PP
  394. \fBReturns\fP
  395. .RS 4
  396. The width of the vertical scrollbar for Qt::Horizontal and v\&.v\&.
  397. .RE
  398. .PP
  399. .PP
  400. Reimplemented from \fBQwtAbstractLegend\fP\&.
  401. .SS "void QwtLegend::setDefaultItemMode (\fBQwtLegendData::Mode\fP mode)"
  402. .PP
  403. Set the default mode for legend labels\&. Legend labels will be constructed according to the attributes in a \fBQwtLegendData\fP object\&. When it doesn't contain a value for the QwtLegendData::ModeRole the label will be initialized with the default mode of the legend\&.
  404. .PP
  405. \fBParameters\fP
  406. .RS 4
  407. \fImode\fP Default item mode
  408. .RE
  409. .PP
  410. \fBSee also\fP
  411. .RS 4
  412. itemMode(), \fBQwtLegendData::value()\fP, \fBQwtPlotItem::legendData()\fP
  413. .RE
  414. .PP
  415. \fBNote\fP
  416. .RS 4
  417. Changing the mode doesn't have any effect on existing labels\&.
  418. .RE
  419. .PP
  420. .SS "void QwtLegend::setMaxColumns (uint numColums)"
  421. .PP
  422. Set the maximum number of entries in a row\&. F\&.e when the maximum is set to 1 all items are aligned vertically\&. 0 means unlimited
  423. .PP
  424. \fBParameters\fP
  425. .RS 4
  426. \fInumColums\fP Maximum number of entries in a row
  427. .RE
  428. .PP
  429. \fBSee also\fP
  430. .RS 4
  431. \fBmaxColumns()\fP, \fBQwtDynGridLayout::setMaxColumns()\fP
  432. .RE
  433. .PP
  434. .SS "void QwtLegend::updateLegend (const QVariant & itemInfo, const QList< \fBQwtLegendData\fP > & legendData)\fC [virtual]\fP, \fC [slot]\fP"
  435. .PP
  436. Update the entries for an item\&.
  437. .PP
  438. \fBParameters\fP
  439. .RS 4
  440. \fIitemInfo\fP Info for an item
  441. .br
  442. \fIlegendData\fP List of legend entry attributes for the item
  443. .RE
  444. .PP
  445. .SS "void QwtLegend::updateWidget (QWidget * widget, const \fBQwtLegendData\fP & legendData)\fC [protected]\fP, \fC [virtual]\fP"
  446. .PP
  447. Update the widget\&.
  448. .PP
  449. \fBParameters\fP
  450. .RS 4
  451. \fIwidget\fP Usually a \fBQwtLegendLabel\fP
  452. .br
  453. \fIlegendData\fP Attributes to be displayed
  454. .RE
  455. .PP
  456. \fBSee also\fP
  457. .RS 4
  458. \fBcreateWidget()\fP
  459. .RE
  460. .PP
  461. \fBNote\fP
  462. .RS 4
  463. When widget is no \fBQwtLegendLabel\fP \fBupdateWidget()\fP does nothing\&.
  464. .RE
  465. .PP
  466. .SS "QScrollBar * QwtLegend::verticalScrollBar () const"
  467. .PP
  468. \fBReturns\fP
  469. .RS 4
  470. Vertical scrollbar
  471. .RE
  472. .PP
  473. \fBSee also\fP
  474. .RS 4
  475. \fBhorizontalScrollBar()\fP
  476. .RE
  477. .PP
  478. .SH "Author"
  479. .PP
  480. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.