[Kde-bindings] Qyoto: Movable QDockWidgets

Arno Rehn arno at arnorehn.de
Wed Oct 18 22:46:51 UTC 2006


Am Donnerstag, 19. Oktober 2006 00:32 schrieb Richard Dale:
> 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.
Yes, I thought some while about it, whether to check it in or not. But as 
the 'core hack' is just a few lines in SmokeInvocation.Invoke() and therefore 
easily to remove / comment out I checked it in. Maybe these lines should be 
commented out 'by default'.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list