[Kstars-devel] Qt4 porting pep talk

Jason Harris kstars at 30doradus.org
Fri Oct 28 08:20:39 CEST 2005


Hello KStars team, and anyone monitoring the list who may be interested:

If you want to help out with porting KStars to Qt4, but don't know
where to start, I have some tips for you.

I'll assume you have compiled Qt4 and kdelibs4-snapshot, and installed
them to an alternate target directory.  You also need to checkout and
install unsermake (SVN:trunk/kdenonbeta/unsermake)

You can turn one of your terminal sessions into a KDE4 compile platform by
issuing the commands:
export QTDIR=/path/to/qt4
export KDEDIR=/path/to/kde4
export PATH=$QTDIR/bin:$KDEDIR/bin:$PATH:/home/jharris/kde4svn/unsermake
export LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib

(note that if you try to *execute* a kde4 program from this terminal
session, it will kill your current kdeinit, and replace it with the
kdeinit from kde4!  This wreaks havoc with the rest of your desktop,
but don't worry, you can just execute "kdeinit" from a different
terminal session to restore sanity.)

----------------------------------------------------------------

Once you are set up, there's plenty to do to help work toward the
dream: KStars running under Qt4.  I personally can't wait to see the
native antialiased graphics.  No more jaggies!  No more jitter as
stars move across the screen! It's going to be beautiful... :)

A lot of the work that needs to be done is pretty easy, even if you
aren't very familiar with the codebase.  I don't recommend jsut going
into the toplevel dir and typing "unsermake" at this point; there are
just too many problems.  Instead, pick a class to work on and do
"unsermake classname.o", which will compile that class only.

Another suggestion: for now, you may want to work on the new classes
in kstars/kstars/skycomponents.  These are brand-new classes, and they
are actually still in a very rough state.  You'll get tons of compile
errors, but they're generally easy to fix, like missing include files.


Other things to do:

+ For antialiased drawing, Qt now allows floating-point pixel
coordinate values in QPainter.  Coordinate pairs are stored in a new
QPointF class, which is basically a QPoint with floats.  So, we need
to change almost all of our QPoint variables to QPointF.  These will
mostly be found in the various draw() functions in skycomponents/.  In
particular, I have already modified the function SkyMap::getXY()
(which translates from sky coordinates to screen pixel coordinates) to
return a QPointF instead of a QPoint, but I haven't gone through the
code to fix every instance where it is used.  

+ QPainter no longer has lineTo(int, int) and moveTo(int, int)
functions; instead, there is the drawLine(QPointF start, QPointF end)
function.  In Qt3, QPainter stored a "current pen position", which was
changed with moveTo().  It doesn't have this concept anymore, so if
there is code that used moveTo(), we may have to store the pen
position ourselves.  See EquatorComponent::draw() for an example.

-------------------------------------

I'm sure you'll discover many other issues if you try to compile
anything.  If you find something you don't know how to fix, feel free
to post to the list.

Looking forward to your patches! :)

Have fun,
Jason

-- 
KStars: KDE Desktop Planetarium
http://edu.kde.org/kstars


More information about the Kstars-devel mailing list