本文整理汇总了C++中QwtPlotCanvas::setCursor方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCanvas::setCursor方法的具体用法?C++ QwtPlotCanvas::setCursor怎么用?C++ QwtPlotCanvas::setCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCanvas
的用法示例。
在下文中一共展示了QwtPlotCanvas::setCursor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
CanvasPicker::CanvasPicker( QwtPlot *plot ):
QObject( plot ),
d_selectedCurve( NULL ),
d_selectedPoint( -1 )
{
QwtPlotCanvas *canvas = qobject_cast<QwtPlotCanvas *>( plot->canvas() );
canvas->installEventFilter( this );
// We want the focus, but no focus rect. The
// selected point will be highlighted instead.
canvas->setFocusPolicy( Qt::StrongFocus );
#ifndef QT_NO_CURSOR
canvas->setCursor( Qt::PointingHandCursor );
#endif
canvas->setFocusIndicator( QwtPlotCanvas::ItemFocusIndicator );
canvas->setFocus();
const char *text =
"All points can be moved using the left mouse button "
"or with these keys:\n\n"
"- Up:\t\tSelect next curve\n"
"- Down:\t\tSelect previous curve\n"
"- Left, ´-´:\tSelect next point\n"
"- Right, ´+´:\tSelect previous point\n"
"- 7, 8, 9, 4, 6, 1, 2, 3:\tMove selected point";
canvas->setWhatsThis( text );
shiftCurveCursor( true );
}
示例2: QObject
CanvasPicker::CanvasPicker(Plot *plot):
QObject(plot),
d_selectedCurve(NULL),
d_selectedPoint(-1)
{
qDebug() << __FILE__ << __FUNCTION__;
QwtPlotCanvas *canvas = (QwtPlotCanvas*) plot->canvas();
canvas->installEventFilter(this);
// We want the focus, but no focus rect. The
// selected point will be highlighted instead.
canvas->setFocusPolicy(Qt::StrongFocus);
#ifndef QT_NO_CURSOR
canvas->setCursor(Qt::PointingHandCursor);
#endif
canvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
canvas->setFocus();
mousePressed = false;
accelerate = 0;
}
示例3: QwtPlotCanvas
PlotZoz::PlotZoz(QWidget *)
{
// Прозрачность полотна
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setFrameStyle(QFrame::NoFrame);
canvas->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
canvas->setPaintAttribute(QwtPlotCanvas::Opaque, false);
canvas->setAttribute(Qt::WA_OpaquePaintEvent, false);
canvas->setAutoFillBackground( false );
setCanvas(canvas);
plotLayout()->setAlignCanvasToScales(true);
// Отключаем щкалы деления
for (int i=0; i<QwtPlot::axisCnt; i++) {
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Ticks, false);
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Backbone, false);
}
pltSpectrogram = new PlotSpectr();
pltRasterData = new PlotRasterData();
pltGrid = new QwtPlotGrid;
pltGrid->enableXMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->enableYMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->setMajorPen(QPen(Qt::gray,0,Qt::DotLine)); // черный для основных делений
pltGrid->setMinorPen(QPen(Qt::gray,0,Qt::DotLine)); // серый для вспомогательных
pltGrid->attach(this);
setAxisMaxMajor(0,20);
setAxisMaxMinor(0,0);
setAxisMaxMajor(1,20);
setAxisMaxMinor(1,0);
setAxisMaxMajor(2,20);
setAxisMaxMinor(2,0);
setAxisMaxMajor(3,20);
setAxisMaxMinor(3,0);
canvas->setCursor(Qt::ArrowCursor);
setMouseTracking(true);
for (int i=0; i<QwtPlot::axisCnt; i++)
axisWidget(i)->setMouseTracking(true);
}
示例4: 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);
}
示例5: 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);
}