unable to set border for canvas in qwt
Hi friends/experts,
im using Qt.5.7 and qwt version 6.1.2
i tired to initialize qwt plot by following
Code:
pLayout->setCanvasMargin(0);
pLayout->setAlignCanvasToScales (true);
//Canvas setup
m_pCanvas->setLineWidth( 1);
m_pCanvas->setContentsMargins(0,0,0,0);
m_pCanvas
->setPaintAttribute
(QwtPlotCanvas::BackingStore,
false);
m_pCanvas->setAttribute( Qt::WA_OpaquePaintEvent, false );
m_pCanvas->setAutoFillBackground( false);
background.setAlpha(255);
palette.
setColor(QPalette::Window, background
);
setPalette(palette);
setCanvasBackground (background);
setAttribute(Qt::WA_TranslucentBackground);
setCanvas( m_pCanvas );
but line width or border of canvas is not visible at all.
i tired setting canvas color
as
QPalette p = palette();
p.setColor(QPalette::Window, color);
canvas()->setPalette(p);
canvas()->setAutoFillBackground(true);
but canvas color is not reflecting in the plot.
please help me and suggest me some solution. same was working in qt.4.7
Re: unable to set border for canvas in qwt
This line kills the border:
Quote:
Originally Posted by
wagmare
m_pCanvas->setContentsMargins(0,0,0,0);
In earlier Qt versions only QFrame had a contentsRect and the margins were the frame width. This has been changed with Qt4, leaving frames having this odd relationship to the margins.
Uwe