[PyQt] QDockWidget offset?

Matic Kukovec kukovecmatic at hotmail.com
Wed Apr 11 17:49:42 BST 2018


Hi Tony,

I set the QGroupBox as the main widget of the QDockWidget like so:

self.main_groupbox = data.QGroupBox()
self.main_groupbox.setGeometry(0, 0,width, height)
# Set it as the main widget
self.setWidget(self.main_groupbox)

I do not know how to add the groupbox to the dockWidgetsContents  as you mentioned, can you please give me an example.

Thanks,
Matic
________________________________
From: Tony Arnold <tony.arnold at manchester.ac.uk>
Sent: Wednesday, April 11, 2018 6:20 PM
To: pyqt at riverbankcomputing.com; kukovecmatic at hotmail.com
Subject: Re: [PyQt] QDockWidget offset?

Matic,


On Wed, 2018-04-11 at 14:20 +0000, Matic Kukovec wrote:
> Hi guys,
>
> I have a QDockWidget onto which I add a QGroupbox. On Windows, there
> are no problems.
> But on Linux there is border with a gap on top from the windows
> frame, with the size similar to a system's menubar.
> To illustrate this I added a screenshot in the attachment that shows
> a QDockWidget that has a QGroupBox added with the 'setWidget'
> function and a QPushButton added to the QGroupBox.
> On the left is the Windows example and on the right is the Linux
> example with the border drawn behind the QPushButton.
>
> How do I get rid of this border on Linux?

Is your QGroupBox contained within the dockWidgetsContents widget, that
is usually in a QDockWidget and is effectively a layout, or has it
replaced it? I think you need to keep the dockWidgetsContent and add
any other widgets to that and not to the QDockWidget directly.

Your widget structure or the code that creates the QDockWidget instance
would be helpful here.

Regards,
Tony.
--
Tony Arnold MBCS, CITP | Senior IT Security Analyst | Directorate of IT Services | G64, Kilburn Building | The University of Manchester | Manchester M13 9PL | T: +44 161 275 6093 | M: +44 773 330 0039
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180411/6629955d/attachment.html>


More information about the PyQt mailing list