eskil
Qt
KDE
Posted by eskil
 in Qt, KDE
 on Thursday, August 31, 2006 @ 12:46

After doing some last minutes repairs the night before, we successfully launched the second technology preview of Qt Jambi (Qt for Java) yesterday. We’ve fixed a few bugs in this one, added some flexibility to the Eclipse plugin and Qt Jambi in general, and tried to iron out some bumps in the API.

Deployment
One of the big things on our schedule for this release was to simplify the deployment of Qt Jambi applications. We wanted to be able to distribute apps as single .jar files that could be launched directly, and we wanted to support deployment through Java Web Start. The challenge in the first case is loading native library files, obviously, as Java itself does not explicitly support extracting them from within the .jar files. We also needed for the system to be expandable, so that you would be able to use the same techniques for deploying applications that depend on your own native libraries, and we needed it to be cross platform, so none of the Java classes could have hard coded dependencies on system libraries. We’ve introduced such a system to Qt Jambi for this release, and Qt Jambi will now automagically go behind your back and extract native libraries from your class path.

Java Web Start is nicer for such deployment purposes, as it already provides a simple, cross platform way of bundling native libraries. Since the Web Start application relies on custom class loaders, however, we did have to add some logic to get the class path file engine working. By following the link on the Qt Jambi download page, you’ll get to a demonstration of this, where the Qt Jambi Demo Launcher is provided as a web start application. The launcher should work on Linux or Windows, and it relies heavily on the class path file engine for extracting images and other resources, and dynamically detecting which examples and demos are available.

Here’s a screenshot, if that makes any sense.

Screenshot of Qt Jambi Demos running in Web Start

Abstract methods
In the last technical preview, pure virtual functions in the C++ API were empty implementations in the Java API. This was something which sorely needed to be fixed, so that’s what we did. In TP2, they’re abstract functions like their mothers and fathers. There was actually a lot of work involved in getting the Qt Jambi generator to make abstract methods work in a general way. There’s seems to be a general rule that mapping any C++ concept to its Java equivalent will introduce you to a webs within webs of exotic snags and obstacles and existential paradoxes. Consider, for instance, cases of abstract and internal return types in mapped functions, possible modifications on the access rights of the pure virtuals, and cross language polymorphism. Those are just some examples of cases that make this job interesting , and I’m actually confident we’ve found very good and clean solutions for anything we’ve hit so far.

Eclipse integration
The Eclipse integration also has a bunch of improvements in the new preview package. There was a bug in the previous one that prevented it from integrating completely with the folder hierarchy in Eclipse, and that has been fixed. Now it should respect your project’s structure, optionally generate its files into a separate folder to keep things neat and tidy, and respect the exclusion and inclusion patterns set on the build path as well. We’ve also added a “New Form” wizard to make it possible for the integration to generate widgets of different types, such as main windows and dialogs. Note that the new Eclipse integration requires Qt Jambi TP2, however, and that you will have to delete the old plugin before installing the new one. See the installation docs for more on this.

Finally
That was just a run down of a few new things in TP2. We’re still looking for as much feed back as possible on Qt Jambi, so don’t hesitate to post any suggestion, question or report to our qt-jambi-interest@trolltech.com mailing list. To subscribe, just send an e-mail to qt-jambi-interest-request@trolltech.com and put the word ’subscribe’ in the subject. We’ve already started work on the third preview, and there’s a lot of good stuff ahead.

Comments Off
Jens
Uncategorized
Qt
KDE
Posted by Jens
 in Uncategorized, Qt, KDE
 on Thursday, August 31, 2006 @ 07:08

icons

We have been working hard on improving our desktop integration with Qt lately. We automatically use the Plastique style if KDE is detected on startup. Starting with Qt 4.2, we intend to pick up the icon theme as well. This means that most of our standard dialogs, such as message boxes and file dialogs will use the same icons as KDE.

GNOME users will get the same treatment. The second image shows a message box on Ubuntu, using the Cleanlooks style and picking up the Human icon theme.

messagebox

Andreas
Qt
KDE
Labs
Graphics View
Graphics Items
Posted by Andreas
 in Qt, KDE, Labs, Graphics View, Graphics Items
 on Wednesday, August 30, 2006 @ 07:14

Someone asked me if it was truly possible to do 4 million items in real time using Graphics View. I challenge you to see for yourselves. Download one of the latest snapshots for Qt 4.2 (one with the 40000 Chips demo in it) - and apply this patch to increase the number of items. It’s real-time, you can move items around at practically no CPU-usage, and you can zoom in and out smoothly (when zooming far out it does become slow though).

4 000 000 items. Howz dat? ;-)

