thomas
QtCreator
Posted by thomas
 in QtCreator
 on Monday, December 29, 2008 @ 15:36

A few days before Christmas we released the beta version of Qt Creator and judging from the feedback we received so far it seems that our developers did a very good job.

One of the most important things introduced with the beta was the opening of our source code repository. This gives users and interested developers the possibility to compile Qt Creator themselves, closely follow up the development process and provide patches or even larger code contributions.

Unfortunately, most of the Qt Creator developers are on their well deserved Christmas holidays right now, meaning that most of your contributions and emails won’t be processed until early next week. But once they are back at the office they will take care of your feedback immediately - promised!

Until then keep playing around with Qt Creator, join the #qt-creator channel at irc.freenode.org and help other users on the qt-creator mailing list.

Thomas Zander
KDE
Posted by Thomas Zander
 in KDE
 on Saturday, December 27, 2008 @ 01:16

first the good news; for the first time in years KWord is no longer in the top-20 of open bugs! :)

Over the last month I’ve picked up KWord again and started digging into the code. Lots of love was needed and I ended up writing a ton of unit tests to make it much easier to find regressions when something changes either in KWord itself or in parts it depends on.

Directly after this I started doing a big bug-triage of kword and found that my bugfixing spree allowed me to close about 40 bugs. Whee! I’m very happy to see that the last of the crasher bugs are going down quick and I have high hopes that with the upcoming beta I closed all the known crashers. Ready for new ones to be reported :P

I sometimes get questions about who KOffice2 is for and if users should take this release seriously.

KOffice2.0 is meant mostly as a base for the platform and while end users will certainly be able to play with it, I doubt it will be a replacement for their day-to-day tasks.
To be more specific here an example; KWord is not going to have some of the features the previous version had; this is mostly about functionality that I think we will start re-adding as plugins. KWord and KOffice as a whole has an extensive plugin structure and just for the text-editing part (shared between all koffice apps) we have several types of plugins. Autocorrect, spell-checking and variables are all plugins in KOffice2.
So the idea is to put less effort into the plugins for the 2.0 release and put all the effort into making the core stable and more complete. The plugins will then be something even people outside of the standard KOffice team can pick up and tweak. And, this is the fun part, they can ship a version of the plugins separately from a KOffice release.

Another group of people the upcoming KOffice2.0 release is going to be very interesting for is for integrators; the companies and communities that make a product for their specific audience. Distros are integrators, but not the most interesting ones. There is a growing business where open source products are customized for a paying customer to do exactly what that customer needs. Using open source is much cheaper and we hope that KOffice will prove to be a very useful platform for such integrators. Distros with specific needs, like SkoleLinux, will probably like KOffice as well and I have had some fruitful talks with members of that community.

Please do find the latest beta (new one every month!) and play around with it. And do report bugs and other issues you may find.

Final score is that I went from 300 open bugs a month ago to some 150 open bugs today.

Kent
Qt
Labs
Qt Script
Posted by Kent
 in Qt, Labs, Qt Script
 on Friday, December 19, 2008 @ 12:55

Last year I posted a simple library for unit testing with Qt Script, called QSTestLib. Since then I didn’t really do much with it. Until recently, that is, when I got some feedback and suggestions from people actually using it, and this inspired me to make some simple but hopefully useful improvements.

The first one was to make QSTestLib work with SpiderMonkey (i.e. Firefox), which is a step towards making it a general-purpose auto-test library for JavaScript. Admittedly this was very low-hanging fruit, since the only Qt Script-specific code is the parsing of the (non-standard) “stack” property of error objects to figure out the location of test failures. (Unfortunately JavaScriptCore doesn’t provide a similar “stack” property, so QSTestLib currently can’t provide failure locations when run in WebKit-based browsers.)

Another change was needed to make QSTestLib work with browsers; the log functions used the built-in print() function to generate output, the critical assumption being that print() is a function that writes its arguments to standard output. This assumption doesn’t hold if you call print() in a browser (guess what happens). ;) So the log functions now use QTest.writeln, which you can redefine to be any function. This is quite powerful since you can use it to redirect the output to wherever:

QTest.writeln = function(text) { output += text; output += '\n'; };
output = "";
QTest.exec( {
    name: "Simple test",
    add: function() { qCompare(1+1, 3); },
    subtract: function() { qCompare(2-1, 1); }
});

After which the contents of the global variable output will be the string

********* Start testing of Simple test *********
FAIL!  : add : Compared values are not the same:
   Actual: 2
   Expected: 3
   Loc: sillytest.js(5)
