Bug 378313 - Remove QTLayout warning from startup logs (Patch)
Summary: Remove QTLayout warning from startup logs (Patch)
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2017-03-31 11:07 UTC by Bruno P. Kinoshita
Modified: 2017-03-31 14:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch (917 bytes, patch)
2017-03-31 11:07 UTC, Bruno P. Kinoshita
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno P. Kinoshita 2017-03-31 11:07:58 UTC
Created attachment 104830 [details]
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
Comment 1 Halla Rempt 2017-03-31 14:43:46 UTC
Git commit 1d2343c0cacfb0b105fbe86c2bcef975a09b1041 by Boudewijn Rempt.
Committed on 31/03/2017 at 14:38.
Pushed by rempt into branch 'master'.

Patch by  Bruno P. Kinoshita, Thanks!

M  +2    -1    plugins/dockers/historydocker/HistoryDock.cpp

https://commits.kde.org/krita/1d2343c0cacfb0b105fbe86c2bcef975a09b1041