--- mainwindow.cpp  1970-01-01 01:00:00.000000000
+++ mainwindow.cpp  2006/08/25 10:51:09.000000000
@@ -62,13 +62,13 @@
     // Populate scene
     int xx = 0;
     int nitems = 0;
-    for (int i = -11000; i < 11000; i += 110) {
+    for (int i = -110000; i < 110000; i += 110) {
         ++xx;
         int yy = 0;
-        for (int j = -7000; j < 7000; j += 70) {
+        for (int j = -70000; j < 70000; j += 70) {
             ++yy;
-            qreal x = (i + 11000) / 22000.0;
-            qreal y = (j + 7000) / 14000.0;
+            qreal x = (i + 110000) / 220000.0;
+            qreal y = (j + 70000) / 140000.0;

             QColor color(image.pixel(int(image.width() * x), int(image.height() * y)));
             QGraphicsItem *item = new Chip(color, xx, yy);
Andreas
Qt
KDE
Labs
Graphics View
Graphics Items
Posted by Andreas
 in Qt, KDE, Labs, Graphics View, Graphics Items
 on Saturday, August 26, 2006 @ 11:02

I’ve did some web crawling on Graphics View [keywords graphicsview, qgraphicsview, qgraphicsscene, “graphics view”…], trying to get a feel for what projects out there are poking into Qt 4.2’s snapshots, and starting to use our favorite canvas framework for real-life apps. I was positively surprised. Try it out :-). People are discussing the frame work on numerous newsgroups and mailing lists, and projects in the community are popping up one after another. That’s pretty good for a framework that’s still not released.

Also reading all the excellent feedback the framework has gotten on the tech-preview mailing lists (http://lists.trolltech.com/) gives me a good feeling for 4.2, and for the future of Qt 4 as a tool for writing some awesome graphical apps.

Then I read something about how some folks find the Graphics View framework too hard to use, being forced onto the model-view mindset and all. Is it really that hard? Consider the following piece of code:

int main(int argc, char **argv) {
    QApplication app(argv, argv);

    QGraphicsScene scene;
    scene.addPixmap(QPixmap("konqi.png"));

    QGraphicsView view(&scene);
    view.show();

    return app.exec();
}

I’m not sure if it’s the extra line that declares the scene that accounts for complexity, but the above code looks pretty simple to me, easy to read and understand too. If you want to be able to move a pixmap item around with the mouse, you can just enable a flag:

QGraphicsItem *pixmap = scene.addPixmap(QPixmap("konqi.png"));
pixmap->setFlag(QGraphicsItem::ItemIsMovable);

Try it out :-). It’s quite straight-forward. That pixmap item could be a knight chip (chess?), an integrated chip, you name it. And look how easy it is to create a full-blown text editor item:

QGraphicsTextItem *text = scene.addText("A paragraph of text.");
text->setTextInteractionFlags(Qt::TextEditorInteraction);

Click on it and start typing, selecting, and so on. Even drag&drop and context menus work out of the box.

Even complex features are easy with Graphics View. Take drag&drop. With Graphics View it’s almost too simple. ;-) Here’s how to implement a pixmap item that receives its contents via drag&drop. You can try it by dragging images from you favorite file manager:

class Pixmap : public QGraphicsPixmapItem
{
public:
    Pixmap(const QPixmap &pixmap) : QGraphicsPixmapItem(pixmap) {
        setAcceptDrops(true);
    }        

protected:
    void dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
        pix.load(QUrl(event->mimeData()->text()).path());
        event->setAccepted(!pix.isNull());
    }

    void dropEvent(QGraphicsSceneDragDropEvent *event) {
        setPixmap(pix);
    }

private:
    QPixmap pix;
};

Enable drag&drop with setAcceptDrops(). Accept the drag enter if the proposed pixmap is valid. Set the pixmap in dropEvent(). How much easier can it get?

Now let’s use this new item:

scene.addItem(new Pixmap("konqi.png"));

I personally cannot understand why someone would want to reinvent this wonderful framework, now that it’s available.

Ah well, now I’ve said it.

/me sips some more coffee

Comments Off
lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Friday, August 18, 2006 @ 04:26

tired. hungry. my legs hurt. my voice hurts. still jet lagged.
Had some great food while here in San Fran. Especially liked Blondies pizza on Powel st!

Trolltech had a great sucess with Qtopia and Greenphone. Many people showing more interest in Qtopia than Qt! There’s quite the excitement about the Greenphone.

Comments Off
zack
Aggregated
Posted by zack
 in Aggregated
 on Tuesday, August 15, 2006 @ 18:15

Today I pushed a new acceleration architecture for Xorg. Called Glucose, it uses OpenGL to accelerate X. What happens there is that Glucose hooks into the initialisation code during the graphics card setup and dispatches the X rendering calls through the same codepaths that XGL uses. The email describing it and the some reasons for it is here: http://lists.freedesktop.org/archives/xorg/2006-August/017527.html. One step closer to the Open Source graphical utopia.

Besides that I’ve spent the last few days working on optimising various parts of Qt’s rendering architecture. From OpenGL painter, through X11 to the raster code. Just beating down graphics into submission at this point really. At first a few code paths held me in a headlock that required some repetitive “banging head on the keyboard” action on my part but now it’s ok. Now, Qt just rocks at rendering vector graphics. No screenshots today though :) I started writing a real-time vector graphics cartoon fully in Qt but it’s not yet finished. By the way one thing I find missing in all Open Source vector editors is that you can’t just scan your sketches and put them as background to trace over, Flash does it pretty ok. Instead of complaining I probably should just go ahead and implement it in Inkscape.