PASS   : subtract
Totals: 1 passed, 1 failed, 0 skipped
********* Finished testing of Simple test *********

The next improvement is the addition of a test logger that produces XML in the same format as the C++ QTestLib (with QTestLib you get XML output by passing -xml or -lightxml when running the auto-test). Example:

QTest.logger = QTest.xmlLogger;
QTest.exec( {
    name: "Simple test",
    add: function() { qCompare(1+1, 3); }
});

which produces

<?xml version="1.0" encoding="ISO-8859-1"?>
<testcase name="Simple test">
<testfunction name="add">
<incident type="fail" file="sillytest.js" line="4">
    <description>< ![CDATA[Compared values are not the same:
   Actual: 2
   Expected: 3]]></description>
</incident>
</testfunction>
</testcase>

This means that you (or an automated test system) can readily process the results of script-based tests and C++-based tests in the same way.

The next improvement is the addition of a default HTML generator. Combined with the addition of QTest.writeln, a test can be run in a webpage:

<html>
<head><title>My test</title></head>
<body>
<script src="qstestlib.js"></script>
<script src="mytest.js"></script> <!-- the test case (defines qTestcase object) -->
<script>
QTest.logger = QTest.htmlLogger;
QTest.logger.light = true; // don't produce <html> tag etc.

QTest.writeln = function(text) { document.write(text); document.write("\n"); };

QTest.exec(qTestcase);
</script>
</body>
</html>

You can run the above test yourself by clicking here. That test runs against the latest version of QSTestLib. Which brings me to the next “improvement”: QSTestLib is now hosted on Qt Labs. There’s also a project for it on Google Code where you can report issues and create suggestions.

Speaking of suggestions; the next improvement was suggested by a user (thanks Nathan!), and is the ability to provide qCompare() with a custom compare function. This allows you to define the semantics of a comparison yourself, i.e. where the standard qCompare() behavior is not appropriate. Example:

QTest.exec( {
    name: "Simple test",
    add: function() { qCompare(1+1, 3, function(a, b) { return (a+1 == b); }); }
});

With our own twisted comparison rule in place, the test will now pass. Neat.

By the way, in case you’re not happy with any of the built-in loggers, here’s the beginning of a custom logger:

QTest.logger = {
    compareFail: function(actual, expected, testFunction) {
        QTest.writeln(testFunction + " failed, which means that everything is NOT peachy!");
    }
};

Now when you execute the testcase, you’ll get something like

add failed, which means that everything is NOT peachy!

Sometimes that’s all the information you really need. Anyway, have fun writing those auto-tests!

Comments Off
Thiago Macieira
Qt
KDE
QtCreator
Posted by Thiago Macieira
 in Qt, KDE, QtCreator
 on Thursday, December 18, 2008 @ 14:34

I was searching the Internet now for the phrase “Greek present”, but I couldn’t find it in English. It appears to be a Portuguese expression only: “presente de grego” means a present you really don’t want. The reference is to one famous present the Greek gave to the Trojans a couple thousand years ago.

The reason this came to my mind today was we’re giving you two early Christmas presents today, both related to the Greek alphabet. And unlike the Ancient Greek, we think you’re going to like these presents :-) . The first one, Thorbjørn blogged about earlier today. The second, it’s my honour to present once again: Qt 4.5 Beta is released!

That’s two betas in one day. You’d think that we would have planned this carefully to coincide and to be close to the holidays. I guess that, had we planned that in the first place, we wouldn’t have made it. But it’s all for the better that it worked out fine ;-)

You all know the main features we added for Qt 4.5, so I won’t dwell on them here. But you can see that the addition of a new port (to Mac Cocoa) is our focus for the moment (Watch the Widget Pimp^W^W^WTrenton’s video on Youtube if you can’t see in our webpage)

I’d like to emphasise one point that Thorbjørn didn’t emphasise enough: Qt Creator is now Open Source. We had planned on doing that the whole time, but the need to publish the alpha trumped getting organised. And more than that: Qt Creator’s source code repository is available for everyone to see. Unlike the existing Qt snapshots, this is the real thing and is the same source code that our developers are using. No tricks!

And it couldn’t be any different: Qt Creator beta uses Qt 4.5 beta. So you should download the latest and greatest Qt too.

The Qt 4.5 beta is a great improvement to the technical preview we released almost two months ago. Whereas that was a package just after feature freeze, containing whatever we had at the time, with minimal QA, the beta is about a more polished product. We aren’t release quality yet, but we’re that much closer.

