⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qwt__plot__printfilter_8cpp-source.html

📁 QWT5.01用于Qt开发的二维图形库程序
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Qwt User&apos;s Guide: qwt_plot_printfilter.cpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.6 --><div class="tabs">  <ul>    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>    <li><a href="classes.html"><span>Classes</span></a></li>    <li id="current"><a href="files.html"><span>Files</span></a></li>    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>  </ul></div><h1>qwt_plot_printfilter.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************</span><a name="l00002"></a>00002 <span class="comment"> * Qwt Widget Library</span><a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1997   Josef Wilgen</span><a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002   Uwe Rathmann</span><a name="l00005"></a>00005 <span class="comment"> * </span><a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span><a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the Qwt License, Version 1.0</span><a name="l00008"></a>00008 <span class="comment"> *****************************************************************************/</span><a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="comment">// vim: expandtab</span><a name="l00011"></a>00011 <a name="l00012"></a>00012 <span class="preprocessor">#include &lt;qmap.h&gt;</span><a name="l00013"></a>00013 <span class="preprocessor">#include "qwt_plot.h"</span><a name="l00014"></a>00014 <span class="preprocessor">#include "qwt_plot_grid.h"</span><a name="l00015"></a>00015 <span class="preprocessor">#include "qwt_plot_curve.h"</span><a name="l00016"></a>00016 <span class="preprocessor">#include "qwt_plot_marker.h"</span><a name="l00017"></a>00017 <span class="preprocessor">#include "qwt_symbol.h"</span><a name="l00018"></a>00018 <span class="preprocessor">#include "qwt_legend.h"</span><a name="l00019"></a>00019 <span class="preprocessor">#include "qwt_legend_item.h"</span><a name="l00020"></a>00020 <span class="preprocessor">#include "qwt_scale_widget.h"</span><a name="l00021"></a>00021 <span class="preprocessor">#include "qwt_text_label.h"</span><a name="l00022"></a>00022 <span class="preprocessor">#include "qwt_plot_printfilter.h"</span><a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#if QT_VERSION &lt; 0x040000</span><a name="l00025"></a>00025 <span class="preprocessor"></span><span class="keyword">typedef</span> QColorGroup Palette;<a name="l00026"></a>00026 <span class="preprocessor">#else</span><a name="l00027"></a>00027 <span class="preprocessor"></span><span class="keyword">typedef</span> QPalette Palette;<a name="l00028"></a>00028 <span class="preprocessor">#endif</span><a name="l00029"></a>00029 <span class="preprocessor"></span><a name="l00030"></a>00030 <span class="keyword">class </span>QwtPlotPrintFilter::PrivateData<a name="l00031"></a>00031 {<a name="l00032"></a>00032 <span class="keyword">public</span>:<a name="l00033"></a>00033     PrivateData():<a name="l00034"></a>00034         <a class="code" href="class_qwt_plot_print_filter.html#0f47c339382f3292d3e71e0585a008e4">options</a>(<a class="code" href="class_qwt_plot_print_filter.html">QwtPlotPrintFilter</a>::PrintAll),<a name="l00035"></a>00035         cache(NULL)<a name="l00036"></a>00036     {<a name="l00037"></a>00037     }<a name="l00038"></a>00038 <a name="l00039"></a>00039     ~PrivateData()<a name="l00040"></a>00040     {<a name="l00041"></a>00041         <span class="keyword">delete</span> cache;<a name="l00042"></a>00042     }<a name="l00043"></a>00043 <a name="l00044"></a>00044     <span class="keyword">class </span>Cache<a name="l00045"></a>00045     {<a name="l00046"></a>00046     <span class="keyword">public</span>:<a name="l00047"></a>00047         QColor titleColor;<a name="l00048"></a>00048         QFont titleFont;<a name="l00049"></a>00049 <a name="l00050"></a>00050         <a class="code" href="class_qwt_text.html">QwtText</a> scaleTitle[QwtPlot::axisCnt];<a name="l00051"></a>00051         QColor scaleColor[QwtPlot::axisCnt];<a name="l00052"></a>00052         QFont scaleFont[QwtPlot::axisCnt];<a name="l00053"></a>00053         QColor scaleTitleColor[QwtPlot::axisCnt];<a name="l00054"></a>00054         QFont scaleTitleFont[QwtPlot::axisCnt];<a name="l00055"></a>00055 <a name="l00056"></a>00056         QMap&lt;QWidget *, QFont&gt; legendFonts;<a name="l00057"></a>00057 <a name="l00058"></a>00058         QColor widgetBackground;<a name="l00059"></a>00059         QColor canvasBackground;<a name="l00060"></a>00060         QColor gridColors[2];<a name="l00061"></a>00061 <a name="l00062"></a>00062         QMap&lt;const QwtPlotItem *, QColor&gt; curveColors;<a name="l00063"></a>00063         QMap&lt;const QwtPlotItem *, QColor&gt; curveSymbolBrushColors;<a name="l00064"></a>00064         QMap&lt;const QwtPlotItem *, QColor&gt; curveSymbolPenColors;<a name="l00065"></a>00065 <a name="l00066"></a>00066         QMap&lt;const QwtPlotItem *, QFont&gt; markerFonts;<a name="l00067"></a>00067         QMap&lt;const QwtPlotItem *, QColor&gt; markerLabelColors;<a name="l00068"></a>00068         QMap&lt;const QwtPlotItem *, QColor&gt; markerLineColors;<a name="l00069"></a>00069         QMap&lt;const QwtPlotItem *, QColor&gt; markerSymbolBrushColors;<a name="l00070"></a>00070         QMap&lt;const QwtPlotItem *, QColor&gt; markerSymbolPenColors;<a name="l00071"></a>00071     };<a name="l00072"></a>00072 <a name="l00073"></a>00073     <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_print_filter.html#0f47c339382f3292d3e71e0585a008e4">options</a>;<a name="l00074"></a>00074     <span class="keyword">mutable</span> Cache *cache;<a name="l00075"></a>00075 };<a name="l00076"></a>00076 <a name="l00077"></a>00077 <a name="l00082"></a><a class="code" href="class_qwt_plot_print_filter.html#1c8c0c540ca0432be6c264e9663aecc0">00082</a> <a class="code" href="class_qwt_plot_print_filter.html#1c8c0c540ca0432be6c264e9663aecc0">QwtPlotPrintFilter::QwtPlotPrintFilter</a>()<a name="l00083"></a>00083 {<a name="l00084"></a>00084     d_data = <span class="keyword">new</span> PrivateData;<a name="l00085"></a>00085 }<a name="l00086"></a>00086 <a name="l00088"></a><a class="code" href="class_qwt_plot_print_filter.html#852775768c0b37edeb57abdfcb175a7f">00088</a> <a class="code" href="class_qwt_plot_print_filter.html#852775768c0b37edeb57abdfcb175a7f">QwtPlotPrintFilter::~QwtPlotPrintFilter</a>()<a name="l00089"></a>00089 {<a name="l00090"></a>00090     <span class="keyword">delete</span> d_data;<a name="l00091"></a>00091 }<a name="l00092"></a>00092 <a name="l00099"></a><a class="code" href="class_qwt_plot_print_filter.html#b5a3f3df821b67812e40ffdcaca3b6b5">00099</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_print_filter.html#b5a3f3df821b67812e40ffdcaca3b6b5">QwtPlotPrintFilter::setOptions</a>(<span class="keywordtype">int</span> options) <a name="l00100"></a>00100 { <a name="l00101"></a>00101     d_data-&gt;options = options; <a name="l00102"></a>00102 }<a name="l00103"></a>00103 <a name="l00108"></a><a class="code" href="class_qwt_plot_print_filter.html#0f47c339382f3292d3e71e0585a008e4">00108</a> <span class="keywordtype">int</span> <a class="code" href="class_qwt_plot_print_filter.html#0f47c339382f3292d3e71e0585a008e4">QwtPlotPrintFilter::options</a>()<span class="keyword"> const </span><a name="l00109"></a>00109 <span class="keyword"></span>{ <a name="l00110"></a>00110     <span class="keywordflow">return</span> d_data-&gt;options; <a name="l00111"></a>00111 }<a name="l00112"></a>00112 <a name="l00124"></a><a class="code" href="class_qwt_plot_print_filter.html#31fc7c9789cfa1044115c41ce349e46d">00124</a> QColor <a class="code" href="class_qwt_plot_print_filter.html#31fc7c9789cfa1044115c41ce349e46d">QwtPlotPrintFilter::color</a>(<span class="keyword">const</span> QColor &amp;c, <a class="code" href="class_qwt_plot_print_filter.html#9a9eae5c90f51ef61f973b4c2fba0665">Item</a> item)<span class="keyword"> const</span><a name="l00125"></a>00125 <span class="keyword"></span>{<a name="l00126"></a>00126     <span class="keywordflow">if</span> ( !(<a class="code" href="class_qwt_plot_print_filter.html#0f47c339382f3292d3e71e0585a008e4">options</a>() &amp; PrintCanvasBackground))<a name="l00127"></a>00127     {<a name="l00128"></a>00128         <span class="keywordflow">switch</span>(item)<a name="l00129"></a>00129         {<a name="l00130"></a>00130             <span class="keywordflow">case</span> MajorGrid:<a name="l00131"></a>00131                 <span class="keywordflow">return</span> Qt::darkGray;<a name="l00132"></a>00132             <span class="keywordflow">case</span> MinorGrid:<a name="l00133"></a>00133                 <span class="keywordflow">return</span> Qt::gray;<a name="l00134"></a>00134             <span class="keywordflow">default</span>:;<a name="l00135"></a>00135         }<a name="l00136"></a>00136     }<a name="l00137"></a>00137     <span class="keywordflow">return</span> c;<a name="l00138"></a>00138 }<a name="l00139"></a>00139 <a name="l00148"></a><a class="code" href="class_qwt_plot_print_filter.html#4be8e414cc8000de7b9d1359b6834379">00148</a> QFont <a class="code" href="class_qwt_plot_print_filter.html#4be8e414cc8000de7b9d1359b6834379">QwtPlotPrintFilter::font</a>(<span class="keyword">const</span> QFont &amp;f, <a class="code" href="class_qwt_plot_print_filter.html#9a9eae5c90f51ef61f973b4c2fba0665">Item</a>)<span class="keyword"> const</span><a name="l00149"></a>00149 <span class="keyword"></span>{<a name="l00150"></a>00150     <span class="keywordflow">return</span> f;<a name="l00151"></a>00151 }<a name="l00152"></a>00152 <a name="l00157"></a><a class="code" href="class_qwt_plot_print_filter.html#b6ce402443e59a6f4fc68dc24cc6b2ad">00157</a> <span class="keywordtype">void</span> <a class="code" href="class_qwt_plot_print_filter.html#b6ce402443e59a6f4fc68dc24cc6b2ad">QwtPlotPrintFilter::apply</a>(<a class="code" href="class_qwt_plot.html">QwtPlot</a> *plot)<span class="keyword"> const</span><a name="l00158"></a>00158 <span class="keyword"></span>{<a name="l00159"></a>00159     <span class="keyword">const</span> <span class="keywordtype">bool</span> doAutoReplot = plot-&gt;<a class="code" href="class_qwt_plot.html#f14053ca41be0f9c6f820ed3c4379831">autoReplot</a>();<a name="l00160"></a>00160     plot-&gt;<a class="code" href="class_qwt_plot.html#654934ec2ad167101dacb5174f5172d6">setAutoReplot</a>(<span class="keyword">false</span>);<a name="l00161"></a>00161 <a name="l00162"></a>00162     <span class="keyword">delete</span> d_data-&gt;cache;<a name="l00163"></a>00163     d_data-&gt;cache = <span class="keyword">new</span> PrivateData::Cache;<a name="l00164"></a>00164 <a name="l00165"></a>00165     PrivateData::Cache &amp;cache = *d_data-&gt;cache;<a name="l00166"></a>00166 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -