[Kde-bindings] Qyoto: Movable QDockWidgets

Richard Dale rdale at foton.es
Wed Oct 18 22:32:41 UTC 2006


On Wednesday 18 October 2006 22:47, Arno Rehn wrote:
> Am Mittwoch, 18. Oktober 2006 23:04 schrieb Richard Dale:
> > On Wednesday 18 October 2006 21:50, Arno Rehn wrote:
> > > Am Mittwoch, 18. Oktober 2006 19:02 schrieb Richard Dale:
> > > > On Wednesday 18 October 2006 17:31, Arno Rehn wrote:
> > > > > Hi,
> > > > >
> > > > > I've just tried to convert some other examples from C++ to C# and
> > > > > recognized that QDockWidgets are not movable. I've written this
> > > > > small example:
> > > > >
> > > > > using Qyoto;
> > > > >
> > > > > class Window : QMainWindow {
> > > > > 	public Window() : base() {
> > > > > 		SetCentralWidget(new QTextEdit(this));
> > > > >
> > > > > 		QDockWidget dock = new QDockWidget(this);
> > > > > 		dock.SetWidget(new QTextEdit(dock));
> > > > > 		AddDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, dock);
> > > > > 	}
> > > > >
> > > > > 	public static int Main(string[] args) {
> > > > > 		new QApplication(args);
> > > > > 		Window w = new Window();
> > > > > 		w.Show();
> > > > > 		return QApplication.Exec();
> > > > > 	}
> > > > > }
> > > > >
> > > > > Normally the QDockWidget should be movable. The same example in C++
> > > > > works as expected. Any ideas?
> > > >
> > > > Hmm, it doesn't work for me either. I tried it in QtRuby and that was
> > > > fine, so it isn't something to do with the Smoke library. The only
> > > > thing I can think is that events are being lost because Qt thinks an
> > > > event handler is being overriden when it isn't. So perhaps the best
> > > > thing is to try monitoring the overloaded virtual method callbacks to
> > > > see if there is anything funny going on with them.
> > >
> > > Uhm... - Ok, but how do we do that? What methods do we need to watch?
> > > The other solution would be to code some ugly hack that creates the
> > > QMainWindow in libqyoto.so and sets the pointer to it in the
> > > C#-QMainWindow-instance. With "original-C++-QMainWindows" everything
> > > works. But I don't know if this problem only affects mainwindows or
> > > also other classes.
> >
> > I had a look at which virtual methods were being overriden, and it was
> > only ever QObject::metaObject(). I checked that the QDockWidget features
> > were correct and they were set to '7', which should mean the widget is
> > movable ok. So I can't think of what it can be at the moment, or how to
> > find out.
>
> I implemented my ugly hack and it works for now. It's definitely not a good
> solution and if someone has a better one, please check it in!
> But I think at the moment we should focus on other things like D-BUS. I
> haven't tested yet if it works with my last commits, so this will be my
> next task.
Well, I think it was a good way to test that it wasn't to do with just running 
a QMainWindow under Mono that messed it up. On the other hand, not really a 
good idea to actually check in the hack.

I've updated the QDBus* classes, so we can experiment with getting DBus to 
work. If Q_CLASSINFO and Q_SCRIPTABLE are working, and the details are going 
into the QMetaObject then QDBus slots should 'just work'. 
QDBusAbstractInterface.Call() should work ok too - just give the method name 
as a string, and wrap each arg in a QVariant to call a D-Bus method.

-- Richard



More information about the Kde-bindings mailing list