本文整理汇总了C++中QwtPlotCanvas::setFrameShadow方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCanvas::setFrameShadow方法的具体用法?C++ QwtPlotCanvas::setFrameShadow怎么用?C++ QwtPlotCanvas::setFrameShadow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCanvas
的用法示例。
在下文中一共展示了QwtPlotCanvas::setFrameShadow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QwtPlot
Plot::Plot(QWidget *parent, const char *name)
: QwtPlot(parent)
{
marker_key = 0;
curve_key = 0;
minTickLength = 5;
majTickLength = 9;
movedGraph=FALSE;
graphToResize=FALSE;
ShiftButton=FALSE;
setGeometry(QRect(0,0,500,400));
setAxisTitle(QwtPlot::yLeft, tr("Y Axis Title"));
setAxisTitle(QwtPlot::xBottom, tr("X Axis Title"));
// grid
d_grid = new Grid;
d_grid->enableX(false);
d_grid->enableY(false);
d_grid->setMajPen(QPen(Qt::blue, 0, Qt::SolidLine));
d_grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
d_grid->attach(this);
//custom scale
for (int i= 0; i<QwtPlot::axisCnt; i++)
{
QwtScaleWidget *scale = (QwtScaleWidget *) axisWidget(i);
if (scale)
{
scale->setMargin(0);
//the axis title color must be initialized
QwtText title = scale->title();
title.setColor(Qt::black);
scale->setTitle(title);
ScaleDraw *sd = new ScaleDraw();
sd->setTickLength (QwtScaleDiv::MinorTick, minTickLength);
sd->setTickLength (QwtScaleDiv::MediumTick, minTickLength);
sd->setTickLength (QwtScaleDiv::MajorTick, majTickLength);
setAxisScaleDraw (i, sd);
}
}
QwtPlotLayout *pLayout=plotLayout();
pLayout->setCanvasMargin(0);
QwtPlotCanvas* plCanvas = canvas();
plCanvas->setFocusPolicy(QWidget::StrongFocus);
plCanvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
plCanvas->setFocus();
plCanvas->setFrameShadow(QwtPlot::Plain);
plCanvas->setCursor(Qt::arrowCursor);
plCanvas->setLineWidth(0);
setFocusPolicy(QWidget::StrongFocus);
setFocusProxy(plCanvas);
setFrameShape (QFrame::Box);
setLineWidth(0);
}
示例2: QwtPlot
Plot::Plot(int width, int height, QWidget *parent, const char *)
: QwtPlot(parent)
{
setAutoReplot (false);
marker_key = 0;
curve_key = 0;
minTickLength = 5;
majTickLength = 9;
setGeometry(QRect(0, 0, width, height));
setAxisTitle(QwtPlot::yLeft, tr("Y Axis Title"));
setAxisTitle(QwtPlot::xBottom, tr("X Axis Title"));
//due to the plot layout updates, we must always have a non empty title
setAxisTitle(QwtPlot::yRight, tr(" "));
setAxisTitle(QwtPlot::xTop, tr(" "));
// grid
d_grid = new Grid();
d_grid->attach(this);
//custom scale
for (int i= 0; i<QwtPlot::axisCnt; i++) {
QwtScaleWidget *scale = (QwtScaleWidget *) axisWidget(i);
if (scale) {
scale->setMargin(0);
//the axis title color must be initialized...
QwtText title = scale->title();
title.setColor(Qt::black);
scale->setTitle(title);
//...same for axis color
QPalette pal = scale->palette();
pal.setColor(QPalette::Foreground, QColor(Qt::black));
scale->setPalette(pal);
ScaleDraw *sd = new ScaleDraw(this);
sd->setTickLength(QwtScaleDiv::MinorTick, minTickLength);
sd->setTickLength(QwtScaleDiv::MediumTick, minTickLength);
sd->setTickLength(QwtScaleDiv::MajorTick, majTickLength);
setAxisScaleDraw (i, sd);
setAxisScaleEngine (i, new ScaleEngine());
}
}
QwtPlotLayout *pLayout = plotLayout();
pLayout->setCanvasMargin(0);
pLayout->setAlignCanvasToScales (true);
QwtPlotCanvas* plCanvas = canvas();
plCanvas->setFocusPolicy(Qt::StrongFocus);
plCanvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
//plCanvas->setFocus();
plCanvas->setFrameShadow(QwtPlot::Plain);
plCanvas->setCursor(Qt::arrowCursor);
plCanvas->setLineWidth(0);
plCanvas->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
plCanvas->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
QColor background = QColor(Qt::white);
background.setAlpha(255);
QPalette palette;
palette.setColor(QPalette::Window, background);
setPalette(palette);
setCanvasBackground (background);
setFocusPolicy(Qt::StrongFocus);
//setFocusProxy(plCanvas);
setFrameShape(QFrame::Box);
setLineWidth(0);
}