Important: Please read the Qt Code of Conduct -

How to apply patch .diff file?

  • I was hoping this bug fix ( will make it to 5.12 LTS branch but looks like that's not happening, so I have to manually apply the .diff file someone shared in comment section.

    Never applied a patch before. Is there a tutorial anywhere on how to apply .diff file? I couldn't find one. Working with VS2017 on Windows 10.

  • Lifetime Qt Champion


    You can go to the Gerrit page of the patch you want to apply and then select cherry-pick. Go into you cloned source and copy paste the commands given.

    Or if you download the file, check the git apply documentation.

  • @SGaist I've been trying to apply the patch as below:

    1. Download and unzip Qt Source code in folder 5.12.5
    2. cd to 5.12.5\qtbase
    3. git init
    4. git add . (I see lots of LF -> CRLF warning message)
    5. git apply --stat <patch filename> (Shows several lines of changes)
    6. git apply --check <patch filename> (No output)
    7. git apply <patch filename> (No output)
    8. git apply --check <patch filename> (Shows several lines of error patch does not apply, so assuming patch applied successfully?)
    9. run the Exact same configure command that I successfully used on code without patch applied, it starts and then after 10-15 seconds fails with error:

    Info: creating super cache file C:\Qt\Static\5.12.5_build.qmake.super
    Info: creating cache file C:\Qt\Static\5.12.5_build.qmake.cache
    ERROR: Unknown command line option '-commercial'.

    '-commercial' is the first argument after configure, if I remove commerical, then it fails showing the next argument in error message "-static".

  • Lifetime Qt Champion

    Hi @Taytoo,

    if you want to apply patches, you should not download the source zip file, but rather build Qt directly from Git.


Log in to reply