1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502 |
- /***************************************************************************
- ** **
- ** QCustomPlot, an easy to use, modern plotting widget for Qt **
- ** Copyright (C) 2011, 2012, 2013 Emanuel Eichhammer **
- ** **
- ** This program is free software: you can redistribute it and/or modify **
- ** it under the terms of the GNU General Public License as published by **
- ** the Free Software Foundation, either version 3 of the License, or **
- ** (at your option) any later version. **
- ** **
- ** This program is distributed in the hope that it will be useful, **
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
- ** GNU General Public License for more details. **
- ** **
- ** You should have received a copy of the GNU General Public License **
- ** along with this program. If not, see http://www.gnu.org/licenses/. **
- ** **
- ****************************************************************************
- ** Author: Emanuel Eichhammer **
- ** Website/Contact: http://www.qcustomplot.com/ **
- ** Date: 04.11.13 **
- ** Version: 1.1.0 **
- ****************************************************************************/
-
- #ifndef QCUSTOMPLOT_H
- #define QCUSTOMPLOT_H
-
- #include <QObject>
- #include <QPointer>
- #include <QWidget>
- #include <QPainter>
- #include <QPaintEvent>
- #include <QMouseEvent>
- #include <QPixmap>
- #include <QVector>
- #include <QString>
- #include <QDateTime>
- #include <QMultiMap>
- #include <QFlags>
- #include <QDebug>
- #include <QVector2D>
- #include <QStack>
- #include <QCache>
- #include <QMargins>
- #include <qmath.h>
- #include <limits>
- #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- # include <qnumeric.h>
- # include <QPrinter>
- #else
- # include <QtNumeric>
- # include <QtPrintSupport>
- #endif
-
- class QCPPainter;
- class QCustomPlot;
- class QCPLayerable;
- class QCPLayoutElement;
- class QCPLayout;
- class QCPAxis;
- class QCPAxisRect;
- class QCPAbstractPlottable;
- class QCPGraph;
- class QCPAbstractItem;
- class QCPItemPosition;
- class QCPLayer;
- class QCPPlotTitle;
- class QCPLegend;
- class QCPAbstractLegendItem;
-
-
- /*! \file */
-
-
- // decl definitions for shared library compilation/usage:
- #if defined(QCUSTOMPLOT_COMPILE_LIBRARY)
- # define QCP_LIB_DECL Q_DECL_EXPORT
- #elif defined(QCUSTOMPLOT_USE_LIBRARY)
- # define QCP_LIB_DECL Q_DECL_IMPORT
- #else
- # define QCP_LIB_DECL
- #endif
-
- /*!
- //~English
- The QCP Namespace contains general enums and QFlags used throughout the QCustomPlot library
- //~Spanish
- El QCP Namespace contiene enumeradores y QFlags que se usan en toda la libreria QCustomPlot
- */
- namespace QCP
- {
- /*!
- //~English
- Defines the sides of a rectangular entity to which margins can be applied.
- //~Spanish
- Define los lados de algun rectangulo a los que se le puede anadir margenes.
- \see QCPLayoutElement::setAutoMargins, QCPAxisRect::setAutoMargins
- */
- enum MarginSide { msLeft = 0x01 ///< <tt>0x01</tt> left margin
- ,msRight = 0x02 ///< <tt>0x02</tt> right margin
- ,msTop = 0x04 ///< <tt>0x04</tt> top margin
- ,msBottom = 0x08 ///< <tt>0x08</tt> bottom margin
- ,msAll = 0xFF ///< <tt>0xFF</tt> all margins
- ,msNone = 0x00 ///< <tt>0x00</tt> no margin
- };
- Q_DECLARE_FLAGS(MarginSides, MarginSide)
-
- /*!
- //~English
- Defines what objects of a plot can be forcibly drawn antialiased/not antialiased.
- If an object is neither forcibly drawn antialiased nor forcibly drawn not antialiased,
- it is up to the respective element how it is drawn. Typically it provides a \a setAntialiased function for this.
- //~Spanish
- Define qué objetos de un gráfico se pueden forzar a dibujar antialiasados o no antialiasados.
-
- \c AntialiasedElements is a flag of or-combined elements of this enum type.
-
- \see QCustomPlot::setAntialiasedElements, QCustomPlot::setNotAntialiasedElements
- */
- enum AntialiasedElement { aeAxes = 0x0001 ///< <tt>0x0001</tt> Axis base line and tick marks
- /// Linea base del eje y marcas de registro
- ,aeGrid = 0x0002 ///< <tt>0x0002</tt> Grid lines
- /// Lineas de la cuadrícula
- ,aeSubGrid = 0x0004 ///< <tt>0x0004</tt> Sub grid lines
- /// Sub lineas de la cuadrícula
- ,aeLegend = 0x0008 ///< <tt>0x0008</tt> Legend box
- /// Caja de leyenda
- ,aeLegendItems = 0x0010 ///< <tt>0x0010</tt> Legend items
- /// Articulos de leyenda
- ,aePlottables = 0x0020 ///< <tt>0x0020</tt> Main lines of plottables (excluding error bars, see element \ref aeErrorBars)
- /// Lineas principales de los "plottables" (excluyendo las barras de errores, ver elemento \ref aeErrorBars)
- ,aeItems = 0x0040 ///< <tt>0x0040</tt> Main lines of items
- /// Lineas principales de los articulos
- ,aeScatters = 0x0080 ///< <tt>0x0080</tt> Scatter symbols of plottables (excluding scatter symbols of type ssPixmap)
- /// Simbolos de dispersion de los "plottables" (excluyendo los simbolos de dispersion de tipo ssPixmap)
- ,aeErrorBars = 0x0100 ///< <tt>0x0100</tt> Error bars
- /// Barras de error
- ,aeFills = 0x0200 ///< <tt>0x0200</tt> Borders of fills (e.g. under or between graphs)
- /// Bordes de rellenos (e. g. debajo o entre rellenos)
- ,aeZeroLine = 0x0400 ///< <tt>0x0400</tt> Zero-lines, see \ref QCPGrid::setZeroLinePen
- /// Lineas Cero, ver \ref QCPGrid::setZeroLinePen
- ,aeAll = 0xFFFF ///< <tt>0xFFFF</tt> All elements
- /// Todos los elementos
- ,aeNone = 0x0000 ///< <tt>0x0000</tt> No elements
- /// Ningun elemento
- };
- Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
-
- /*!
- //~English
- Defines plotting hints that control various aspects of the quality and speed of plotting.
- //~Spanish
- Define consejos de trazado que controlan varios aspectos de calidad y rapidez del trazado.
-
- \see QCustomPlot::setPlottingHints
- */
- enum PlottingHint { phNone = 0x000 ///< <tt>0x000</tt> No hints are set
- /// No hay consejos establecidos.
- ,phFastPolylines = 0x001 ///< <tt>0x001</tt> Graph/Curve lines are drawn with a faster method. This reduces the quality
- /// especially of the line segment joins. (Only relevant for solid line pens.)
-
- /// Lineas de graficas o curvas se dibujan con un metodo mas rapido.
- /// Esto reduce la calidad especialmente de las uniones de los segmentos. (solo es relevante para plumas de lineas gruesas)
-
- ,phForceRepaint = 0x002 ///< <tt>0x002</tt> causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called. This is set by default
- /// on Windows-Systems to prevent the plot from freezing on fast consecutive replots (e.g. user drags ranges with mouse).
- /// causa un repaint () inmediato en vez de un update() suave cuando QCustomPlot::replot() es invocado. Esto esta establecido
- /// por defecto en el Sistema de Windows para evitar que el grafico se congele cuando ocurren consecutivas y rapidas repeticiones de trazados.
- ,phCacheLabels = 0x004 ///< <tt>0x004</tt> axis (tick) labels will be cached as pixmaps, increasing replot performance.
- /// Etiquetas de los ejes se almacenaran en el cache como pixmaps, aumentando el rendimiento de las repeticiones de trazados.
- };
- Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
-
- /*!
- //~English
- Defines the mouse interactions possible with QCustomPlot.
- //~Spanish
- Define las interacciones posibles del mouse con QCustomPlot
-
- //~English
- \c Interactions is a flag of or-combined elements of this enum type.
- //~Spanish
- \c Interaccion es una bandera de elementos o elementos combinados del tipo enum.
- \see QCustomPlot::setInteractions
- */
- enum Interaction { iRangeDrag = 0x001 ///< <tt>0x001</tt> Axis ranges are draggable (see \ref QCPAxisRect::setRangeDrag, \ref QCPAxisRect::setRangeDragAxes)
- /// Rangos del eje son arrastrables (ver \ref QCPAxisRect::setRangeDrag, \ref QCPAxisRect::setRangeDragAxes)
- ,iRangeZoom = 0x002 ///< <tt>0x002</tt> Axis ranges are zoomable with the mouse wheel (see \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeZoomAxes)
- /// Los rangos del eje se les puede enfocar usando el mouse wheel (ver \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeZoomAxes)
- ,iMultiSelect = 0x004 ///< <tt>0x004</tt> The user can select multiple objects by holding the modifier set by \ref QCustomPlot::setMultiSelectModifier while clicking
- /// El usuario puede seleccionar varios objetos sosteniendo el conjunto de modificadores establecido por \ref QCustomPlot::setMultiSelectModifier al marcarse.
- ,iSelectPlottables = 0x008 ///< <tt>0x008</tt> Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable)
- /// Plottables se pueden seleccionar
- ,iSelectAxes = 0x010 ///< <tt>0x010</tt> Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
- /// Los ejes se pueden seleccionar
- ,iSelectLegend = 0x020 ///< <tt>0x020</tt> Legends are selectable (or their child items, see QCPLegend::setSelectableParts)
- /// Las leyendas se pueden seleccionar (o sus articulos hijos, ver QCPLegend::setSelectableParts)
- ,iSelectItems = 0x040 ///< <tt>0x040</tt> Items are selectable (Rectangles, Arrows, Textitems, etc. see \ref QCPAbstractItem)
- /// Los articulos se pueden seleccionar
- ,iSelectOther = 0x080 ///< <tt>0x080</tt> All other objects are selectable (e.g. your own derived layerables, the plot title,...)
- /// Todos los demas objetos se pueden seleccionar
- };
- Q_DECLARE_FLAGS(Interactions, Interaction)
-
- /*! \internal
-
- //~English
- Returns whether the specified \a value is considered an invalid data value for plottables (i.e.
- is \e nan or \e +/-inf). This function is used to check data validity upon replots, when the
- compiler flag \c QCUSTOMPLOT_CHECK_DATA is set.
- //~Spanish
- Devuelve si encuentra que el valor especifico es considerado un valor invalido de data para plottables.
- (i.e. es \e nan o \e +/-inf). Esta funcion es usada para verificar la validez de data sobre replots,
- cuando la bandera de compilar esta lista.
- */
- inline bool isInvalidData(double value)
- {
- return qIsNaN(value) || qIsInf(value);
- }
-
- /*! \internal
- \overload
- //~English
- Checks two arguments instead of one.
- //~Spanish
- Verifica dos argumentos en vez de uno.
- */
- inline bool isInvalidData(double value1, double value2)
- {
- return isInvalidData(value1) || isInvalidData(value2);
- }
-
- /*! \internal
- //~English
- Sets the specified \a side of \a margins to \a value
- //~Spanish
- Establece los lados especificos de margenes a un valor.
- \see getMarginValue
- */
- inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
- {
- switch (side)
- {
- case QCP::msLeft: margins.setLeft(value); break;
- case QCP::msRight: margins.setRight(value); break;
- case QCP::msTop: margins.setTop(value); break;
- case QCP::msBottom: margins.setBottom(value); break;
- case QCP::msAll: margins = QMargins(value, value, value, value); break;
- default: break;
- }
- }
-
- /*! \internal
- //~English
- Returns the value of the specified \a side of \a margins. If \a side is \ref QCP::msNone or
- \ref QCP::msAll, returns 0.
- //~Spanish
- Devuelve el valor del lado especifico de un margen. Si el lado es QCP::msNone o QCP::msAll, devuelve 0.
- \see setMarginValue
- */
- inline int getMarginValue(const QMargins &margins, QCP::MarginSide side)
- {
- switch (side)
- {
- case QCP::msLeft: return margins.left();
- case QCP::msRight: return margins.right();
- case QCP::msTop: return margins.top();
- case QCP::msBottom: return margins.bottom();
- default: break;
- }
- return 0;
- }
-
- } // end of namespace QCP
- // final del QCP namespace
-
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
-
-
- class QCP_LIB_DECL QCPScatterStyle
- {
- Q_GADGET
- public:
- /*!
- //~English
- Defines the shape used for scatter points.
-
- On plottables/items that draw scatters, the sizes of these visualizations (with exception of
- \ref ssDot and \ref ssPixmap) can be controlled with the \ref setSize function. Scatters are
- drawn with the pen and brush specified with \ref setPen and \ref setBrush.
- //~Spanish
- Define la figura usada para los puntos dispersados.
-
- En plottables/items que dibujan disperados, los tamanos de estas visualizaciones se pueden controlar
- con la funcion setSize. Los dispersados se dibujan con pluma y cepillo especificados con setPen y setBrush.
- */
- Q_ENUMS(ScatterShape)
- enum ScatterShape { ssNone ///< no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines)
- ///< ningun simbolo dispersado esta dibujado
- ,ssDot ///< \enumimage {ssDot.png} a single pixel (use \ref ssDisc or \ref ssCircle if you want a round shape with a certain radius)
- ///< un solo pixel (use \ref ssDisc o \ref ssCircle si quieres una figura redonda con un radio)
- ,ssCross ///< \enumimage {ssCross.png} a cross
- ///< una cruz
- ,ssPlus ///< \enumimage{ssPlus.png} a plus
- ///< una suma
- ,ssCircle ///< \enumimage{ssCircle.png} a circle
- ///< un circulo
- ,ssDisc ///< \enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle)
- ///< un circulo relleno del color de la pluma (no del cepillo como en ssCircle)
- ,ssSquare ///< \enumimage{ssSquare.png} a square
- ///< un cuadrado
- ,ssDiamond ///< \enumimage{ssDiamond.png} a diamond
- ///< un diamante
- ,ssStar ///< \enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus
- ///< una estrella con ocho brazos, creado por una combinacion de sumas y cruces
- ,ssTriangle ///< \enumimage{ssTriangle.png} an equilateral triangle, standing on baseline
- ///< un triangulo equilatero, parado en una linea base
- ,ssTriangleInverted ///< \enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner
- ///< un triangulo equilatero, parado en una esquina
- ,ssCrossSquare ///< \enumimage{ssCrossSquare.png} a square with a cross inside
- ///< un cuadrado con una cruz adentro
- ,ssPlusSquare ///< \enumimage{ssPlusSquare.png} a square with a plus inside
- /// un cuadrado con una suma adentro
- ,ssCrossCircle ///< \enumimage{ssCrossCircle.png} a circle with a cross inside
- ///< un circulo con una cruz adentro
- ,ssPlusCircle ///< \enumimage{ssPlusCircle.png} a circle with a plus inside
- ///< un circulo con una suma adentro
- ,ssPeace ///< \enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines
- ///< un circulo con una linea vertical y dos lineas diagonales hacia abajo
- ,ssPixmap ///< a custom pixmap specified by \ref setPixmap, centered on the data point coordinates
- ///< un pixmap personalizado especificado por setPixmap, centrado en las coordenadas de los puntos de datos.
- ,ssCustom ///< custom painter operations are performed per scatter (As QPainterPath, see \ref setCustomPath)
- ///< operaciones de pintador personalizadas son presentadas por dispersado
- };
-
- QCPScatterStyle();
- QCPScatterStyle(ScatterShape shape, double size=6);
- QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
- QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);
- QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);
- QCPScatterStyle(const QPixmap &pixmap);
- QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);
-
- // getters:
- // accesores:
- double size() const { return mSize; }
- ScatterShape shape() const { return mShape; }
- QPen pen() const { return mPen; }
- QBrush brush() const { return mBrush; }
- QPixmap pixmap() const { return mPixmap; }
- QPainterPath customPath() const { return mCustomPath; }
-
- // setters:
- // modificadores:
- void setSize(double size);
- void setShape(ScatterShape shape);
- void setPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setPixmap(const QPixmap &pixmap);
- void setCustomPath(const QPainterPath &customPath);
-
- // non-property methods:
- // metodos que no requieren propiedades:
- bool isNone() const { return mShape == ssNone; }
- bool isPenDefined() const { return mPenDefined; }
- void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
- void drawShape(QCPPainter *painter, QPointF pos) const;
- void drawShape(QCPPainter *painter, double x, double y) const;
-
- protected:
- // property members:
- // miembros de propiedades:
- double mSize;
- ScatterShape mShape;
- QPen mPen;
- QBrush mBrush;
- QPixmap mPixmap;
- QPainterPath mCustomPath;
-
- // non-property members:
- // miembros que no tienen propiedades:
- bool mPenDefined;
- };
- Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);
-
-
- class QCP_LIB_DECL QCPPainter : public QPainter
- {
- Q_GADGET
- public:
- /*!
- //~English
- Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds,
- depending on whether they are wanted on the respective output device.
- //~Spanish
- Define modos especiales de los que el pintador podra usar. Ellos habilitan o inhabilitan algunos subconjuntos de caracteristicas,
- arreglos, soluciones, dependiendo si son queridos en sus respectivos dispositivos de pantalla.
- */
- enum PainterMode {pmDefault = 0x00 ///< <tt>0x00</tt> Default mode for painting on screen devices
- ///< Modo por defecto para pintar en dispositivos de pantalla
- ,pmVectorized = 0x01 ///< <tt>0x01</tt> Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fixes.
- ///< Modo para la pintura vectorizada. Por ejemplo, esto evita algunos arreglos antialisados.
- ,pmNoCaching = 0x02 ///< <tt>0x02</tt> Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels
- ///< Modo para todo tipo de exportaciones. Por ejemplo, esto evita el uso de las etiquetas de pixmap guardados en el cache.
- ,pmNonCosmetic = 0x04 ///< <tt>0x04</tt> Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.)
- ///< Convierte el grosor del pluma de 0 a 1, e inhabilita las plumas cosmeticas. (Una pluma cosmetica siempre dibujan con grosor de 1 pixel en el vector)
-
- };
- Q_FLAGS(PainterMode PainterModes)
- Q_DECLARE_FLAGS(PainterModes, PainterMode)
-
- QCPPainter();
- QCPPainter(QPaintDevice *device);
- ~QCPPainter();
-
- // getters:
- // accesores:
- bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
- PainterModes modes() const { return mModes; }
-
- // setters:
- // modificadores:
- void setAntialiasing(bool enabled);
- void setMode(PainterMode mode, bool enabled=true);
- void setModes(PainterModes modes);
-
- // methods hiding non-virtual base class functions (QPainter bug workarounds):
- // metodos que esconden funciones de la clase base no virtuales
- bool begin(QPaintDevice *device);
- void setPen(const QPen &pen);
- void setPen(const QColor &color);
- void setPen(Qt::PenStyle penStyle);
- void drawLine(const QLineF &line);
- void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}
- void save();
- void restore();
-
- // non-virtual methods:
- // metodos no virtuales:
- void makeNonCosmetic();
-
- protected:
- // property members:
- // miembros con propiedad:
- PainterModes mModes;
- bool mIsAntialiasing;
-
- // non-property members:
- // metodos que no tienen propiedades:
- QStack<bool> mAntialiasingStack;
- };
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
-
-
- class QCP_LIB_DECL QCPLayer : public QObject
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(int index READ index)
- Q_PROPERTY(QList<QCPLayerable*> children READ children)
- /// \endcond
- public:
- QCPLayer(QCustomPlot* parentPlot, const QString &layerName);
- ~QCPLayer();
-
- // getters:
- // accesores:
- QCustomPlot *parentPlot() const { return mParentPlot; }
- QString name() const { return mName; }
- int index() const { return mIndex; }
- QList<QCPLayerable*> children() const { return mChildren; }
-
- protected:
- // property members:
- // miembros con propiedades:
- QCustomPlot *mParentPlot;
- QString mName;
- int mIndex;
- QList<QCPLayerable*> mChildren;
-
- // non-virtual methods:
- // metodos virtuales:
- void addChild(QCPLayerable *layerable, bool prepend);
- void removeChild(QCPLayerable *layerable);
-
- private:
- Q_DISABLE_COPY(QCPLayer)
-
- friend class QCustomPlot;
- friend class QCPLayerable;
- };
-
- class QCP_LIB_DECL QCPLayerable : public QObject
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(bool visible READ visible WRITE setVisible)
- Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
- Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)
- Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer)
- Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
- /// \endcond
- public:
- QCPLayerable(QCustomPlot *plot, QString targetLayer="", QCPLayerable *parentLayerable=0);
- ~QCPLayerable();
-
- // getters:
- // accesores:
- bool visible() const { return mVisible; }
- QCustomPlot *parentPlot() const { return mParentPlot; }
- QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
- QCPLayer *layer() const { return mLayer; }
- bool antialiased() const { return mAntialiased; }
-
- // setters:
- // modificadores:
- void setVisible(bool on);
- bool setLayer(QCPLayer *layer);
- bool setLayer(const QString &layerName);
- void setAntialiased(bool enabled);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- // non-property methods:
- // metodos que no tienen propiedades:
- bool realVisibility() const;
-
- protected:
- // property members:
- // miembros con propiedades:
- bool mVisible;
- QCustomPlot *mParentPlot;
- QPointer<QCPLayerable> mParentLayerable;
- QCPLayer *mLayer;
- bool mAntialiased;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void parentPlotInitialized(QCustomPlot *parentPlot);
- virtual QCP::Interaction selectionCategory() const;
- virtual QRect clipRect() const;
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
- virtual void draw(QCPPainter *painter) = 0;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- void initializeParentPlot(QCustomPlot *parentPlot);
- void setParentLayerable(QCPLayerable* parentLayerable);
- bool moveToLayer(QCPLayer *layer, bool prepend);
- void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;
-
- private:
- Q_DISABLE_COPY(QCPLayerable)
-
- friend class QCustomPlot;
- friend class QCPAxisRect;
- };
-
-
- class QCP_LIB_DECL QCPRange
- {
- public:
- double lower, upper;
-
- QCPRange();
- QCPRange(double lower, double upper);
-
- double size() const;
- double center() const;
- void normalize();
- void expand(const QCPRange &otherRange);
- QCPRange expanded(const QCPRange &otherRange) const;
- QCPRange sanitizedForLogScale() const;
- QCPRange sanitizedForLinScale() const;
- bool contains(double value) const;
-
- static bool validRange(double lower, double upper);
- static bool validRange(const QCPRange &range);
- static const double minRange; //1e-280;
- static const double maxRange; //1e280;
- };
- Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
-
-
- class QCP_LIB_DECL QCPMarginGroup : public QObject
- {
- Q_OBJECT
- public:
- QCPMarginGroup(QCustomPlot *parentPlot);
- ~QCPMarginGroup();
-
- // non-virtual methods:
- // metodos no virtuales:
- QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }
- bool isEmpty() const;
- void clear();
-
- protected:
- // non-property members:
- // miembros que no tienen propiedades:
- QCustomPlot *mParentPlot;
- QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
-
- // non-virtual methods:
- // metodos no virtuales:
- int commonMargin(QCP::MarginSide side) const;
- void addChild(QCP::MarginSide side, QCPLayoutElement *element);
- void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
-
- private:
- Q_DISABLE_COPY(QCPMarginGroup)
-
- friend class QCPLayoutElement;
- };
-
-
- class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QCPLayout* layout READ layout)
- Q_PROPERTY(QRect rect READ rect)
- Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
- Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
- Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
- Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
- Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
- /// \endcond
- public:
- explicit QCPLayoutElement(QCustomPlot *parentPlot=0);
- virtual ~QCPLayoutElement();
-
- // getters:
- // accesores:
- QCPLayout *layout() const { return mParentLayout; }
- QRect rect() const { return mRect; }
- QRect outerRect() const { return mOuterRect; }
- QMargins margins() const { return mMargins; }
- QMargins minimumMargins() const { return mMinimumMargins; }
- QCP::MarginSides autoMargins() const { return mAutoMargins; }
- QSize minimumSize() const { return mMinimumSize; }
- QSize maximumSize() const { return mMaximumSize; }
- QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*)0); }
- QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }
-
- // setters:
- // modificadores:
- void setOuterRect(const QRect &rect);
- void setMargins(const QMargins &margins);
- void setMinimumMargins(const QMargins &margins);
- void setAutoMargins(QCP::MarginSides sides);
- void setMinimumSize(const QSize &size);
- void setMinimumSize(int width, int height);
- void setMaximumSize(const QSize &size);
- void setMaximumSize(int width, int height);
- void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void update();
- virtual QSize minimumSizeHint() const;
- virtual QSize maximumSizeHint() const;
- virtual QList<QCPLayoutElement*> elements(bool recursive) const;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- protected:
- // property members:
- // miembros que tienen propiedades:
- QCPLayout *mParentLayout;
- QSize mMinimumSize, mMaximumSize;
- QRect mRect, mOuterRect;
- QMargins mMargins, mMinimumMargins;
- QCP::MarginSides mAutoMargins;
- QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual int calculateAutoMargin(QCP::MarginSide side);
- // events:
- // eventos:
- virtual void mousePressEvent(QMouseEvent *event) {Q_UNUSED(event)}
- virtual void mouseMoveEvent(QMouseEvent *event) {Q_UNUSED(event)}
- virtual void mouseReleaseEvent(QMouseEvent *event) {Q_UNUSED(event)}
- virtual void mouseDoubleClickEvent(QMouseEvent *event) {Q_UNUSED(event)}
- virtual void wheelEvent(QWheelEvent *event) {Q_UNUSED(event)}
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const { Q_UNUSED(painter) }
- virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }
- virtual void parentPlotInitialized(QCustomPlot *parentPlot);
-
- private:
- Q_DISABLE_COPY(QCPLayoutElement)
-
- friend class QCustomPlot;
- friend class QCPLayout;
- friend class QCPMarginGroup;
- };
-
-
- class QCP_LIB_DECL QCPLayout : public QCPLayoutElement
- {
- Q_OBJECT
- public:
- explicit QCPLayout();
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void update();
- virtual QList<QCPLayoutElement*> elements(bool recursive) const;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual int elementCount() const = 0;
- virtual QCPLayoutElement* elementAt(int index) const = 0;
- virtual QCPLayoutElement* takeAt(int index) = 0;
- virtual bool take(QCPLayoutElement* element) = 0;
- virtual void simplify();
-
- // non-virtual methods:
- // metodos no virtuales:
- bool removeAt(int index);
- bool remove(QCPLayoutElement* element);
- void clear();
-
- protected:
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void updateLayout();
-
- // non-virtual methods:
- // metodos no virtuales:
- void sizeConstraintsChanged() const;
- void adoptElement(QCPLayoutElement *el);
- void releaseElement(QCPLayoutElement *el);
- QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;
-
- private:
- Q_DISABLE_COPY(QCPLayout)
- friend class QCPLayoutElement;
- };
-
-
- class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(int rowCount READ rowCount)
- Q_PROPERTY(int columnCount READ columnCount)
- Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
- Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
- Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
- Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
- /// \endcond
- public:
- explicit QCPLayoutGrid();
- virtual ~QCPLayoutGrid();
-
- // getters:
- // accesores:
- int rowCount() const;
- int columnCount() const;
- QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
- QList<double> rowStretchFactors() const { return mRowStretchFactors; }
- int columnSpacing() const { return mColumnSpacing; }
- int rowSpacing() const { return mRowSpacing; }
-
- // setters:
- // modificadores:
- void setColumnStretchFactor(int column, double factor);
- void setColumnStretchFactors(const QList<double> &factors);
- void setRowStretchFactor(int row, double factor);
- void setRowStretchFactors(const QList<double> &factors);
- void setColumnSpacing(int pixels);
- void setRowSpacing(int pixels);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void updateLayout();
- virtual int elementCount() const;
- virtual QCPLayoutElement* elementAt(int index) const;
- virtual QCPLayoutElement* takeAt(int index);
- virtual bool take(QCPLayoutElement* element);
- virtual QList<QCPLayoutElement*> elements(bool recursive) const;
- virtual void simplify();
- virtual QSize minimumSizeHint() const;
- virtual QSize maximumSizeHint() const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QCPLayoutElement *element(int row, int column) const;
- bool addElement(int row, int column, QCPLayoutElement *element);
- bool hasElement(int row, int column);
- void expandTo(int newRowCount, int newColumnCount);
- void insertRow(int newIndex);
- void insertColumn(int newIndex);
-
- protected:
- // property members:
- // miembros con propiedades:
- QList<QList<QCPLayoutElement*> > mElements;
- QList<double> mColumnStretchFactors;
- QList<double> mRowStretchFactors;
- int mColumnSpacing, mRowSpacing;
-
- // non-virtual methods:
- // metodos no virtuales:
- void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;
- void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;
-
- private:
- Q_DISABLE_COPY(QCPLayoutGrid)
- };
-
-
- class QCP_LIB_DECL QCPLayoutInset : public QCPLayout
- {
- Q_OBJECT
- public:
- /*!
- //~English
- Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.
- //~Spanish
- Define cómo se maneja la ubicación y el tamaño de un determinado elemento en un QCPLayoutInset.
- */
- enum InsetPlacement {ipFree ///< The element may be positioned/sized arbitrarily, see \ref setInsetRect
- ///< El elemento pudiera ser de posicion o tamano arbitraria, ver \ref setInsetRect
- ,ipBorderAligned ///< The element is aligned to one of the layout sides, see \ref setInsetAlignment
- ///< El elemento es alineado a uno de los lados del diseno, ver \ref setInsetAlignment
- };
-
- explicit QCPLayoutInset();
- virtual ~QCPLayoutInset();
-
- // getters:
- // accesores:
- InsetPlacement insetPlacement(int index) const;
- Qt::Alignment insetAlignment(int index) const;
- QRectF insetRect(int index) const;
-
- // setters:
- // modificadores:
- void setInsetPlacement(int index, InsetPlacement placement);
- void setInsetAlignment(int index, Qt::Alignment alignment);
- void setInsetRect(int index, const QRectF &rect);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void updateLayout();
- virtual int elementCount() const;
- virtual QCPLayoutElement* elementAt(int index) const;
- virtual QCPLayoutElement* takeAt(int index);
- virtual bool take(QCPLayoutElement* element);
- virtual void simplify() {}
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
- void addElement(QCPLayoutElement *element, const QRectF &rect);
-
- protected:
- // property members:
- // miembros con propiedades:
- QList<QCPLayoutElement*> mElements;
- QList<InsetPlacement> mInsetPlacement;
- QList<Qt::Alignment> mInsetAlignment;
- QList<QRectF> mInsetRect;
-
- private:
- Q_DISABLE_COPY(QCPLayoutInset)
- };
-
-
- class QCP_LIB_DECL QCPLineEnding
- {
- Q_GADGET
- public:
- /*!
- //~English
- Defines the type of ending decoration for line-like items, e.g. an arrow.
-
- \image html QCPLineEnding.png
-
- The width and length of these decorations can be controlled with the functions \ref setWidth
- and \ref setLength. Some decorations like \ref esDisc, \ref esSquare, \ref esDiamond and \ref esBar only
- support a width, the length property is ignored.
-
- \see QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail
-
- //~Spanish
- Define el tipo decoracion final para los articulos “line-like”, ej. Flecha
-
- El largo y la anchura de estas decoraciones se puede controlar con las funciones setWidth y setLength.
- Algunas decoracion como esDisc, esSquare, esDiamond, y esBar solo sostienen la anchura, ya que el largo es ignorado.
-
- */
- Q_ENUMS(EndingStyle)
- enum EndingStyle { esNone ///< No ending decoration
- ///< Ninguna decoracion final
- ,esFlatArrow ///< A filled arrow head with a straight/flat back (a triangle)
- ///< Una punta de la flecha rellena con una espalda plana y recta
- ,esSpikeArrow ///< A filled arrow head with an indented back
- ///< Una punta de la flecha rellena con una espalada indented
- ,esLineArrow ///< A non-filled arrow head with open back
- ///< Una punta de una flecha sin rellenar con la espalda abierta
- ,esDisc ///< A filled circle
- ///< Un circulo relleno
- ,esSquare ///< A filled square
- ///< Un cuadrado relleno
- ,esDiamond ///< A filled diamond (45° rotated square)
- ///< Un diamante relleno
- ,esBar ///< A bar perpendicular to the line
- ///< Una barrar perpendicular a la linea
- ,esHalfBar ///< A bar perpendicular to the line sticking out to one side
- ///< Una barra perpendicular a la linea que esta sobresaliendo por un lado
- ,esSkewedBar ///< A bar that is skewed (skew controllable via \ref setLength)
- ///< Una barra que esta sesgado
- };
-
- QCPLineEnding();
- QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
-
- // getters:
- // accesores:
- EndingStyle style() const { return mStyle; }
- double width() const { return mWidth; }
- double length() const { return mLength; }
- bool inverted() const { return mInverted; }
-
- // setters:
- // modificadores:
- void setStyle(EndingStyle style);
- void setWidth(double width);
- void setLength(double length);
- void setInverted(bool inverted);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- double boundingDistance() const;
- double realLength() const;
- void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const;
- void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
-
- protected:
- // property members:
- // miembros con propiedades:
- EndingStyle mStyle;
- double mWidth, mLength;
- bool mInverted;
- };
- Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
-
-
- class QCP_LIB_DECL QCPGrid :public QCPLayerable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
- Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
- Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
- Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
- /// \endcond
- public:
- QCPGrid(QCPAxis *parentAxis);
-
- // getters:
- // accesores:
- bool subGridVisible() const { return mSubGridVisible; }
- bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
- bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
- QPen pen() const { return mPen; }
- QPen subGridPen() const { return mSubGridPen; }
- QPen zeroLinePen() const { return mZeroLinePen; }
-
- // setters:
- // modificadores:
- void setSubGridVisible(bool visible);
- void setAntialiasedSubGrid(bool enabled);
- void setAntialiasedZeroLine(bool enabled);
- void setPen(const QPen &pen);
- void setSubGridPen(const QPen &pen);
- void setZeroLinePen(const QPen &pen);
-
- protected:
- // property members:
- // miembros con propiedades:
- bool mSubGridVisible;
- bool mAntialiasedSubGrid, mAntialiasedZeroLine;
- QPen mPen, mSubGridPen, mZeroLinePen;
- // non-property members:
- // miembros que no tienes propiedades:
- QCPAxis *mParentAxis;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter);
-
- // non-virtual methods:
- // metodos no virtuales:
- void drawGridLines(QCPPainter *painter) const;
- void drawSubGridLines(QCPPainter *painter) const;
-
- friend class QCPAxis;
- };
-
-
- class QCP_LIB_DECL QCPAxis : public QCPLayerable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(AxisType axisType READ axisType)
- Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)
- Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType)
- Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
- Q_PROPERTY(QCPRange range READ range WRITE setRange)
- Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
- Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
- Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
- Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
- Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
- Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
- Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
- Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
- Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
- Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
- Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
- Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
- Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
- Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
- Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
- Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
- Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
- Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
- Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)
- Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
- Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
- Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
- Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
- Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
- Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
- Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
- Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
- Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
- Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
- Q_PROPERTY(QString label READ label WRITE setLabel)
- Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
- Q_PROPERTY(int padding READ padding WRITE setPadding)
- Q_PROPERTY(int offset READ offset WRITE setOffset)
- Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts)
- Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts)
- Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
- Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
- Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
- Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
- Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
- Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
- Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
- Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
- Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
- Q_PROPERTY(QCPGrid* grid READ grid)
- /// \endcond
- public:
- /*!
- //~English
- Defines at which side of the axis rect the axis will appear. This also affects how the tick
- marks are drawn, on which side the labels are placed etc.
- //~Spanish
- Define en que lado del eje rect va aparecer el eje. Esto tambien afecta como las marcas de registro
- son dibujadas, en que lado se colocan las etiquetas, etc.
- */
- enum AxisType { atLeft = 0x01 ///< <tt>0x01</tt> Axis is vertical and on the left side of the axis rect
- /// Eje es vertical y esta en el lado izquierdo del eje rect
- ,atRight = 0x02 ///< <tt>0x02</tt> Axis is vertical and on the right side of the axis rect
- /// Eje es vertical y esta en el lado derecho del eje rect
- ,atTop = 0x04 ///< <tt>0x04</tt> Axis is horizontal and on the top side of the axis rect
- /// Eje es horizontal y esta encima del eje rect
- ,atBottom = 0x08 ///< <tt>0x08</tt> Axis is horizontal and on the bottom side of the axis rect
- /// Eje es horizontal y esta debajo del eje rect
- };
- Q_FLAGS(AxisType AxisTypes)
- Q_DECLARE_FLAGS(AxisTypes, AxisType)
- /*!
- //~English
- When automatic tick label generation is enabled (\ref setAutoTickLabels), defines how the
- coordinate of the tick is interpreted, i.e. translated into a string.
- //~Spanish
- Cuando el generador de las etiquetas de registro automatico es habilitado, define como se
- va interpretar la coordenada del registro, por ejemplo traduciendolo en una cadena.
-
- \see setTickLabelType
- */
- enum LabelType { ltNumber ///< Tick coordinate is regarded as normal number and will be displayed as such. (see \ref setNumberFormat)
- ///< La coordenada del registro es considerado como un valor normal y asi se desplegara, (ver \ref setNumberFormat)
- ,ltDateTime ///< Tick coordinate is regarded as a date/time (seconds since 1970-01-01T00:00:00 UTC) and will be displayed and formatted as such. (for details, see \ref setDateTimeFormat)
- ///< La coordenada del registro es considerado como tiempo/fecha (segundos desde 1970-01-01T00:00:00 YTC) y asi se desplegara y sera formateado.
- /// (para mas detalles ver \ref setDateTimeFormat)
- };
- Q_ENUMS(LabelType)
- /*!
- //~English
- Defines the scale of an axis.
- \see setScaleType
- //~Spanish
- Define la escala de un eje.
- \ver setScaleType
- */
- enum ScaleType { stLinear ///< Linear scaling
- ///< Escala lineal
- ,stLogarithmic ///< Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see \ref setScaleLogBase).
- ///< Escala logaritmica con trazados transformados correspondientes y (mayores) marcas de registro en cada potencia de base
- };
- Q_ENUMS(ScaleType)
- /*!
- //~English
- Defines the selectable parts of an axis.
- \see setSelectableParts, setSelectedParts
- //~Spanish
- Define las partes de un eje que se pueden seleccionar
- \ver setSelectablePartes, set SelectedParts
- */
- enum SelectablePart { spNone = 0 ///< None of the selectable parts
- ///< Ninguna de las partes seleccionables
- ,spAxis = 0x001 ///< The axis backbone and tick marks
- ///< La columna vertebral del eje y las matrices
- ,spTickLabels = 0x002 ///< Tick labels (numbers) of this axis (as a whole, not individually)
- ///< Etiquetas de registro del eje (no individuales)
- ,spAxisLabel = 0x004 ///< The axis label
- ///< La etiqueta del eje
- };
- Q_FLAGS(SelectablePart SelectableParts)
- Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
-
- explicit QCPAxis(QCPAxisRect *parent, AxisType type);
-
- // getters:
- // accesores:
- AxisType axisType() const { return mAxisType; }
- QCPAxisRect *axisRect() const { return mAxisRect; }
- ScaleType scaleType() const { return mScaleType; }
- double scaleLogBase() const { return mScaleLogBase; }
- const QCPRange range() const { return mRange; }
- bool rangeReversed() const { return mRangeReversed; }
- bool autoTicks() const { return mAutoTicks; }
- int autoTickCount() const { return mAutoTickCount; }
- bool autoTickLabels() const { return mAutoTickLabels; }
- bool autoTickStep() const { return mAutoTickStep; }
- bool autoSubTicks() const { return mAutoSubTicks; }
- bool ticks() const { return mTicks; }
- bool tickLabels() const { return mTickLabels; }
- int tickLabelPadding() const { return mTickLabelPadding; }
- LabelType tickLabelType() const { return mTickLabelType; }
- QFont tickLabelFont() const { return mTickLabelFont; }
- QColor tickLabelColor() const { return mTickLabelColor; }
- double tickLabelRotation() const { return mTickLabelRotation; }
- QString dateTimeFormat() const { return mDateTimeFormat; }
- Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
- QString numberFormat() const;
- int numberPrecision() const { return mNumberPrecision; }
- double tickStep() const { return mTickStep; }
- QVector<double> tickVector() const { return mTickVector; }
- QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
- int tickLengthIn() const { return mTickLengthIn; }
- int tickLengthOut() const { return mTickLengthOut; }
- int subTickCount() const { return mSubTickCount; }
- int subTickLengthIn() const { return mSubTickLengthIn; }
- int subTickLengthOut() const { return mSubTickLengthOut; }
- QPen basePen() const { return mBasePen; }
- QPen tickPen() const { return mTickPen; }
- QPen subTickPen() const { return mSubTickPen; }
- QFont labelFont() const { return mLabelFont; }
- QColor labelColor() const { return mLabelColor; }
- QString label() const { return mLabel; }
- int labelPadding() const { return mLabelPadding; }
- int padding() const { return mPadding; }
- int offset() const { return mOffset; }
- SelectableParts selectedParts() const { return mSelectedParts; }
- SelectableParts selectableParts() const { return mSelectableParts; }
- QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
- QFont selectedLabelFont() const { return mSelectedLabelFont; }
- QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
- QColor selectedLabelColor() const { return mSelectedLabelColor; }
- QPen selectedBasePen() const { return mSelectedBasePen; }
- QPen selectedTickPen() const { return mSelectedTickPen; }
- QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
- QCPLineEnding lowerEnding() const { return mLowerEnding; }
- QCPLineEnding upperEnding() const { return mUpperEnding; }
- QCPGrid *grid() const { return mGrid; }
-
- // setters:
- // modificadores:
- void setScaleType(ScaleType type);
- void setScaleLogBase(double base);
- Q_SLOT void setRange(const QCPRange &range);
- void setRange(double lower, double upper);
- void setRange(double position, double size, Qt::AlignmentFlag alignment);
- void setRangeLower(double lower);
- void setRangeUpper(double upper);
- void setRangeReversed(bool reversed);
- void setAutoTicks(bool on);
- void setAutoTickCount(int approximateCount);
- void setAutoTickLabels(bool on);
- void setAutoTickStep(bool on);
- void setAutoSubTicks(bool on);
- void setTicks(bool show);
- void setTickLabels(bool show);
- void setTickLabelPadding(int padding);
- void setTickLabelType(LabelType type);
- void setTickLabelFont(const QFont &font);
- void setTickLabelColor(const QColor &color);
- void setTickLabelRotation(double degrees);
- void setDateTimeFormat(const QString &format);
- void setDateTimeSpec(const Qt::TimeSpec &timeSpec);
- void setNumberFormat(const QString &formatCode);
- void setNumberPrecision(int precision);
- void setTickStep(double step);
- void setTickVector(const QVector<double> &vec);
- void setTickVectorLabels(const QVector<QString> &vec);
- void setTickLength(int inside, int outside=0);
- void setTickLengthIn(int inside);
- void setTickLengthOut(int outside);
- void setSubTickCount(int count);
- void setSubTickLength(int inside, int outside=0);
- void setSubTickLengthIn(int inside);
- void setSubTickLengthOut(int outside);
- void setBasePen(const QPen &pen);
- void setTickPen(const QPen &pen);
- void setSubTickPen(const QPen &pen);
- void setLabelFont(const QFont &font);
- void setLabelColor(const QColor &color);
- void setLabel(const QString &str);
- void setLabelPadding(int padding);
- void setPadding(int padding);
- void setOffset(int offset);
- void setSelectedTickLabelFont(const QFont &font);
- void setSelectedLabelFont(const QFont &font);
- void setSelectedTickLabelColor(const QColor &color);
- void setSelectedLabelColor(const QColor &color);
- void setSelectedBasePen(const QPen &pen);
- void setSelectedTickPen(const QPen &pen);
- void setSelectedSubTickPen(const QPen &pen);
- Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);
- Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
- void setLowerEnding(const QCPLineEnding &ending);
- void setUpperEnding(const QCPLineEnding &ending);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplmentados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- Qt::Orientation orientation() const { return mOrientation; }
- void moveRange(double diff);
- void scaleRange(double factor, double center);
- void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
- void rescale(bool onlyVisiblePlottables=false);
- double pixelToCoord(double value) const;
- double coordToPixel(double value) const;
- SelectablePart getPartAt(const QPointF &pos) const;
- QList<QCPAbstractPlottable*> plottables() const;
- QList<QCPGraph*> graphs() const;
- QList<QCPAbstractItem*> items() const;
-
- static AxisType marginSideToAxisType(QCP::MarginSide side);
-
- signals:
- void ticksRequest();
- void rangeChanged(const QCPRange &newRange);
- void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
- void selectionChanged(const QCPAxis::SelectableParts &parts);
-
- protected:
- struct CachedLabel
- {
- QPointF offset;
- QPixmap pixmap;
- };
- struct TickLabelData
- {
- QString basePart, expPart;
- QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;
- QFont baseFont, expFont;
- };
-
- // property members:
- // miembros con propiedades:
- // axis base:
- // base del eje:
- AxisType mAxisType;
- QCPAxisRect *mAxisRect;
- int mOffset, mPadding;
- Qt::Orientation mOrientation;
- SelectableParts mSelectableParts, mSelectedParts;
- QPen mBasePen, mSelectedBasePen;
- QCPLineEnding mLowerEnding, mUpperEnding;
- // axis label:
- // etiqueta del eje:
- int mLabelPadding;
- QString mLabel;
- QFont mLabelFont, mSelectedLabelFont;
- QColor mLabelColor, mSelectedLabelColor;
- // tick labels:
- // etiqueta:
- int mTickLabelPadding;
- bool mTickLabels, mAutoTickLabels;
- double mTickLabelRotation;
- LabelType mTickLabelType;
- QFont mTickLabelFont, mSelectedTickLabelFont;
- QColor mTickLabelColor, mSelectedTickLabelColor;
- QString mDateTimeFormat;
- Qt::TimeSpec mDateTimeSpec;
- int mNumberPrecision;
- char mNumberFormatChar;
- bool mNumberBeautifulPowers;
- bool mNumberMultiplyCross;
- // ticks and subticks:
- bool mTicks;
- double mTickStep;
- int mSubTickCount, mAutoTickCount;
- bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
- int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
- QPen mTickPen, mSelectedTickPen;
- QPen mSubTickPen, mSelectedSubTickPen;
- // scale and range:
- // escala y rando:
- QCPRange mRange;
- bool mRangeReversed;
- ScaleType mScaleType;
- double mScaleLogBase, mScaleLogBaseLogInv;
-
- // non-property members:
- // miembros que no tienen propiedades:
- QCPGrid *mGrid;
- QCache<QString, CachedLabel> mLabelCache;
- int mLowestVisibleTick, mHighestVisibleTick;
- QChar mExponentialChar, mPositiveSignChar;
- QVector<double> mTickVector;
- QVector<QString> mTickVectorLabels;
- QVector<double> mSubTickVector;
- QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
- bool mCachedMarginValid;
- int mCachedMargin;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void setupTickVectors();
- virtual void generateAutoTicks();
- virtual int calculateAutoSubTickCount(double tickStep) const;
- virtual int calculateMargin();
- // tick label drawing/caching:
- // etiqueta de dibujar o de almacenar en el cache:
- virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
- virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;
- virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;
- virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
- virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter);
- virtual QCP::Interaction selectionCategory() const;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // non-virtual methods:
- // metodos no virtuales:
- void visibleTickBounds(int &lowIndex, int &highIndex) const;
- double baseLog(double value) const;
- double basePow(double value) const;
- QPen getBasePen() const;
- QPen getTickPen() const;
- QPen getSubTickPen() const;
- QFont getTickLabelFont() const;
- QFont getLabelFont() const;
- QColor getTickLabelColor() const;
- QColor getLabelColor() const;
-
- private:
- Q_DISABLE_COPY(QCPAxis)
-
- friend class QCustomPlot;
- friend class QCPGrid;
- friend class QCPAxisRect;
- };
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
- Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
-
-
- class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
- Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
- Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars)
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
- Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
- Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
- Q_PROPERTY(bool selected READ selected WRITE setSelected)
- /// \endcond
- public:
- QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
-
- // getters:
- // accesores:
- QString name() const { return mName; }
- bool antialiasedFill() const { return mAntialiasedFill; }
- bool antialiasedScatters() const { return mAntialiasedScatters; }
- bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QBrush brush() const { return mBrush; }
- QBrush selectedBrush() const { return mSelectedBrush; }
- QCPAxis *keyAxis() const { return mKeyAxis.data(); }
- QCPAxis *valueAxis() const { return mValueAxis.data(); }
- bool selectable() const { return mSelectable; }
- bool selected() const { return mSelected; }
-
- // setters:
- // modificadorea:
- void setName(const QString &name);
- void setAntialiasedFill(bool enabled);
- void setAntialiasedScatters(bool enabled);
- void setAntialiasedErrorBars(bool enabled);
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setSelectedBrush(const QBrush &brush);
- void setKeyAxis(QCPAxis *axis);
- void setValueAxis(QCPAxis *axis);
- Q_SLOT void setSelectable(bool selectable);
- Q_SLOT void setSelected(bool selected);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void clearData() = 0;
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
- virtual bool addToLegend();
- virtual bool removeFromLegend() const;
-
- // non-property methods:
- // metodos que no tienen propiedades:
- void rescaleAxes(bool onlyEnlarge=false) const;
- void rescaleKeyAxis(bool onlyEnlarge=false) const;
- void rescaleValueAxis(bool onlyEnlarge=false) const;
-
- signals:
- void selectionChanged(bool selected);
-
- protected:
- /*!
- //~English
- Represents negative and positive sign domain for passing to \ref getKeyRange and \ref getValueRange.
- //~Spanish
- Representa el dominio de los signos negativos y positivos por pasar a getKeyRange y getValueRevenge
- */
- enum SignDomain { sdNegative ///< The negative sign domain, i.e. numbers smaller than zero
- ///< El dominio del signo negativo, aquellos numeros menores que cero.
- ,sdBoth ///< Both sign domains, including zero, i.e. all (rational) numbers
- ///< Los dominios de ambos signos, todos los numeros racionales
- ,sdPositive ///< The positive sign domain, i.e. numbers greater than zero
- ///< El dominio del signo positivo, aquellos numeros mayores que cero
- };
-
- // property members:
- // miembros con propiedades:
- QString mName;
- bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
- QPen mPen, mSelectedPen;
- QBrush mBrush, mSelectedBrush;
- QPointer<QCPAxis> mKeyAxis, mValueAxis;
- bool mSelectable, mSelected;
-
- // reimplemented virtual methods:
- // metodos virtuales reimpementados:
- virtual QRect clipRect() const;
- virtual void draw(QCPPainter *painter) = 0;
- virtual QCP::Interaction selectionCategory() const;
- void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const = 0;
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const = 0;
-
- // non-virtual methods:
- // metodos no virtuales:
- void coordsToPixels(double key, double value, double &x, double &y) const;
- const QPointF coordsToPixels(double key, double value) const;
- void pixelsToCoords(double x, double y, double &key, double &value) const;
- void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
- QPen mainPen() const;
- QBrush mainBrush() const;
- void applyFillAntialiasingHint(QCPPainter *painter) const;
- void applyScattersAntialiasingHint(QCPPainter *painter) const;
- void applyErrorBarsAntialiasingHint(QCPPainter *painter) const;
- double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
-
- private:
- Q_DISABLE_COPY(QCPAbstractPlottable)
-
- friend class QCustomPlot;
- friend class QCPAxis;
- friend class QCPPlottableLegendItem;
- };
-
-
- class QCP_LIB_DECL QCPItemAnchor
- {
- public:
- QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1);
- virtual ~QCPItemAnchor();
-
- // getters:
- // accesores:
- QString name() const { return mName; }
- virtual QPointF pixelPoint() const;
-
- protected:
- // property members:
- // miembros con propiedades:
- QString mName;
-
- // non-property members:
- // miembros que no tienen propiedades:
- QCustomPlot *mParentPlot;
- QCPAbstractItem *mParentItem;
- int mAnchorId;
- QSet<QCPItemPosition*> mChildren;
-
- // introduced virtual methods:
- // metodoes virtuales introducidos:
- virtual QCPItemPosition *toQCPItemPosition() { return 0; }
-
- // non-virtual methods:
- // metodos no virtuales:
- void addChild(QCPItemPosition* pos); // called from pos when this anchor is set as parent
- // invocado de pos cuando esta pila se establece como parent
- void removeChild(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
- // invocado de pos cuando la pila parent se reinicia o pos de borra
- private:
- Q_DISABLE_COPY(QCPItemAnchor)
-
- friend class QCPItemPosition;
- };
-
-
-
- class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor
- {
- public:
- /*!
- //~English
- Defines the ways an item position can be specified. Thus it defines what the numbers passed to
- \ref setCoords actually mean.
- //~Spanish
- Define la manera la posicion de un articulo se puede especificar. Entonces, tambien define lo que
- significan los numeros pasado a setCoords
-
- \see setType
- */
- enum PositionType { ptAbsolute ///< Static positioning in pixels, starting from the top left corner of the viewport/widget.
- ///< Posicion estatica en pixeles, comenzando por la esquina superior izquierda del viewport/widget
- ,ptViewportRatio ///< Static positioning given by a fraction of the viewport size.
- ///< Posicion estatica dada por una fraccion del tamano de viewport
- ,ptAxisRectRatio ///< Static positioning given by a fraction of the axis rect size (see \ref setAxisRect).
- ///< Posicion estatica dada por una fraccion del tamano de eje rect
- ,ptPlotCoords ///< Dynamic positioning at a plot coordinate defined by two axes (see \ref setAxes).
- ///< Posicion dinamica en una coordenada del trazado definido por 2 ejes.
- };
-
- QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name);
- virtual ~QCPItemPosition();
-
- // getters:
- // accesores:
- PositionType type() const { return mPositionType; }
- QCPItemAnchor *parentAnchor() const { return mParentAnchor; }
- double key() const { return mKey; }
- double value() const { return mValue; }
- QPointF coords() const { return QPointF(mKey, mValue); }
- QCPAxis *keyAxis() const { return mKeyAxis.data(); }
- QCPAxis *valueAxis() const { return mValueAxis.data(); }
- QCPAxisRect *axisRect() const;
- virtual QPointF pixelPoint() const;
-
- // setters:
- // modificadores:
- void setType(PositionType type);
- bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
- void setCoords(double key, double value);
- void setCoords(const QPointF &coords);
- void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
- void setAxisRect(QCPAxisRect *axisRect);
- void setPixelPoint(const QPointF &pixelPoint);
-
- protected:
- // property members:
- // miembros con propiedades:
- PositionType mPositionType;
- QPointer<QCPAxis> mKeyAxis, mValueAxis;
- QPointer<QCPAxisRect> mAxisRect;
- double mKey, mValue;
- QCPItemAnchor *mParentAnchor;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual QCPItemPosition *toQCPItemPosition() { return this; }
-
- private:
- Q_DISABLE_COPY(QCPItemPosition)
-
- };
-
-
- class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
- Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
- Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
- Q_PROPERTY(bool selected READ selected WRITE setSelected)
- /// \endcond
- public:
- QCPAbstractItem(QCustomPlot *parentPlot);
- virtual ~QCPAbstractItem();
-
- // getters:
- // accesores:
- bool clipToAxisRect() const { return mClipToAxisRect; }
- QCPAxisRect *clipAxisRect() const;
- bool selectable() const { return mSelectable; }
- bool selected() const { return mSelected; }
-
- // setters:
- // modificadores:
- void setClipToAxisRect(bool clip);
- void setClipAxisRect(QCPAxisRect *rect);
- void setSelectable(bool selectable);
- void setSelected(bool selected);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
-
- // non-virtual methods:
- // metodos no virtuales:
- QList<QCPItemPosition*> positions() const { return mPositions; }
- QList<QCPItemAnchor*> anchors() const { return mAnchors; }
- QCPItemPosition *position(const QString &name) const;
- QCPItemAnchor *anchor(const QString &name) const;
- bool hasAnchor(const QString &name) const;
-
- signals:
- void selectionChanged(bool selected);
-
- protected:
- // property members:
- // miembros con propiedades:
- bool mClipToAxisRect;
- QPointer<QCPAxisRect> mClipAxisRect;
- QList<QCPItemPosition*> mPositions;
- QList<QCPItemAnchor*> mAnchors;
- bool mSelectable, mSelected;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual QCP::Interaction selectionCategory() const;
- virtual QRect clipRect() const;
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter) = 0;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
- double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const;
- QCPItemPosition *createPosition(const QString &name);
- QCPItemAnchor *createAnchor(const QString &name, int anchorId);
-
- private:
- Q_DISABLE_COPY(QCPAbstractItem)
-
- friend class QCustomPlot;
- friend class QCPItemAnchor;
- };
-
-
- class QCP_LIB_DECL QCustomPlot : public QWidget
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
- Q_PROPERTY(QPixmap background READ background WRITE setBackground)
- Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
- Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
- Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)
- Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
- Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
- Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
- Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
- /// \endcond
- public:
- /*!
- //~English
- Defines how a layer should be inserted relative to an other layer.
- //~Spanish
- Define como una capa deberia ser insertada en relacion a otra capa.
- \see addLayer, moveLayer
- */
- enum LayerInsertMode { limBelow ///< Layer is inserted below other layer
- ///< Capa es insertada debajo la otra capa
- ,limAbove ///< Layer is inserted above other layer
- ///< capa es insertada por encima de la otra capa
- };
- Q_ENUMS(LayerInsertMode)
-
- explicit QCustomPlot(QWidget *parent = 0);
- virtual ~QCustomPlot();
-
- // getters:
- // accesores:
- QRect viewport() const { return mViewport; }
- QPixmap background() const { return mBackgroundPixmap; }
- bool backgroundScaled() const { return mBackgroundScaled; }
- Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
- QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
- QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
- QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }
- bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
- const QCP::Interactions interactions() const { return mInteractions; }
- int selectionTolerance() const { return mSelectionTolerance; }
- bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
- QCP::PlottingHints plottingHints() const { return mPlottingHints; }
- Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }
-
- // setters:
- // modificadores:
- void setViewport(const QRect &rect);
- void setBackground(const QPixmap &pm);
- void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
- void setBackground(const QBrush &brush);
- void setBackgroundScaled(bool scaled);
- void setBackgroundScaledMode(Qt::AspectRatioMode mode);
- void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);
- void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);
- void setNotAntialiasedElements(const QCP::AntialiasedElements ¬AntialiasedElements);
- void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);
- void setAutoAddPlottableToLegend(bool on);
- void setInteractions(const QCP::Interactions &interactions);
- void setInteraction(const QCP::Interaction &interaction, bool enabled=true);
- void setSelectionTolerance(int pixels);
- void setNoAntialiasingOnDrag(bool enabled);
- void setPlottingHints(const QCP::PlottingHints &hints);
- void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);
- void setMultiSelectModifier(Qt::KeyboardModifier modifier);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- // plottable interface:
- // interfaz plottable:
- QCPAbstractPlottable *plottable(int index);
- QCPAbstractPlottable *plottable();
- bool addPlottable(QCPAbstractPlottable *plottable);
- bool removePlottable(QCPAbstractPlottable *plottable);
- bool removePlottable(int index);
- int clearPlottables();
- int plottableCount() const;
- QList<QCPAbstractPlottable*> selectedPlottables() const;
- QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false) const;
- bool hasPlottable(QCPAbstractPlottable *plottable) const;
-
- // specialized interface for QCPGraph:
- // interfaz especializado para QCPGraph:
- QCPGraph *graph(int index) const;
- QCPGraph *graph() const;
- QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);
- bool removeGraph(QCPGraph *graph);
- bool removeGraph(int index);
- int clearGraphs();
- int graphCount() const;
- QList<QCPGraph*> selectedGraphs() const;
-
- // item interface:
- // articulo de interfaz:
- QCPAbstractItem *item(int index) const;
- QCPAbstractItem *item() const;
- bool addItem(QCPAbstractItem* item);
- bool removeItem(QCPAbstractItem *item);
- bool removeItem(int index);
- int clearItems();
- int itemCount() const;
- QList<QCPAbstractItem*> selectedItems() const;
- QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;
- bool hasItem(QCPAbstractItem *item) const;
-
- // layer interface:
- // capa de interfaz:
- QCPLayer *layer(const QString &name) const;
- QCPLayer *layer(int index) const;
- QCPLayer *currentLayer() const;
- bool setCurrentLayer(const QString &name);
- bool setCurrentLayer(QCPLayer *layer);
- int layerCount() const;
- bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);
- bool removeLayer(QCPLayer *layer);
- bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
-
- // axis rect/layout interface:
- // interfaz del eje de rect/layout:
- int axisRectCount() const;
- QCPAxisRect* axisRect(int index=0) const;
- QList<QCPAxisRect*> axisRects() const;
- QCPLayoutElement* layoutElementAt(const QPointF &pos) const;
- Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);
-
- QList<QCPAxis*> selectedAxes() const;
- QList<QCPLegend*> selectedLegends() const;
- Q_SLOT void deselectAll();
-
- bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0);
- bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
- bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
- bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0);
- bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1);
- QPixmap toPixmap(int width=0, int height=0, double scale=1.0);
- void toPainter(QCPPainter *painter, int width=0, int height=0);
- Q_SLOT void replot();
-
- QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
- QCPLegend *legend;
-
- signals:
- void mouseDoubleClick(QMouseEvent *event);
- void mousePress(QMouseEvent *event);
- void mouseMove(QMouseEvent *event);
- void mouseRelease(QMouseEvent *event);
- void mouseWheel(QWheelEvent *event);
-
- void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
- void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
- void itemClick(QCPAbstractItem *item, QMouseEvent *event);
- void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
- void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
- void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
- void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
- void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
- void titleClick(QMouseEvent *event, QCPPlotTitle *title);
- void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);
-
- void selectionChangedByUser();
- void beforeReplot();
- void afterReplot();
-
- protected:
- // property members:
- // miembros con propiedades:
- QRect mViewport;
- QCPLayoutGrid *mPlotLayout;
- bool mAutoAddPlottableToLegend;
- QList<QCPAbstractPlottable*> mPlottables;
- QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph
- // lista extra de plottables en mPlottables que son tipo QCPGraph
- QList<QCPAbstractItem*> mItems;
- QList<QCPLayer*> mLayers;
- QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
- QCP::Interactions mInteractions;
- int mSelectionTolerance;
- bool mNoAntialiasingOnDrag;
- QBrush mBackgroundBrush;
- QPixmap mBackgroundPixmap;
- QPixmap mScaledBackgroundPixmap;
- bool mBackgroundScaled;
- Qt::AspectRatioMode mBackgroundScaledMode;
- QCPLayer *mCurrentLayer;
- QCP::PlottingHints mPlottingHints;
- Qt::KeyboardModifier mMultiSelectModifier;
-
- // non-property members:
- // miembros que no tienen propiedades:
- QPixmap mPaintBuffer;
- QPoint mMousePressPos;
- QCPLayoutElement *mMouseEventElement;
- bool mReplotting;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual QSize minimumSizeHint() const;
- virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent *event);
- virtual void resizeEvent(QResizeEvent *event);
- virtual void mouseDoubleClickEvent(QMouseEvent *event);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
- virtual void wheelEvent(QWheelEvent *event);
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void draw(QCPPainter *painter);
- virtual void axisRemoved(QCPAxis *axis);
- virtual void legendRemoved(QCPLegend *legend);
-
- // non-virtual methods:
- // metodos no virtuales:
- void updateLayerIndices() const;
- QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const;
- void drawBackground(QCPPainter *painter);
-
- friend class QCPLegend;
- friend class QCPAxis;
- friend class QCPLayer;
- friend class QCPAxisRect;
- };
-
-
- /*! \file */
-
-
-
- class QCP_LIB_DECL QCPData
- {
- public:
- QCPData();
- QCPData(double key, double value);
- double key, value;
- double keyErrorPlus, keyErrorMinus;
- double valueErrorPlus, valueErrorMinus;
- };
- Q_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE);
-
- /*! \typedef QCPDataMap
- //~English
- Container for storing QCPData items in a sorted fashion. The key of the map
- is the key member of the QCPData instance.
-
- This is the container in which QCPGraph holds its data.
- \see QCPData, QCPGraph::setData
-
- //~Spanish
- Contenedor que almacena articulos de QCPData de manera ordenada. La llave del
- mapa es el miembro llave de una instancia de QCPData.
-
- Este es el contenedor en el que QCPGraph guarda su data.
- \ver QCPData, QCPGraph::setData
- */
- typedef QMap<double, QCPData> QCPDataMap;
- typedef QMapIterator<double, QCPData> QCPDataMapIterator;
- typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
-
-
- class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
- Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
- Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
- Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
- Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)
- Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol)
- Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
- /// \endcond
- public:
- /*!
- //~English
- Defines how the graph's line is represented visually in the plot. The line is drawn with the
- current pen of the graph (\ref setPen).
- \see setLineStyle
- //~Spanish
- Define como la linea de la grafica es representada visualmente en el grafico. La linea se
- dibuja con la pluma actual de la grafica.
- \ver setLineStyle
- */
- enum LineStyle { lsNone ///< data points are not connected with any lines (e.g. data only represented
- ///< with symbols according to the scatter style, see \ref setScatterStyle)
- ///< los puntos de data no estan conectados con ninguna linea (data representada
- ///< solo con simbolos de acuerdo al estilo de dispersion)
- ,lsLine ///< data points are connected by a straight line
- ///< puntos de data estan conectada con una linea recta
- ,lsStepLeft ///< line is drawn as steps where the step height is the value of the left data point
- ///< la linea se dibuja como escaleras donde la longitus entre cada escalon es el valor del punto de data izquierdo
- ,lsStepRight ///< line is drawn as steps where the step height is the value of the right data point
- ///< la linea se dibuja como escaleras donde la longitud entre cada escalon es el valor del punto de data derecho
- ,lsStepCenter ///< line is drawn as steps where the step is in between two data points
- ///< la linea se dibuja como escaleras donde el escalon esta entre dos puntos de data
- ,lsImpulse ///< each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line
- ///< cada punto de data esta representado por una linea paralela al valor del eje, que desde el punto de data llega a la linea de valor cero.
-
- };
- Q_ENUMS(LineStyle)
- /*!
- //~English
- Defines what kind of error bars are drawn for each data point
- //~Spanish
- Define que tipo de barras de errore se dibujan para cada punto
- */
- enum ErrorType { etNone ///< No error bars are shown
- ///< Ningun barra de error se visualiza
- ,etKey ///< Error bars for the key dimension of the data point are shown
- ///< Barras de error para la dimension de la llave del punto de data se presenta
- ,etValue ///< Error bars for the value dimension of the data point are shown
- ///< Barras de error para la dimension del valor del punto de data se presenta
- ,etBoth ///< Error bars for both key and value dimensions of the data point are shown
- ///< Barras de error para las dimensiones de ambas llave y valor del punto de data se presenta.
- };
- Q_ENUMS(ErrorType)
-
- explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
- virtual ~QCPGraph();
-
- // getters:
- // accesores:
- const QCPDataMap *data() const { return mData; }
- LineStyle lineStyle() const { return mLineStyle; }
- QCPScatterStyle scatterStyle() const { return mScatterStyle; }
- ErrorType errorType() const { return mErrorType; }
- QPen errorPen() const { return mErrorPen; }
- double errorBarSize() const { return mErrorBarSize; }
- bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
- QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
-
- // setters:
- // modificadores:
- void setData(QCPDataMap *data, bool copy=false);
- void setData(const QVector<double> &key, const QVector<double> &value);
- void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError);
- void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus);
- void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError);
- void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
- void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError);
- void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
- void setLineStyle(LineStyle ls);
- void setScatterStyle(const QCPScatterStyle &style);
- void setErrorType(ErrorType errorType);
- void setErrorPen(const QPen &pen);
- void setErrorBarSize(double size);
- void setErrorBarSkipSymbol(bool enabled);
- void setChannelFillGraph(QCPGraph *targetGraph);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- void addData(const QCPDataMap &dataMap);
- void addData(const QCPData &data);
- void addData(double key, double value);
- void addData(const QVector<double> &keys, const QVector<double> &values);
- void removeDataBefore(double key);
- void removeDataAfter(double key);
- void removeData(double fromKey, double toKey);
- void removeData(double key);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void clearData();
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
- using QCPAbstractPlottable::rescaleAxes;
- using QCPAbstractPlottable::rescaleKeyAxis;
- using QCPAbstractPlottable::rescaleValueAxis;
- void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
- // sobrecarga la interfac de la clase base
- void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
- // sobrecarga la interfaz de la clase base
- void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
- // sobrecarga la interfaz de la clase base
-
- protected:
- // property members:
- // miembros que tienen propiedades:
- QCPDataMap *mData;
- QPen mErrorPen;
- LineStyle mLineStyle;
- QCPScatterStyle mScatterStyle;
- ErrorType mErrorType;
- double mErrorBarSize;
- bool mErrorBarSkipSymbol;
- QPointer<QCPGraph> mChannelFillGraph;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementadas:
- virtual void draw(QCPPainter *painter);
- virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
- // sobrecarga la interfaz de la clase base
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
- // sobrecarga la interfaz de la clase base
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const;
- virtual void drawScatterPlot(QCPPainter *painter, QVector<QCPData> *pointData) const;
- virtual void drawLinePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
- virtual void drawImpulsePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void getScatterPlotData(QVector<QCPData> *pointData) const;
- void getLinePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void getStepLeftPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void getStepRightPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void getStepCenterPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void getImpulsePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
- void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const;
- void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper, int &count) const;
- void addFillBasePoints(QVector<QPointF> *lineData) const;
- void removeFillBasePoints(QVector<QPointF> *lineData) const;
- QPointF lowerFillBasePoint(double lowerKey) const;
- QPointF upperFillBasePoint(double upperKey) const;
- const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;
- int findIndexBelowX(const QVector<QPointF> *data, double x) const;
- int findIndexAboveX(const QVector<QPointF> *data, double x) const;
- int findIndexBelowY(const QVector<QPointF> *data, double y) const;
- int findIndexAboveY(const QVector<QPointF> *data, double y) const;
- double pointDistance(const QPointF &pixelPoint) const;
-
- friend class QCustomPlot;
- friend class QCPLegend;
- };
-
-
- /*! \file */
-
-
-
- class QCP_LIB_DECL QCPCurveData
- {
- public:
- QCPCurveData();
- QCPCurveData(double t, double key, double value);
- double t, key, value;
- };
- Q_DECLARE_TYPEINFO(QCPCurveData, Q_MOVABLE_TYPE);
-
- /*! \typedef QCPCurveDataMap
- //~English
- Container for storing QCPCurveData items in a sorted fashion. The key of the map
- is the t member of the QCPCurveData instance.
-
- This is the container in which QCPCurve holds its data.
- \see QCPCurveData, QCPCurve::setData
-
- //~Spanish
- Contenedor para almacenar articulos de QCPCurveData de manera ordenada. La llave
- del mapa es el miembro t de una instancia de QCPCurveData
-
- Este es el contenedor en el que QCPCurve guarda su data.
- \ver QCPCurveData, QCPCurve::setData
-
- */
-
- typedef QMap<double, QCPCurveData> QCPCurveDataMap;
- typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
- typedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;
-
-
- class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
- Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
- /// \endcond
- public:
- /*!
- //~English
- Defines how the curve's line is represented visually in the plot. The line is drawn with the
- current pen of the curve (\ref setPen).
- \see setLineStyle
- //~Spanish
- Define como la curva de la linea se representa visualmente en el grafico. La linea se dibuja
- con la pluma actual de la curva
- \ver setLineStyle
- */
- enum LineStyle { lsNone, ///< No line is drawn between data points (e.g. only scatters)
- ///< Ninguna linea esta dibujada entre los puntos de data
- lsLine ///< Data points are connected with a straight line
- ///< Los puntos de data estan conectados con una linea recta
- };
- explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
- virtual ~QCPCurve();
-
- // getters:
- // accesores:
- QCPCurveDataMap *data() const { return mData; }
- QCPScatterStyle scatterStyle() const { return mScatterStyle; }
- LineStyle lineStyle() const { return mLineStyle; }
-
- // setters:
- // modificadores:
- void setData(QCPCurveDataMap *data, bool copy=false);
- void setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value);
- void setData(const QVector<double> &key, const QVector<double> &value);
- void setScatterStyle(const QCPScatterStyle &style);
- void setLineStyle(LineStyle style);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- void addData(const QCPCurveDataMap &dataMap);
- void addData(const QCPCurveData &data);
- void addData(double t, double key, double value);
- void addData(double key, double value);
- void addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values);
- void removeDataBefore(double t);
- void removeDataAfter(double t);
- void removeData(double fromt, double tot);
- void removeData(double t);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void clearData();
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- protected:
- // property members:
- // miembros con propiedades:
- QCPCurveDataMap *mData;
- QCPScatterStyle mScatterStyle;
- LineStyle mLineStyle;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> *pointData) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- void getCurveData(QVector<QPointF> *lineData) const;
- double pointDistance(const QPointF &pixelPoint) const;
- QPointF outsideCoordsToPixels(double key, double value, int region, QRect axisRect) const;
-
- friend class QCustomPlot;
- friend class QCPLegend;
- };
-
-
- /*! \file */
-
-
-
- class QCP_LIB_DECL QCPBarData
- {
- public:
- QCPBarData();
- QCPBarData(double key, double value);
- double key, value;
- };
- Q_DECLARE_TYPEINFO(QCPBarData, Q_MOVABLE_TYPE);
-
- /*! \typedef QCPBarDataMap
- //~English
- Container for storing QCPBarData items in a sorted fashion. The key of the map
- is the key member of the QCPBarData instance.
-
- This is the container in which QCPBars holds its data.
- \see QCPBarData, QCPBars::setData
- //~Spanish
- Contenedor para almacenar los articulos de QCPBarData en una manera ordenada.
- La llave del mapa es la llave del miembro de la instancia de QCPBarData.
-
- Este es el contenedor en donde QCPBars guarda su data.
- \ver QCPBarData, QCPBars::setData
- */
- typedef QMap<double, QCPBarData> QCPBarDataMap;
- typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
- typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
-
-
- class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(double width READ width WRITE setWidth)
- Q_PROPERTY(QCPBars* barBelow READ barBelow)
- Q_PROPERTY(QCPBars* barAbove READ barAbove)
- /// \endcond
- public:
- explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
- virtual ~QCPBars();
-
- // getters:
- // accesores:
- double width() const { return mWidth; }
- QCPBars *barBelow() const { return mBarBelow.data(); }
- QCPBars *barAbove() const { return mBarAbove.data(); }
- QCPBarDataMap *data() const { return mData; }
-
- // setters:
- // modificadores:
- void setWidth(double width);
- void setData(QCPBarDataMap *data, bool copy=false);
- void setData(const QVector<double> &key, const QVector<double> &value);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- void moveBelow(QCPBars *bars);
- void moveAbove(QCPBars *bars);
- void addData(const QCPBarDataMap &dataMap);
- void addData(const QCPBarData &data);
- void addData(double key, double value);
- void addData(const QVector<double> &keys, const QVector<double> &values);
- void removeDataBefore(double key);
- void removeDataAfter(double key);
- void removeData(double fromKey, double toKey);
- void removeData(double key);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void clearData();
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- protected:
- // property members:
- // miembros con propiedades:
- QCPBarDataMap *mData;
- double mWidth;
- QPointer<QCPBars> mBarBelow, mBarAbove;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPolygonF getBarPolygon(double key, double value) const;
- double getBaseValue(double key, bool positive) const;
- static void connectBars(QCPBars* lower, QCPBars* upper);
-
- friend class QCustomPlot;
- friend class QCPLegend;
- };
-
-
- /*! \file */
-
-
-
- class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(double key READ key WRITE setKey)
- Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
- Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
- Q_PROPERTY(double median READ median WRITE setMedian)
- Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)
- Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
- Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
- Q_PROPERTY(double width READ width WRITE setWidth)
- Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
- Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
- Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
- Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
- Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
- /// \endcond
- public:
- explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
-
- // getters:
- // accesores:
- double key() const { return mKey; }
- double minimum() const { return mMinimum; }
- double lowerQuartile() const { return mLowerQuartile; }
- double median() const { return mMedian; }
- double upperQuartile() const { return mUpperQuartile; }
- double maximum() const { return mMaximum; }
- QVector<double> outliers() const { return mOutliers; }
- double width() const { return mWidth; }
- double whiskerWidth() const { return mWhiskerWidth; }
- QPen whiskerPen() const { return mWhiskerPen; }
- QPen whiskerBarPen() const { return mWhiskerBarPen; }
- QPen medianPen() const { return mMedianPen; }
- QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
-
- // setters:
- // modificadores:
- void setKey(double key);
- void setMinimum(double value);
- void setLowerQuartile(double value);
- void setMedian(double value);
- void setUpperQuartile(double value);
- void setMaximum(double value);
- void setOutliers(const QVector<double> &values);
- void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum);
- void setWidth(double width);
- void setWhiskerWidth(double width);
- void setWhiskerPen(const QPen &pen);
- void setWhiskerBarPen(const QPen &pen);
- void setMedianPen(const QPen &pen);
- void setOutlierStyle(const QCPScatterStyle &style);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- virtual void clearData();
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- protected:
- // property members:
- // miembros con propiedades:
- QVector<double> mOutliers;
- double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
- double mWidth;
- double mWhiskerWidth;
- QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
- QCPScatterStyle mOutlierStyle;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
- virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
- virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
-
- // introduced virtual methods:
- // metodos virtuales introducidos:
- virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const;
- virtual void drawMedian(QCPPainter *painter) const;
- virtual void drawWhiskers(QCPPainter *painter) const;
- virtual void drawOutliers(QCPPainter *painter) const;
-
- friend class QCustomPlot;
- friend class QCPLegend;
- };
-
-
- class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- /// \endcond
- public:
- QCPItemStraightLine(QCustomPlot *parentPlot);
- virtual ~QCPItemStraightLine();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const point1;
- QCPItemPosition * const point2;
-
- protected:
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
-
- // non-virtual methods:
- // metodos no virtuales:
- double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const;
- QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const;
- QPen mainPen() const;
- };
-
-
- class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
- Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
- /// \endcond
- public:
- QCPItemLine(QCustomPlot *parentPlot);
- virtual ~QCPItemLine();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QCPLineEnding head() const { return mHead; }
- QCPLineEnding tail() const { return mTail; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setHead(const QCPLineEnding &head);
- void setTail(const QCPLineEnding &tail);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const start;
- QCPItemPosition * const end;
-
- protected:
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
- QCPLineEnding mHead, mTail;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
-
- // non-virtual methods:
- // metodos no virtuales:
- QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const;
- QPen mainPen() const;
- };
-
-
- class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
- Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
- /// \endcond
- public:
- QCPItemCurve(QCustomPlot *parentPlot);
- virtual ~QCPItemCurve();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QCPLineEnding head() const { return mHead; }
- QCPLineEnding tail() const { return mTail; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setHead(const QCPLineEnding &head);
- void setTail(const QCPLineEnding &tail);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const start;
- QCPItemPosition * const startDir;
- QCPItemPosition * const endDir;
- QCPItemPosition * const end;
-
- protected:
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
- QCPLineEnding mHead, mTail;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen mainPen() const;
- };
-
-
- class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- /// \endcond
- public:
- QCPItemRect(QCustomPlot *parentPlot);
- virtual ~QCPItemRect();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QBrush brush() const { return mBrush; }
- QBrush selectedBrush() const { return mSelectedBrush; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setSelectedBrush(const QBrush &brush);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const topLeft;
- QCPItemPosition * const bottomRight;
- QCPItemAnchor * const top;
- QCPItemAnchor * const topRight;
- QCPItemAnchor * const right;
- QCPItemAnchor * const bottom;
- QCPItemAnchor * const bottomLeft;
- QCPItemAnchor * const left;
-
- protected:
- enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
-
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
- QBrush mBrush, mSelectedBrush;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen mainPen() const;
- QBrush mainBrush() const;
- };
-
-
- class QCP_LIB_DECL QCPItemText : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
- Q_PROPERTY(QString text READ text WRITE setText)
- Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
- Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
- Q_PROPERTY(double rotation READ rotation WRITE setRotation)
- Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
- /// \endcond
- public:
- QCPItemText(QCustomPlot *parentPlot);
- virtual ~QCPItemText();
-
- // getters:
- // accesores:
- QColor color() const { return mColor; }
- QColor selectedColor() const { return mSelectedColor; }
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QBrush brush() const { return mBrush; }
- QBrush selectedBrush() const { return mSelectedBrush; }
- QFont font() const { return mFont; }
- QFont selectedFont() const { return mSelectedFont; }
- QString text() const { return mText; }
- Qt::Alignment positionAlignment() const { return mPositionAlignment; }
- Qt::Alignment textAlignment() const { return mTextAlignment; }
- double rotation() const { return mRotation; }
- QMargins padding() const { return mPadding; }
-
- // setters:
- // modificadores:
- void setColor(const QColor &color);
- void setSelectedColor(const QColor &color);
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setSelectedBrush(const QBrush &brush);
- void setFont(const QFont &font);
- void setSelectedFont(const QFont &font);
- void setText(const QString &text);
- void setPositionAlignment(Qt::Alignment alignment);
- void setTextAlignment(Qt::Alignment alignment);
- void setRotation(double degrees);
- void setPadding(const QMargins &padding);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const position;
- QCPItemAnchor * const topLeft;
- QCPItemAnchor * const top;
- QCPItemAnchor * const topRight;
- QCPItemAnchor * const right;
- QCPItemAnchor * const bottomRight;
- QCPItemAnchor * const bottom;
- QCPItemAnchor * const bottomLeft;
- QCPItemAnchor * const left;
-
- protected:
- enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
-
- // property members:
- // miembros con propiedades:
- QColor mColor, mSelectedColor;
- QPen mPen, mSelectedPen;
- QBrush mBrush, mSelectedBrush;
- QFont mFont, mSelectedFont;
- QString mText;
- Qt::Alignment mPositionAlignment;
- Qt::Alignment mTextAlignment;
- double mRotation;
- QMargins mPadding;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;
- QFont mainFont() const;
- QColor mainColor() const;
- QPen mainPen() const;
- QBrush mainBrush() const;
- };
-
-
- class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- /// \endcond
- public:
- QCPItemEllipse(QCustomPlot *parentPlot);
- virtual ~QCPItemEllipse();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QBrush brush() const { return mBrush; }
- QBrush selectedBrush() const { return mSelectedBrush; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setSelectedBrush(const QBrush &brush);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const topLeft;
- QCPItemPosition * const bottomRight;
- QCPItemAnchor * const topLeftRim;
- QCPItemAnchor * const top;
- QCPItemAnchor * const topRightRim;
- QCPItemAnchor * const right;
- QCPItemAnchor * const bottomRightRim;
- QCPItemAnchor * const bottom;
- QCPItemAnchor * const bottomLeftRim;
- QCPItemAnchor * const left;
- QCPItemAnchor * const center;
-
- protected:
- enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
-
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
- QBrush mBrush, mSelectedBrush;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen mainPen() const;
- QBrush mainBrush() const;
- };
-
-
- class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
- Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
- Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- /// \endcond
- public:
- QCPItemPixmap(QCustomPlot *parentPlot);
- virtual ~QCPItemPixmap();
-
- // getters:
- // accesores:
- QPixmap pixmap() const { return mPixmap; }
- bool scaled() const { return mScaled; }
- Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
-
- // setters:
- // modificadores:
- void setPixmap(const QPixmap &pixmap);
- void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio);
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const topLeft;
- QCPItemPosition * const bottomRight;
- QCPItemAnchor * const top;
- QCPItemAnchor * const topRight;
- QCPItemAnchor * const right;
- QCPItemAnchor * const bottom;
- QCPItemAnchor * const bottomLeft;
- QCPItemAnchor * const left;
-
- protected:
- enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
-
- // property members:
- // miembros con propiedades:
- QPixmap mPixmap;
- QPixmap mScaledPixmap;
- bool mScaled;
- Qt::AspectRatioMode mAspectRatioMode;
- QPen mPen, mSelectedPen;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);
- QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const;
- QPen mainPen() const;
- };
-
-
- class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- Q_PROPERTY(double size READ size WRITE setSize)
- Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
- Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)
- Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
- Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
- /// \endcond
- public:
- /*!
- //~English
- The different visual appearances a tracer item can have. Some styles size may be controlled with \ref setSize.
- //~Spanish
- Las diferentes apariencias visuales que el articulos trazador puede tener. Algunos tamanos del estilo
- se pueden controlar con \ref setSize.
- \see setStyle
- */
- enum TracerStyle { tsNone ///< The tracer is not visible
- ///< El trazador no esta visible
- ,tsPlus ///< A plus shaped crosshair with limited size
- ///< Un cruzado con forma de suma con un tamano limitado
- ,tsCrosshair ///< A plus shaped crosshair which spans the complete axis rect
- ///< Un cruzado con forma de suma que abarca el eje rect completo
- ,tsCircle ///< A circle
- ///< Un circulo
- ,tsSquare ///< A square
- ///< Un cuadrado
- };
- Q_ENUMS(TracerStyle)
-
- QCPItemTracer(QCustomPlot *parentPlot);
- virtual ~QCPItemTracer();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- QBrush brush() const { return mBrush; }
- QBrush selectedBrush() const { return mSelectedBrush; }
- double size() const { return mSize; }
- TracerStyle style() const { return mStyle; }
- QCPGraph *graph() const { return mGraph; }
- double graphKey() const { return mGraphKey; }
- bool interpolating() const { return mInterpolating; }
-
- // setters;
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setSelectedBrush(const QBrush &brush);
- void setSize(double size);
- void setStyle(TracerStyle style);
- void setGraph(QCPGraph *graph);
- void setGraphKey(double key);
- void setInterpolating(bool enabled);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- void updatePosition();
-
- QCPItemPosition * const position;
-
- protected:
- // property members:
- // miembros con propiedades:
- QPen mPen, mSelectedPen;
- QBrush mBrush, mSelectedBrush;
- double mSize;
- TracerStyle mStyle;
- QCPGraph *mGraph;
- double mGraphKey;
- bool mInterpolating;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen mainPen() const;
- QBrush mainBrush() const;
- };
-
-
- class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen pen READ pen WRITE setPen)
- Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
- Q_PROPERTY(double length READ length WRITE setLength)
- Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
- /// \endcond
- public:
- enum BracketStyle { bsSquare ///< A brace with angled edges
- ///< Bracket con las esquinas anguladas
- ,bsRound ///< A brace with round edges
- ///< Parenthesis
- ,bsCurly ///< A curly brace
- ///< Llave
- ,bsCalligraphic ///< A curly brace with varying stroke width giving a calligraphic impression
-
- };
-
- QCPItemBracket(QCustomPlot *parentPlot);
- virtual ~QCPItemBracket();
-
- // getters:
- // accesores:
- QPen pen() const { return mPen; }
- QPen selectedPen() const { return mSelectedPen; }
- double length() const { return mLength; }
- BracketStyle style() const { return mStyle; }
-
- // setters:
- // modificadores:
- void setPen(const QPen &pen);
- void setSelectedPen(const QPen &pen);
- void setLength(double length);
- void setStyle(BracketStyle style);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- QCPItemPosition * const left;
- QCPItemPosition * const right;
- QCPItemAnchor * const center;
-
- protected:
- // property members:
- // miembros con propiedades:
- enum AnchorIndex {aiCenter};
- QPen mPen, mSelectedPen;
- double mLength;
- BracketStyle mStyle;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QPointF anchorPixelPoint(int anchorId) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen mainPen() const;
- };
-
-
- class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPixmap background READ background WRITE setBackground)
- Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
- Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
- Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
- Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
- /// \endcond
- public:
- explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);
- virtual ~QCPAxisRect();
-
- // getters:
- // accesores:
- QPixmap background() const { return mBackgroundPixmap; }
- bool backgroundScaled() const { return mBackgroundScaled; }
- Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
- Qt::Orientations rangeDrag() const { return mRangeDrag; }
- Qt::Orientations rangeZoom() const { return mRangeZoom; }
- QCPAxis *rangeDragAxis(Qt::Orientation orientation);
- QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
- double rangeZoomFactor(Qt::Orientation orientation);
-
- // setters:
- // modificadores:
- void setBackground(const QPixmap &pm);
- void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
- void setBackground(const QBrush &brush);
- void setBackgroundScaled(bool scaled);
- void setBackgroundScaledMode(Qt::AspectRatioMode mode);
- void setRangeDrag(Qt::Orientations orientations);
- void setRangeZoom(Qt::Orientations orientations);
- void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
- void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
- void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
- void setRangeZoomFactor(double factor);
-
- // non-property methods:
- // metodos que no tienen propiedades:
- int axisCount(QCPAxis::AxisType type) const;
- QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;
- QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;
- QList<QCPAxis*> axes() const;
- QCPAxis *addAxis(QCPAxis::AxisType type);
- QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
- bool removeAxis(QCPAxis *axis);
- QCPLayoutInset *insetLayout() const { return mInsetLayout; }
-
- void setupFullAxesBox(bool connectRanges=false);
- QList<QCPAbstractPlottable*> plottables() const;
- QList<QCPGraph*> graphs() const;
- QList<QCPAbstractItem*> items() const;
-
- // read-only interface imitating a QRect:
- // interfaz de solo leer que imita a QRect:
- int left() const { return mRect.left(); }
- int right() const { return mRect.right(); }
- int top() const { return mRect.top(); }
- int bottom() const { return mRect.bottom(); }
- int width() const { return mRect.width(); }
- int height() const { return mRect.height(); }
- QSize size() const { return mRect.size(); }
- QPoint topLeft() const { return mRect.topLeft(); }
- QPoint topRight() const { return mRect.topRight(); }
- QPoint bottomLeft() const { return mRect.bottomLeft(); }
- QPoint bottomRight() const { return mRect.bottomRight(); }
- QPoint center() const { return mRect.center(); }
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void update();
- virtual QList<QCPLayoutElement*> elements(bool recursive) const;
-
- protected:
- // property members:
- // miembros con propiedades:
- QBrush mBackgroundBrush;
- QPixmap mBackgroundPixmap;
- QPixmap mScaledBackgroundPixmap;
- bool mBackgroundScaled;
- Qt::AspectRatioMode mBackgroundScaledMode;
- QCPLayoutInset *mInsetLayout;
- Qt::Orientations mRangeDrag, mRangeZoom;
- QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;
- double mRangeZoomFactorHorz, mRangeZoomFactorVert;
- // non-property members:
- // miembros que no tienen propiedades:
- QCPRange mDragStartHorzRange, mDragStartVertRange;
- QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
- QPoint mDragStart;
- bool mDragging;
- QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter);
- virtual int calculateAutoMargin(QCP::MarginSide side);
- // events:
- // eventos:
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
- virtual void wheelEvent(QWheelEvent *event);
-
- // non-property methods:
- // miembros que no tienen propiedades:
- void drawBackground(QCPPainter *painter);
- void updateAxesOffset(QCPAxis::AxisType type);
-
- private:
- Q_DISABLE_COPY(QCPAxisRect)
-
- friend class QCustomPlot;
- };
-
-
- class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)
- Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
- Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
- Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
- Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
- Q_PROPERTY(bool selected READ selected WRITE setSelected)
- /// \endcond
- public:
- explicit QCPAbstractLegendItem(QCPLegend *parent);
-
- // getters:
- // accesores:
- QCPLegend *parentLegend() const { return mParentLegend; }
- QFont font() const { return mFont; }
- QColor textColor() const { return mTextColor; }
- QFont selectedFont() const { return mSelectedFont; }
- QColor selectedTextColor() const { return mSelectedTextColor; }
- bool selectable() const { return mSelectable; }
- bool selected() const { return mSelected; }
-
- // setters:
- // modificadores:
- void setFont(const QFont &font);
- void setTextColor(const QColor &color);
- void setSelectedFont(const QFont &font);
- void setSelectedTextColor(const QColor &color);
- void setSelectable(bool selectable);
- void setSelected(bool selected);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- signals:
- void selectionChanged(bool selected);
-
- protected:
- // property members:
- // miembros con propiedades:
- QCPLegend *mParentLegend;
- QFont mFont;
- QColor mTextColor;
- QFont mSelectedFont;
- QColor mSelectedTextColor;
- bool mSelectable, mSelected;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual QCP::Interaction selectionCategory() const;
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual QRect clipRect() const;
- virtual void draw(QCPPainter *painter) = 0;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- private:
- Q_DISABLE_COPY(QCPAbstractLegendItem)
-
- friend class QCPLegend;
- };
-
-
- class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem
- {
- Q_OBJECT
- public:
- QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable);
-
- // getters:
- // accesores:
- QCPAbstractPlottable *plottable() { return mPlottable; }
-
- protected:
- // property members:
- // miembros con propiedades:
- QCPAbstractPlottable *mPlottable;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void draw(QCPPainter *painter);
- virtual QSize minimumSizeHint() const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen getIconBorderPen() const;
- QColor getTextColor() const;
- QFont getFont() const;
- };
-
-
- class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
- Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
- Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
- Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
- Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts)
- Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts)
- Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
- Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
- Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
- Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
- Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
- /// \endcond
- public:
- /*!
- //~English
- Defines the selectable parts of a legend
-
- \see setSelectedParts, setSelectableParts
- //~Spanish
- Define la parte de seleccion de la leyenda
-
- \ver setStectedParts, setSelectableParts
- */
- enum SelectablePart { spNone = 0x000 ///< <tt>0x000</tt> None
- ///< Ninguno
- ,spLegendBox = 0x001 ///< <tt>0x001</tt> The legend box (frame)
- ///< El cuadro de las leyendas
- ,spItems = 0x002 ///< <tt>0x002</tt> Legend items individually (see \ref selectedItems)
- ///< Articulos individuales de la leyenda
- };
- Q_FLAGS(SelectablePart SelectableParts)
- Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
-
- explicit QCPLegend();
- virtual ~QCPLegend();
-
- // getters:
- // accesores:
- QPen borderPen() const { return mBorderPen; }
- QBrush brush() const { return mBrush; }
- QFont font() const { return mFont; }
- QColor textColor() const { return mTextColor; }
- QSize iconSize() const { return mIconSize; }
- int iconTextPadding() const { return mIconTextPadding; }
- QPen iconBorderPen() const { return mIconBorderPen; }
- SelectableParts selectableParts() const { return mSelectableParts; }
- SelectableParts selectedParts() const;
- QPen selectedBorderPen() const { return mSelectedBorderPen; }
- QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
- QBrush selectedBrush() const { return mSelectedBrush; }
- QFont selectedFont() const { return mSelectedFont; }
- QColor selectedTextColor() const { return mSelectedTextColor; }
-
- // setters:
- // modificadores:
- void setBorderPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- void setFont(const QFont &font);
- void setTextColor(const QColor &color);
- void setIconSize(const QSize &size);
- void setIconSize(int width, int height);
- void setIconTextPadding(int padding);
- void setIconBorderPen(const QPen &pen);
- void setSelectableParts(const SelectableParts &selectableParts);
- void setSelectedParts(const SelectableParts &selectedParts);
- void setSelectedBorderPen(const QPen &pen);
- void setSelectedIconBorderPen(const QPen &pen);
- void setSelectedBrush(const QBrush &brush);
- void setSelectedFont(const QFont &font);
- void setSelectedTextColor(const QColor &color);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- // non-virtual methods:
- // metodos no virtuales:
- QCPAbstractLegendItem *item(int index) const;
- QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
- int itemCount() const;
- bool hasItem(QCPAbstractLegendItem *item) const;
- bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
- bool addItem(QCPAbstractLegendItem *item);
- bool removeItem(int index);
- bool removeItem(QCPAbstractLegendItem *item);
- void clearItems();
- QList<QCPAbstractLegendItem*> selectedItems() const;
-
- signals:
- void selectionChanged(QCPLegend::SelectableParts selection);
-
- protected:
- // property members:
- // miembros con propiedades:
- QPen mBorderPen, mIconBorderPen;
- QBrush mBrush;
- QFont mFont;
- QColor mTextColor;
- QSize mIconSize;
- int mIconTextPadding;
- SelectableParts mSelectedParts, mSelectableParts;
- QPen mSelectedBorderPen, mSelectedIconBorderPen;
- QBrush mSelectedBrush;
- QFont mSelectedFont;
- QColor mSelectedTextColor;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void parentPlotInitialized(QCustomPlot *parentPlot);
- virtual QCP::Interaction selectionCategory() const;
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter);
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // non-virtual methods:
- // metodos no virtuales:
- QPen getBorderPen() const;
- QBrush getBrush() const;
-
- private:
- Q_DISABLE_COPY(QCPLegend)
-
- friend class QCustomPlot;
- friend class QCPAbstractLegendItem;
- };
- Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
- Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
-
-
- class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement
- {
- Q_OBJECT
- /// \cond INCLUDE_QPROPERTIES
- Q_PROPERTY(QString text READ text WRITE setText)
- Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
- Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
- Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
- Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
- Q_PROPERTY(bool selected READ selected WRITE setSelected)
- /// \endcond
- public:
- explicit QCPPlotTitle(QCustomPlot *parentPlot);
- explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);
-
- // getters:
- // accesores:
- QString text() const { return mText; }
- QFont font() const { return mFont; }
- QColor textColor() const { return mTextColor; }
- QFont selectedFont() const { return mSelectedFont; }
- QColor selectedTextColor() const { return mSelectedTextColor; }
- bool selectable() const { return mSelectable; }
- bool selected() const { return mSelected; }
-
- // setters:
- // modificadores:
- void setText(const QString &text);
- void setFont(const QFont &font);
- void setTextColor(const QColor &color);
- void setSelectedFont(const QFont &font);
- void setSelectedTextColor(const QColor &color);
- void setSelectable(bool selectable);
- void setSelected(bool selected);
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
-
- signals:
- void selectionChanged(bool selected);
-
- protected:
- // property members:
- // miembros con propiedades:
- QString mText;
- QFont mFont;
- QColor mTextColor;
- QFont mSelectedFont;
- QColor mSelectedTextColor;
- QRect mTextBoundingRect;
- bool mSelectable, mSelected;
-
- // reimplemented virtual methods:
- // metodos virtuales reimplementados:
- virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
- virtual void draw(QCPPainter *painter);
- virtual QSize minimumSizeHint() const;
- virtual QSize maximumSizeHint() const;
- // events:
- // eventos:
- virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
- virtual void deselectEvent(bool *selectionStateChanged);
-
- // non-virtual methods:
- // metodos no virtuales:
- QFont mainFont() const;
- QColor mainTextColor() const;
-
- private:
- Q_DISABLE_COPY(QCPPlotTitle)
- };
-
- #endif // QCUSTOMPLOT_H
|