Finally Paul and I sat down today to figure out semantics of OpenGL support in Qtopia Core and we got it down. I’d like to have a fair dosage of 3D support on the Greenphone.

Oh, and US Airways stole my luggage. If you ever met me you know I have (had) a great collection of shirts. Now they belong to US Airways. Oh, and my US cell was in it, so if you’ve been wondering why I haven’t been picking up your calls lately, it’s because US Airways stole my phone.

lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Tuesday, August 15, 2006 @ 14:51

Well, by now you might have heard about Trolltech’s Greenphone

I am quite excited about it, as it brings in a new world for Qtopia Phone development.

It’s metallic green, and light. I have been using it for the past week or so, and I must say, I like the hardware. Nice, big screen - 240×320, for a phone.

Anyway, more on this later, I suppose. LinuxWorld Expo is here, and I must get ready. Remember, stop by booth #1228 and come check it out!

p.s. The Linuxdevices article here mis-states that it has wifi. It doesn’t.

Comments Off
lorn
Qt
Qtopia
KDE
Posted by lorn
 in Qt, Qtopia, KDE
 on Monday, August 07, 2006 @ 23:18

It’s official! I am going to be at LinuxWorld 2006 in San Francisco. They even gave me a place to sleep thats not in the gutter or under a cardboard box.

We will be at booth Booth #1228, showing off some exceptionally cool Trolltech and Qtopia stuff.

Stay tuned!

Comments Off
trenton
Qt
Posted by trenton
 in Qt
 on Friday, August 04, 2006 @ 20:58

Well, after a more or less quiet week at home in rural Minnesota, I’m off to San Francisco for WWDC to check out all the new stuff that Apple is working on. So, if anyone wants to discuss Qt/Mac or anything else, just track me down, I’ll be in some sort of Trolltech-themed shirt.

Comments Off
Simon
Qt
Posted by Simon
 in Qt
 on Friday, August 04, 2006 @ 07:49

From the Cool-Things-That-Are-Surprisingly-Simple-With-Qt category: Download a font from the web and use it right away without saving it to disk or installing it in the system, in 45 lines of code:

#include <QtGui>
#include <QtNetwork>
class CoolTextEdit : public QTextEdit
{
    Q_OBJECT
public:
    CoolTextEdit(const QUrl &fontUrl);
private slots:
    void tryDownloadedFont();
private:
    QByteArray downloadedFont;
    QHttp *downloader;
};
CoolTextEdit::CoolTextEdit(const QUrl &fontUrl)
{
    setPlainText("Please wait while downloading font...");
    downloader = new QHttp(this);
    connect(downloader, SIGNAL(done(bool)), this, SLOT(tryDownloadedFont()));
    QBuffer *buffer = new QBuffer(&downloadedFont, downloader);
    downloader->setHost(fontUrl.host());
    downloader->get(fontUrl.path(), buffer);
}
void CoolTextEdit::tryDownloadedFont()
{
    downloader->deleteLater();
    downloader = 0;
    int id = QFontDatabase::addApplicationFontFromData(downloadedFont);
    if (id < 0) {
        setPlainText("Loading the font failed :(");
        return;
    }
    QFont f(QFontDatabase::applicationFontFamilies(id).first());
    f.setPointSize(48);
    setFont(f);
    setPlainText(f.family());
}
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    CoolTextEdit edit(QUrl("http://fonts.tom7.com/f/actionj.ttf"));
    edit.resize(400, 200);
    edit.show();
    return app.exec();
}
#include "main.moc"

Save as main.cpp, qmake -project QT+=network, qmake, (n)make and run :)
Here’s the obligatory screenshot:
Screenshot