Hi,

I'm one of the authors of UFacekit [1] which is a proposed project for
the Eclipse-Platform [2]. One of the goals of UFacekit is to provide
Eclipse-Databinding [3] -Observables.

After having completed a first version for Swing I now took a look at
QT-Jambi (it's my first time working with QT and QT-Jambi so maybe my
code can be improved). I created 2 Observeable implementation to see how
much work it is going to be (QLineEdit and QLabel) and it was quite easy
(though these 2 are fairly simple widget).

Code using Eclipse-Databinding looks like this:
-----------8<-----------
> package org.ufacekit.ui.qt.databinding.example;
> 
> import org.eclipse.core.databinding.DataBindingContext;
> import org.eclipse.core.databinding.observable.Realm;
> import org.eclipse.core.databinding.observable.value.IObservableValue;
> import org.ufacekit.core.ubean.databinding.observables.UBeansObservables;
> import org.ufacekit.ui.example.model.Person;
> import org.ufacekit.ui.qt.databinding.qt.QTEventConstants;
> import org.ufacekit.ui.qt.databinding.qt.QTObservables;
> 
> import com.trolltech.qt.gui.QApplication;
> import com.trolltech.qt.gui.QDialog;
> import com.trolltech.qt.gui.QGridLayout;
> import com.trolltech.qt.gui.QLabel;
> import com.trolltech.qt.gui.QLineEdit;
> 
> public class TextBinding extends QDialog {
>       public TextBinding() {
>               QGridLayout layout = new QGridLayout();
>               QLineEdit text = new QLineEdit();
>               layout.addWidget(text);
> 
>               QLabel label = new QLabel();
>               layout.addWidget(label);
> 
>               Person p = new Person();
>               p.setName("Tom Schindl");
> 
>               DataBindingContext ctx = new DataBindingContext();
> 
>               IObservableValue uiObs = QTObservables.observeText(text, 
> QTEventConstants.Modify);
>               IObservableValue mObs = 
> UBeansObservables.observeValue(QTObservables.getRealm(), p, Person.NAME);
>               ctx.bindValue(uiObs, mObs, null, null);
> 
>               uiObs = QTObservables.observeText(label);
>               mObs = UBeansObservables.observeValue(QTObservables.getRealm(), 
> p, Person.NAME);
>               ctx.bindValue(uiObs, mObs, null, null);
> 
>               setLayout(layout);
>       }
> 
>       public static void main(final String[] args) {
>               Realm.runWithDefault(QTObservables.getRealm(), new Runnable() {
> 
>                       public void run() {
>                               QApplication.initialize(args);
>                               new TextBinding().show();
>                               QApplication.exec();
>                       }
>               });
>       }
> }
----------->8-----------

I'm writing this mail to:
a) Inform you about the on going work (maybe you want to take a look and
   use Databinding in your applications)
   => If you have an in depth knowledge of QT and help us push the
      QT-port forward, we are happy if you want to help us. Join us at
     [4]

b) Ask some questions:
   - How do I sync back from a None-UI-Thread (in databinding this the
     task of the Realm you see above)
   - How do I find out which thread is the UI-Thread to know when I have
     sync back to the UI-Thread
   - Why are qt-jambi.jars not packaged as OSGi-Bundles? Would this be
     possible

If you are interested in the code. It is available under EPL from [5,6].

Thanks for your attention.

Tom

[1]http://code.google.com/p/uface/
[2]http://wiki.eclipse.org/Incubator/Platform/UFacekit
[3]http://wiki.eclipse.org/JFace_Data_Binding
[4]http://groups.google.com/group/uface
[5]http://uface.googlecode.com/svn/trunk/org.ufacekit.ui.qt.databinding/
[6]http://uface.googlecode.com/svn/trunk/org.ufacekit.ui.qt.databinding.example/
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to