[branch 1.2] Problems with debug build in Qt Creator on Windows - also fixed SVG output

• Feb 5, 2012 - 21:16
Type
Functional
Severity
S4 - Minor
Status
closed
Project

I tried to do a debug build for 1.2 following the instructions here:
//musescore.org/en/developers-handbook/compile-instructions-windows-mingw-svn-trunk
which worked for the trunk.

But for the branch, when trying to launch the application, I received the message in Qt Creator:
"this does not seem to be a debug build"

I tracked the problem down:
In mscore\mscore\CMakeLists.txt we find these lines:

if(CMAKE_BUILD_TYPE MATCHES "Debug")
else(CMAKE_BUILD_TYPE MATCHES "Debug")
endif(CMAKE_BUILD_TYPE MATCHES "Debug")

This should be "DEBUG" as in the trunk. When changing it to "DEBUG" the debug build works and the message goes away.

However, the Qt debugger still doesn't work, so perhaps someone can shed some light on this. It simply crashes when launching (after the splash screen has been displayed) with this message:

gdb-i686-pc-mingw32.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

I tracked the problem further. I stepped though and it crashes in mscore.cpp in main() on:
pdev = new QPrinter(QPrinter::HighResolution);
This is a known problem in Qt Creator: //bugreports.qt-project.org/browse/QTBUG-14048
14798.png

Attachment Size
CMakeLists.txt.patch 1.22 KB
14798.png 61.81 KB

Comments

We could change the code to what we have in the trunk, that is, no instantiation of QPrinter. Quoting from the trunk:

QWidget wi(0);
PDPI = wi.logicalDpiX(); // physical resolution
DPI = PDPI; // logical drawing resolution
DPMM = DPI / INCH; // dots/mm

With this change the branch can be successfully started in the Qt Creator Debugger, which I think is a good thing.

The sad thing is, that main() initialises a global variable pdev, which is referenced in text.cpp and file.cpp.

Anyway, I enclose a patch which works for me.

Attachment Size
14798.patch 1.24 KB

CMakeLists.txt was corrected, as well as the Windows makefile Makefile.mingw. R5291. The crash problem (QPrinter) remains.

I commited a modified version of the patch about QPrinter in r5297.
Please test. Especially if someone has a working Mac build environment, please test.
Test should include add lyrics, frame text and export as PDF and print.

Status (old) fixed patch (ready to commit)

The previous fix wasn't quite right, since the global pdev was initialised to non-null at initialisation, QPrinter would never have been instantiated during print, so I doubt it would have printed well.

The new patch corrects this issue and furthermore removes the global pdev completely. It was really only used in text.cpp in these lines:
return QFontMetricsF(doc()->defaultFont(), pdev).lineSpacing();
QFontMetricsF fm(doc()->defaultFont(), pdev);

According to Lasconic that wasn't necessary, so pdev could be removed entirely.

P.S.: On Windows a score I tried now looks OK, prints OK and exports OK to PNG and PDF. However, the SVG looks pretty terrible when opened in GIMP. I tried a SVG created with 1.1 and that looks even worse, the text came out huge, with the 1.2 patch at least the text size was about right. Does anyone care to see the SVG files, they are rather large, about 2 MB each?

I tried with the trunk. Here the SVG output looks good.

Attachment Size
14798-take2.patch 2.51 KB

As stated in comment #6, the SVG output has somewhat improved through this change. Before it was terrible, not it's pretty bad. See enclosed. The problem is that on a score with more than one page, the second page is drawn on to of the first one. The next comment shows the result with a one-sided score.

1.1
NOT FOUND: 01

1.2
NOT FOUND: 02

Attachment Size
1.1.png 175.57 KB
1.2.png 142.13 KB
Title [branch 1.2] Problems with debug build in Qt Creator on Windows [branch 1.2] Problems with debug build in Qt Creator on Windows - also fixed SVG output

I am happy to report that the changes we made for this problem, that is removing the global "pdev" and changing some text scaling code, had a very positive side effect. SVG output of a one-page document works now, the text scaling problems reported in //musescore.org/en/node/9945 and //musescore.org/en/node/7446 are now fixed.

Below is the output shown in Firefox, left produced with 1.1, right produced with branch 1.2.
NOT FOUND: 01

Attachment Size
14798-2.png 67.91 KB