https://bugs.kde.org/show_bug.cgi?id=378313

            Bug ID: 378313
           Summary: Remove QTLayout warning from startup logs (Patch)
           Product: krita
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Keywords: junior-jobs
          Severity: minor
          Priority: NOR
         Component: general
          Assignee: krita-bugs-n...@kde.org
          Reporter: brunodepau...@yahoo.com.br
  Target Milestone: ---

Created attachment 104830
  --> https://bugs.kde.org/attachment.cgi?id=104830&action=edit
Patch

Hi, for a while I noticed the following message in my console when starting
Krita:

    QLayout: Attempting to add QLayout "" to QWidget "", which already has a
layout

Today while testing the appimage for 3.1.3-alpha-2 I decided to check why that
was happening.

Learned that when you create a Layout passing a widget via constructor, it then
sets itself as the main layout for that widget. Then debugging the Docker
factory creation loop, found that the HistoryDocker was being created with a
QVBoxLayout(this) and QHBoxLayout(this). So the second time a layout was
created, the warning was raised.

Spent some time searching the web for example on how people create widgets with
V+H box layouts, and the general consensus seems to create the horizontal
passing nothing in the constructor, then the vertical with the widget in the
constructor, and finally add the hboxlayout to the vboxlayout (e.g.
http://zetcode.com/gui/qt4/layoutmanagement/).

Attached a patch created against the latest commit to the master branch.

Testing locally, the behaviour of the History Docker seemed to be the same
(both H + V scroll bars working, can successfully go back and forth in history,
etc).

Hope that helps!
Bruno

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to