Between the TP and the Beta, we’ve done a lot of bug-fixing, regression testing and general polishing. We’ve updated the documentation and added new examples and demos too (I highly recommend the new Boxes demonstration, even though that’s very CPU and GPU intensive). Like I mentioned in my last blog, we’ve taken a lot of care to fix both glaring and subtle issues that still plagued Qt. I’ve been running KDE 4.2 beta using Qt 4.5 beta for the past weeks, without major issues, and, like I said above, the Qt Creator beta is also using Qt 4.5 beta.

That says a lot. In fact, when we started discussing with other groups inside Nokia what they call “alpha” and “beta”, it became quite apparent that our definitions are one step ahead of theirs. What they call “beta”, we’d call “alpha” or “technical preview” (feature-complete, documented, unit-tested, minimal integration testing and manual QA). For us, “beta” has to pass a series of baseline scenarios, compile in all of our supported platforms, plus it needs a month or two of QA.

That being said, you’ll still probably find issues with Qt 4.5 beta. If you do, please let us know: send email to the qt4-preview-feedback@trolltech.com mailing list (see the announcement for subscription instructions).

Happy holidays everyone and happy hacking!

Thorbjørn Lindeijer
QtCreator
 in QtCreator
 on Thursday, December 18, 2008 @ 09:14

Qt Creator team lead Eike Ziller answers questions about the new IDE:

high quality version, ogg download

Matthias Ettrich explains some nifty keyboard shortcuts for Qt Creator’s editor:

high quality version, ogg download

Thorbjørn Lindeijer
QtCreator
 in QtCreator
 on Thursday, December 18, 2008 @ 09:05

This release marks an important milestone between the alpha release and the road to 1.0. Not just because of all the new features we added since the alpha and the many bugs we fixed, but mainly because Qt Creator is now released as free software. Additionally, from now on we’ll be doing development completely in the open. This will allow other developers to not only compile Qt Creator themselves, but also to have full access to all the changes we’re making as well as being able to feed changes back in.

The feedback on the alpha release and subsequent daily snapshots releases has been very positive, and also very helpful. We hope that opening up the development of Qt Creator will allow communication with outside developers to become even better.

One of my favourite new features in the beta is the navigation history (Alt+Left and Alt+Right), which in combination with the existing ‘follow symbol under cursor’ (F2) allows you to really navigate your code efficiently. In addition, F2 has been enhanced to also jump to macro definitions and include files. Another nice thing about the beta is that configuring the different kinds of text editors has been made easier by applying the same settings to all of them. However, because this is still a beta as well as being built against the development version of Qt 4.5, there are some known issues. On some Linux window managers for example, Qt Creator won’t redraw itself after being unminimized. If you hit this problem, just resize the window to make it draw itself, or try a more recent Qt Creator snapshot of course.

If you want to compile Qt Creator yourself or even start hacking on it, clone the git repository on labs. Note that you will need a recent version of Qt 4.5 to compile it. One way to get this is via the git snapshots.

If you want to contribute to Qt Creator, don’t forget to read the doc/coding-style.qdoc document in the repository. It not only describes our coding style but also explains how to go about submitting patches. Note that none of the exposed interfaces are set in stone. Stabilizing and documenting those interfaces is still an ongoing process.

So what are you still waiting for? Go try Qt Creator beta for yourself! :-)

Andreas
Qt
Graphics View
Graphics
Posted by Andreas
 in Qt, Graphics View, Graphics
 on Wednesday, December 17, 2008 @ 15:29

Please take some time to study this image. The question is, what on earth can this be? :-)

Viewrect

Answer: The blue area is a projection of the view rectangle in item coordinates for one of the dialogs in the “Embedded Dialogs” demo in Qt. :-) So you could say, it’s QGraphicsView’s viewport as seen from a transformed item (the item’s view-of-the-world is, of course, that it itself is perfectly normal, it’s everybody else who’s “transformed” and all). Since the item’s bounds as seen from the view is that of a projected polygon, the view rect seen from the item is also a projected polygon.

Inside in green is what might be the largest axis aligned rectangle that can fit inside this polygon. Finding this rectangle is a bit tricky. Maybe you can help us find a good algorithm for this. One that’s fast, and which finds the perfect rectangle (defined as, the rect with the largest surface area (w*h), and then if there are multiple choices, the one closest to the center of the polygon). I tried brute force. It works ;-).

Now how is this useful? ;-) Popups in Qt tend to restrict their geometry to fit inside the desktop. This desktop rectangle (QDesktopWidget::screenGeometry()) doesn’t map very well to Graphics View, or rather, it’s a rather uninteresting rectangle. In QGV you can place widgets at (-200, -200) or (100000, 100000), and it’s not the desktop geometry that should restrict the positioning of popups. It’s more natural that it’s the active viewport that should restrict placement.

