[Kde-bindings] Using threads with QtRuby

Richard Dale rdale at foton.es
Fri Feb 5 18:12:49 UTC 2010


On Friday 05 February 2010 05:42:34 pm Uriel wrote:
> > Looks a good idea. Maybe rather than alias the standard exec() we
> > could add an
> > exec_with_threads() method?
> 
> The whole point of making it 'smarter' for me was just to get rid of the
> bunch of such lines in debug output:
> ...
> getPointerObject 0x9019c08 -> 0x91d68fc
> module: qt virtual 0x9019c08->QApplication::notify(QObject*, QEvent*)
>  called getPointerObject 0x9019c08 -> 0x91d68fc
> module: qt virtual 0x9019c08->QApplication::event(QEvent*) called
> getPointerObject 0x9019c08 -> 0x91d68fc
> module: qt virtual 0x9019c08->QObject::timerEvent(QTimerEvent*) called
> getPointerObject 0xbf960750 -> nil
> allocating Qt::TimerEvent 0xbf960750 -> 0x93b6380
> ...Thousands of them :)...
But you only get a log of vitual method callbacks if you want them. The are 
various levels and types of debug output and it is quite easy to customize.

From the top of qtruby4.rb

 	module DebugLevel
		Off, Minimal, High, Extensive = 0, 1, 2, 3
	end

	module QtDebugChannel 
		QTDB_NONE = 0x00
		QTDB_AMBIGUOUS = 0x01
		QTDB_METHOD_MISSING = 0x02
		QTDB_CALLS = 0x04
		QTDB_GC = 0x08
		QTDB_VIRTUAL = 0x10
		QTDB_VERBOSE = 0x20
		QTDB_ALL = QTDB_VERBOSE | QTDB_VIRTUAL | 
                                QTDB_GC | QTDB_CALLS | QTDB_METHOD_MISSING |
                               QTDB_AMBIGUOUS
	end

	@@debug_level = DebugLevel::Off
	def Qt.debug_level=(level)
		@@debug_level = level
		Internal::setDebug Qt::QtDebugChannel::QTDB_ALL if level >= 
DebugLevel::Extensive
	end

	def Qt.debug_level
		@@debug_level
	end

Maybe it is a bit over complicated but you will only get virtual method 
callbacks logged if one of the things you pass to Qt::Internal.setDebug() is 
QTDB_VIRTUAL. 

If you set Qt.debug_level to Qt::DebugLevel::Extensive it does turn on virtual 
method callback logging. So try setting Qt.debug_level to Qt::DebugLevel::High 
instead of 'Extensive' perhaps.

-- Richard



More information about the Kde-bindings mailing list