<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to remove black border around widget?]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I am writing Qt application under Linux for displaing electronic maps. After drawing onto QLabel and resizing window I have a black border around QLabel (before resizing everything is fine).<br />
I am drawing bitmap with Xlib function XPutImage to speed-up drawing</p>
<p dir="auto">@void MapView::paintEvent(QPaintEvent *)<br />
{<br />
GC context = XCreateGC(QX11Info::display(), winId(), 0, NULL);<br />
XPutImage(QX11Info::display(), winId(), context, scr-&gt;ximage, 0, 0, 0, 0, scr-&gt;W, scr-&gt;H);<br />
XFreeGC(QX11Info::display(), context);<br />
}@</p>
<p dir="auto">@MapView::MapView(QWidget *parent) :<br />
QLabel(parent)<br />
{<br />
setBackgroundRole(QPalette::Base);<br />
setAttribute(Qt::WA_PaintOnScreen);<br />
setAttribute(Qt::WA_NoSystemBackground);<br />
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);<br />
setFrameShape(QFrame::NoFrame);<br />
setScaledContents(true);<br />
setMouseTracking(true);<br />
}@<br />
and the main window widget<br />
@ImageViewer::ImageViewer()<br />
{<br />
scrollArea = new QScrollArea;<br />
mapView = new MapView(scrollArea);<br />
scrollArea-&gt;setWidget(mapView);<br />
setCentralWidget(scrollArea);<br />
}@</p>
<p dir="auto">what is my mistake?</p>
<p dir="auto">!<a href="http://imageshack.us/photo/my-images/442/pic3o.png/(screenshot)" target="_blank" rel="noopener noreferrer nofollow ugc">http://imageshack.us/photo/my-images/442/pic3o.png/(screenshot)</a>!</p>
]]></description><link>https://forum.qt.io/topic/10974/how-to-remove-black-border-around-widget</link><generator>RSS for Node</generator><lastBuildDate>Wed, 04 Nov 2026 21:32:34 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/10974.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Nov 2011 15:20:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to remove black border around widget? on Wed, 09 Nov 2011 13:48:27 GMT]]></title><description><![CDATA[<p dir="auto">I think that Qt QScroll area works wrong - I have reimplemented it and had no problems with borders!</p>
]]></description><link>https://forum.qt.io/post/116219</link><guid isPermaLink="true">https://forum.qt.io/post/116219</guid><dc:creator><![CDATA[bushlyamax]]></dc:creator><pubDate>Wed, 09 Nov 2011 13:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Tue, 08 Nov 2011 14:01:01 GMT]]></title><description><![CDATA[<p dir="auto">I have tryed both - inside constructor and outside.<br />
Another variant is to draw bitmap with OpenGL and GLWidget<br />
@glDrawPixels(scr-&gt;W, scr-&gt;H, GL_BGRA, GL_UNSIGNED_BYTE, (const GLvoid *)scr-&gt;bitmap);@<br />
and the same effect - black border around my GLWidget. I am in frustration!)</p>
]]></description><link>https://forum.qt.io/post/116066</link><guid isPermaLink="true">https://forum.qt.io/post/116066</guid><dc:creator><![CDATA[bushlyamax]]></dc:creator><pubDate>Tue, 08 Nov 2011 14:01:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Tue, 08 Nov 2011 13:46:36 GMT]]></title><description><![CDATA[<p dir="auto">Where are you setting the stylesheet?  In the MapView constructor?  Not sure why a custom paintEvent would get in the way.   We do it all of the time but without the custom paintEvent.</p>
]]></description><link>https://forum.qt.io/post/116065</link><guid isPermaLink="true">https://forum.qt.io/post/116065</guid><dc:creator><![CDATA[rturrentine]]></dc:creator><pubDate>Tue, 08 Nov 2011 13:46:36 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Tue, 08 Nov 2011 13:34:10 GMT]]></title><description><![CDATA[<p dir="auto">setStyleSheet("QLabel {border: 0px;}") + custom paintEvent causes an internal error</p>
]]></description><link>https://forum.qt.io/post/116062</link><guid isPermaLink="true">https://forum.qt.io/post/116062</guid><dc:creator><![CDATA[bushlyamax]]></dc:creator><pubDate>Tue, 08 Nov 2011 13:34:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Mon, 07 Nov 2011 15:48:58 GMT]]></title><description><![CDATA[<p dir="auto">Create a style with a 0 border width and call setStyleSheet.</p>
]]></description><link>https://forum.qt.io/post/115944</link><guid isPermaLink="true">https://forum.qt.io/post/115944</guid><dc:creator><![CDATA[rturrentine]]></dc:creator><pubDate>Mon, 07 Nov 2011 15:48:58 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Mon, 07 Nov 2011 13:24:28 GMT]]></title><description><![CDATA[<p dir="auto">As I understand, the problem is with custom painting in painEvent() and property Qt::WA_NoSystemBackground - without this property there is no black border but after my painting by XPutImage() my qLabel widget immidiately repaints with background color</p>
]]></description><link>https://forum.qt.io/post/115909</link><guid isPermaLink="true">https://forum.qt.io/post/115909</guid><dc:creator><![CDATA[bushlyamax]]></dc:creator><pubDate>Mon, 07 Nov 2011 13:24:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Mon, 07 Nov 2011 12:13:38 GMT]]></title><description><![CDATA[<p dir="auto">to Hostel:<br />
these methods did not made any effect<br />
I think that problem is bit deeper inside the Qt</p>
<p dir="auto">to Kxyu:<br />
I am trying to draw bitmap with XPutImage.<br />
All is right when i am drawing bitmap with<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/qimage">@<bdi>QImage</bdi></a> im(bitmap, width, height, Q_RGBA......);<br />
label-&gt;setPixmap(QPixmap::fromImage(im));@<br />
but it is too slow for me</p>
]]></description><link>https://forum.qt.io/post/115899</link><guid isPermaLink="true">https://forum.qt.io/post/115899</guid><dc:creator><![CDATA[bushlyamax]]></dc:creator><pubDate>Mon, 07 Nov 2011 12:13:38 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Fri, 04 Nov 2011 06:05:04 GMT]]></title><description><![CDATA[<p dir="auto">Have you tried drawing bitmap with Qt?</p>
]]></description><link>https://forum.qt.io/post/115545</link><guid isPermaLink="true">https://forum.qt.io/post/115545</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 04 Nov 2011 06:05:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove black border around widget? on Thu, 03 Nov 2011 14:55:15 GMT]]></title><description><![CDATA[<p dir="auto">QLabel has a methods:<br />
[code]<br />
setFrameShape()<br />
setFrameShadow()<br />
setLineWidth() // set to 0?<br />
setMidLineWidth()<br />
[/code]<br />
maybe this will help you.</p>
]]></description><link>https://forum.qt.io/post/115490</link><guid isPermaLink="true">https://forum.qt.io/post/115490</guid><dc:creator><![CDATA[Hostel]]></dc:creator><pubDate>Thu, 03 Nov 2011 14:55:15 GMT</pubDate></item></channel></rss>