Silence Warnings: QFont::setPixelSize

4,006 views
Skip to first unread message

Brandon Hilkert

unread,
May 1, 2012, 12:49:04 PM5/1/12
to capybar...@googlegroups.com
I'm getting these on the output of my spec request specs...

QFont::setPixelSize: Pixel size <= 0 (0)

Is there a way to silence or resolve this?

Thanks,
Brandon

Joe Ferris

unread,
May 1, 2012, 12:55:42 PM5/1/12
to capybar...@googlegroups.com
Hey Brandon,

I don't think anybody's found a way to turn off warnings in general. If you do find a way, please let me know or submit a pull request.

Thanks,
-Joe

Brandon Hilkert

unread,
May 1, 2012, 1:18:28 PM5/1/12
to capybar...@googlegroups.com
Joe,

Thanks for the speedy reply. No problem. Just wanted to make sure I wasn't missing something obvious.

best,
Brandon

Mark Gibbins

unread,
May 1, 2012, 7:25:53 PM5/1/12
to capybar...@googlegroups.com
Have you tried defining 'QT_NO_DEBUG_OUTPUT' and 'QT_NO_WARNING_OUTPUT'?

Joe Ferris

unread,
May 2, 2012, 11:59:37 AM5/2/12
to capybar...@googlegroups.com
I haven't tried that yet; good find. Care to put together a pull request?

Mark Gibbins

unread,
May 4, 2012, 2:50:06 PM5/4/12
to capybar...@googlegroups.com
I was going to send one over, but I was in two minds about tests. Would you need one for this?

Joe Ferris

unread,
May 4, 2012, 4:37:05 PM5/4/12
to capybar...@googlegroups.com
Having one would be better, and we already have the ability to capture STDOUT from the server, so I don't think it will be too bad as long as it's easy to reproduce the issue in a test.

Mark Gibbins

unread,
May 8, 2012, 7:27:29 PM5/8/12
to capybar...@googlegroups.com
Okay, I've done some more digging around and it seems the debug messages may come out even if you supply those flags when building capybara-webkit if you're using the pre-built binary from homebrew, or simply a debug version. The homebrew formula builds with the configure flag "-with-debug-and-release", making it pop out the warnings no matter what. The solution is to use a release build of Qt, or just build it yourself. With a release build, the flags work and capybara-webkit stays silent. I'm finishing the test(s) now and should have a pull request for you soon.

Joe Ferris

unread,
May 9, 2012, 9:32:10 AM5/9/12
to capybar...@googlegroups.com
Hey Mark,

Thanks again for looking into this. I'm looking forward to the pull request.

-Joe

Mark Gibbins

unread,
May 11, 2012, 2:27:18 PM5/11/12
to capybar...@googlegroups.com
Hi Joe,

Turns out this is a bit more complex than I laid out above. It seems that even with those flags and a fresh release build of Qt, it still prints the debug messages. It has something to do with the strange (at least to me!) way that the QDebug lib works. Apparently it doesn't really matter what flags you use, it just blurts out these messages. So in the end I had to actually root out the exact message being printed (I discovered it in th QtGui lib as part of text rendering), rewrite all the debug messages in that lib to check for debug flags and then recompile it.

I'm not sure it's much of a problem for Rails developers as it sends the messages to STDOUT, but I was testing a command line client and it was failing the tests. Besides, It's just plain annoying!

If you need more details on the exact edits let me know, as it might fall out of the scope of the project now.

- Mark

Jan Maurits Faber

unread,
Jul 12, 2012, 8:20:03 AM7/12/12
to capybar...@googlegroups.com
I get the same annoying warnings. Since this bug seems to have been in Qt for years, perhaps there is a way to simply this particular message from the stderr stream? I haven't been successful in getting rid of them yet.

Joe Ferris

unread,
Jul 13, 2012, 12:53:13 PM7/13/12
to capybar...@googlegroups.com
I think you could set up some kind of a filter list using qInstallMsgHandler: http://qt-project.org/doc/qt-4.8/qtglobal.html#qInstallMsgHandler

Mark Gibbins

unread,
Jul 14, 2012, 9:11:32 AM7/14/12
to capybar...@googlegroups.com
FWIW, the actual edits to completely silence the warnings are very minimal (a conditional define in one function). What about just overriding the method that prints this message?

Joe Ferris

unread,
Jul 18, 2012, 9:21:50 PM7/18/12
to capybar...@googlegroups.com
Which function are you talking about? Are you suggesting that we override something from Qt?

Amin Ariana

unread,
Mar 18, 2013, 8:02:02 PM3/18/13
to capybar...@googlegroups.com
There's an open issue on this on GitHub: https://github.com/thoughtbot/capybara-webkit/issues/485 ... sadly, it references this thread without any new information. This is the only warning I get in my Capbara Webkit integration tests.

QFont::setPixelSize: Pixel size <= 0 (0)

There's a very old QT bug report for this, from 2 years ago as well:

Wonder what others did to suppress this warning successfully in Rails / RSpec? 

Joe Ferris

unread,
Mar 21, 2013, 10:21:53 AM3/21/13
to capybar...@googlegroups.com
You can suppress a number of warnings by installing a version of Qt that doesn't have DEBUG compiled in. Downloading the official versions (http://qt-project.org/downloads) is one way to do this.

We've also discussed a new feature that would allow people to filter messages by a pattern. I haven't had time to work on it yet, but if anybody's interested in contributing, please email me directly and I'll explain what would be involved in writing a pull request for it.

-Joe
--
You received this message because you are subscribed to the Google Groups "capybara-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capybara-webk...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Amin Ariana

unread,
Mar 21, 2013, 1:46:14 PM3/21/13
to capybar...@googlegroups.com
Thanks Joe -

FYI, fwiw I uninstalled my brew version of QT and installed the non-debug official 4.8 version. A ran my Capybara Webkit tests and I still do get the "QFont::setPixelSize: Pixel size <= 0 (0)" warning.



--
You received this message because you are subscribed to a topic in the Google Groups "capybara-webkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/capybara-webkit/n1xMK0HnMWo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to capybara-webk...@googlegroups.com.

Joe Ferris

unread,
Mar 21, 2013, 1:50:14 PM3/21/13
to capybar...@googlegroups.com
If you install a new version of Qt, you'll also need to recompile capybara-webkit by uninstalling and reinstalling.

You can figure out which version of Qt capybara-webkit is using with this command on OS X:

    otool -L $(bundle show capybara-webkit)/bin/webkit_server

I believe you can use `ldd` instead of `otool -L` on Linux.

-Joe

Amin Ariana

unread,
Mar 21, 2013, 2:35:24 PM3/21/13
to capybara-webkit
Thanks for the quick follow up Joe.

I uninstalled and reinstalled the gem, still get the same warning. Here is the output of the command you suggested after the reinstall (and I double checked that in between, the webkit_server directory was empty) :

QtWebKit.framework/Versions/4/QtWebKit (compatibility version 4.9.0, current version 4.9.3)
QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.4)
QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.4)
QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.4)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1105.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

Here's the qmake / QT version:

qmake -v
QMake version 2.01a
Using Qt version 4.8.4 in /Library/Frameworks

This is on Mac OSX Lion if that matters. Also I do have QT 5 installed in parallel to 4.8, but doesn't look like it's been used. I'm slightly surprised by the version that QtWebKit is listing (4.9).


Reply all
Reply to author
Forward
0 new messages