Still, QMenu needs to know exactly which QRect it can use to constrain its geometry. That’s simple! It’s the largest axis aligned rectangle that can fit inside the viewport rect mapped to its local coordinate system. If we can find such a rectangle easily, this will fix up the popups in the Embedded Dialogs example so they don’t open outside the viewport where you can’t see them. I’ve tested, it even works fine for complex transforms (e.g., projective transformations).

So, can anyone propose an algorithm? :-D

espenr
Uncategorized
Posted by espenr
 in Uncategorized
 on Monday, December 15, 2008 @ 16:25

As some of you might know (see earlier post) we are porting Qt for S60 3.1 and later versions, and we’ve just finished our next pre-release called “Temple”. The release in short contains three more Qt modules and improvements to the ones already ported.

Go here to get the package!

In detail this is what you get:

New ported modules are:

  • QtScript: Provides classes for making Qt applications scriptable
  • QtSvg: Provides classes for displaying SVG images
  • QtXml: C++ implementations of SAX and DOM

Changes to existing modules are:

  • QtCore
  • added QSharedMemory support
  • added QSystemSemaphore support
  • QtGui
  • added mouse move/drag events support
  • modifed QFileDialog to fit small screens
  • Improved font support
  • QtNetwork
  • added SSL support
  • qmake
  • fixed bld.inf/mmp generation when not under Qt source tree
  • EPOCROOT environment variable is no longer required
  • Added no_icon CONFIG keyword to suppress icon generation
  • Generated pkg files no longer include Qt libraries directly
  • Added support for generic mmp rules via the MMP_RULES variable
  • Added support for STDEXE, STDDLL and STDLIB target types
  • Subdirs template no longer requires using -r switch with qmake
  • SYSTEMINCLUDE statements are no longer sorted in mmp files

Getting help and providing feedback

Now, pre-releases are not supported, but we still want your feedback. We have set up a special mailing list for feedback on the S60 port:

qts60-feedback@trolltech.com

This list is read by the developers working on the port, so please join if you want to provide technical feedback, bug reports or suggestions to us directly. In order to join the mailing list send a mail to:

qts60-feedback-request@trolltech.com

There is also a Nokia Forum available here.

Whats next?

The next pre-release called “Garden” (which have been developed in parallel with “Temple”) is when things really start to get interesting. Some of the things we hope to achieve there are:

  • Deep integration with S60 (menus, dialogs, input methods)
  • S60 look and feel (style etc.)
  • Proper font implementation
  • Move to Qt 4.5

We’ll keep you posted. See you on the flip side :D

Ariya Hidayat
Qt
Graphics View
Graphics Dojo
Posted by Ariya Hidayat
 in Qt, Graphics View, Graphics Dojo
 on Monday, December 15, 2008 @ 15:08

Let us start with the code:

svn checkout svn://labs.trolltech.com/svn/graphics/dojo/genie
cd genie && qmake && make && ./genie

For the impatient, a screencast is worth a thousand screenshots. For your pleasure, here is the 20-second screencast. Or view it on blip.tv, YouTube, or grab the Ogg Theora file (1.4 MB).

Usually you would not want to do the genie effect (made famous in Mac OS X) like in this implementation, as you can get mesh deformation easily using GLSL. Here I just want to show code as another example of one of the messages from my graphics talk in Qt Developer Days, namely "cheat whenever you can". If you inspect the inner loop, you can see that it is fairly simple. The idea is to store the outline of the genie shape in a table (I use logistic function, as "S" shape looks really good). During the animation, the left start-point and right end-point of each row is used to scale a horizontal slice of the original pixmap. One dimensional scaling like this is fairly cheap, as in ray casting trick. Furthermore, the only division in the loop can be optimized (at the cost of visual quality) to be carried out every N rows (the alternative is a look-up table). Since we are animating anyway, decide yourself if you can get away with the sacrificed quality.

I have no doubt that the experienced readers can further squeeze the scaling code, I left it just like it is because it starts to be less readable. Of course, feel free to have more fun there!

Final word: special thanks to Enrico Ros for the discussion, initial code, and the feedback.

alexis.menard
KDE
Labs
Posted by alexis.menard
 in KDE, Labs
 on Thursday, December 11, 2008 @ 16:55

Tux was very busy playing on his skateboard, when an accident happened :
Tux is playing skateboard
Everybody is fine!



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.