As a start you should have a look at doc/porting.doc in the Qt package, or this page online.
Return to the Table of Contents
Also, if your code does not compile and complains about missing member functions, you should check for methods that started with get...(). These methods have been renamed to xy*() for consistency.
Return to the Table of Contents
METASOURCES=AUTO still does the job of generating the appropriate moc files, but in addition, you should use KDE_ICON for the icons representing the application (and naming those icons conforming to lo16-app-<appname>.png), and install the application-specific icons under $(kde_datadir)/<appname>/pics.
Return to the Table of Contents
it also doesn't hold a KiconLoader instance. As this also getIconLoader() has been removed. Replace kapp->getIconLoader()->loadIcon() with BarIcon() or use KGlobal::iconLoader() instead of getIconLoader()
kde_*dir() have been removed as they require a unique top level directory for all applications (TDEDIR). This concept doesn't exist in KDE 2.0 any more, it has been replaced with "multiple levels of directories", set in TDEDIRS, so that it's possible to have global settings and group settings, applied before user settings.
Replace code that uses kde_*dir() + filename with calls to locate(filetype, filename) where filetype is what * used to be in kde_*dir(). locate is defined as function in kstddirs.h to call KGlobal::dirs()->findResource.
Use locateLocal to get the path of a writable file. For instance, KApplication::localconfigdir()+filename is now locateLocal( "config", filename ), but for most cases, simply using KGlobal::config() is enough, if you're happy with saving the application's configuration into appnamerc, or KSimpleConfig cfg("anothercfgfile") to create a config file with another name.
generalFont() and fixedFont() are deprecated and will be removed soon. Please use KGlobalSettings::generalFont() and KGlobalSettings::fixedFont() instead.
appName() is deprecated. Please use TQApplication::name() or instanceName instead.
The methods tempSaveName() and checkRecoverFile() return QString now. The returned values must _not_ be free()d.
helpMenu() has been moved to KMainWindow. aboutKDE(), aboutApp() and appHelpActivated() have all been removed See section for KMainWindow for more info.
The KApplication constructor has changed. Command line arguments and program name should no longer be passed to KApplication but to TDECmdLineArgs. TDECmdLineArgs performs command line parsing and a command line help. See below for more info.
Return to the Table of Contents
You can also use the KAboutData class to specify name, description and version.
In return for this information you can query TDECmdLineArgs whether an certain option was specified on the command line and your application now automatically supports --help and --version. It aborts with a useful error message when the command line contains a syntax error. See tdelibs/tdecore/kcmdlineargs.h for more info.
Return to the Table of Contents
KApplication::getApplication()->getLocale()->translate
but a function on its own. klocale is obsolete and replace every call to klocale->translate with i18n.
The return value of i18n is also no longer a const char*, but a unicode TQString.
Return to the Table of Contents
All methods are static and headers for returned types are not included. You must have created a KApplication object before the methods can be used.
#include <kglobal.h> #include <kconfig.h> // Needed to use KConfig #include <klocale.h> // Needed to use KLocale #include <kiconloader.h> // Needed to use KIconLoader |
|
... KConfig *appcfg = KGlobal::config(); TQString mystr = i18n( "This is a string" ); KIconLoader *loader = KGlobal::iconLoader(); |
Return to the Table of Contents
If you need icons for applications, use loadApplicationIcon.
loadMiniIcon and loadApplicationMiniIcon have been removed, instead loadApplicationIcon now takes a "size" argument where you can specify the size of the icon (small, medium, large).
The other big change you may notice, is that ICON and Icon have been removed as they caused big confusion for not loading application icons (see above). For this we added BarIcon which does the same as ICON before. The third change in this row is that loadIcon doesn't need the extension anymore, but looks for standard extensions (png, xpm) itself. If you hard- coded .xpm, loadIcon will issue a warning at runtime, but will still work in stripping off the .xpm part
Return to the Table of Contents
The KMainWindow constructor needs a parent widget as first argument. You can use 0 for this.
setView() has been replaced with setCentralWidget().
view() has been replaced with centralWidget().
addToolBar() has been removed, it is not needed any more.
setMenu(...) has been removed, it is not needed any more.
setStatusBar(...) has been removed, it is not needed any more.
updateRects() has been removed, it is not needed any more.
enableStatusBar(...) has been removed, use statusBar()->show() and/or statusBar()->hide() instead.
enableToolBar(...) has been removed, use toolBar()->show() and/or toolBar()->hide() instead.
view_* public variables do no longer exist. There is really no reason for an app to use this information. If you do need it anyway, use mainViewGeometry() instead.
Return to the Table of Contents
Both the "About KDE" and the "About <Application>" dialog boxes are now modeless. "About KDE" is a completely new widget.
If you used in the toplevel window (that is derived from KMainWindow) "kapp->helpMenu( bool, TQString )" to get the help menu you must now change this to "helpMenu( TQString )". The TQString defaults to TQString::null so it is sufficient to write helpMenu().
The old aboutKDE(), aboutApp() and appHelpActivated() of KApplication have all been removed. If you need direct access to these or need access to a help menu in a class that is not derived from KMainWindow then allocate an instance of the new class KHelpMenu. See KDE 2.0 API reference or khelpmenu.h (tdeui) for additional info.
Espen Sand <espen@kde.org>
Return to the Table of Contents
enableFloating(...) has been removed, use enableMoving() instead.
setMaxHeight() is depreciated, use setMaximumHeight() instead.
maxHeight() is depreciated, use maximumHeight() instead.
setMaxWidth() is depreciated, use setMaximumWidth() instead.
maxWidth() is depreciated, use maximumWidth() instead.
Return to the Table of Contents
You never want to use this unless you have a very good reason why it is impossible to use KProcess.
You want to use this if you need to start a new process which needs to be a child of your process, e.g. because you want to catch stdout/stderr or need to send it data via stdin. You should never use this to start other KDE applications unless your application is called kgdb :-) If you need to send/receive text like data to/from the process, you are probably better off with KProcIO
Like KProcess. Unlike KProcess, this class actually makes it easy to send data to and receive data from the process.
Preferred way to launch desktop (KDE/Gnome/X) applications or KDE services. The application/service must have a .desktop file. It will make use of KDEinit for increased startup performance and lower memory usage. These benefits only apply to applications available as KDEinit loadable module (KLM)
Generic way to open documents/applications/shell commands. Uses
startServiceBy.... where applicable. Offers the additional
benefit of startup-notification.
KRun can start any application, from the binary or the desktop file,
it will determine the mimetype of a file before running the
preferred handler for it, and it can also start shell commands.
This makes KRun the recommended way to run another program in KDE 2.
Return to the Table of Contents
KHTMLWidget *w = new KHTMLWidget(); w->openURL(myURL);
const char * -> QString TQStrList -> QStringListThe only exception for the moment is KHTMLWidget::write(), which does also exist in a const char * version.
KHTMLWidget::setDefaultFontBase() | -> setFontSizes() |
x/yOffset() | -> contentsX/Y() |
getSelectedText(TQString &) | -> TQString selectedText() |
findTextEnd() has vanished. just remove the call from your code | |
gotoXY(x, y) | -> setContentsPos(x, y) |
docWidth() | -> contentsWidth() |
docHeight() | -> contentsHeight() |
Return to the Table of Contents
The new KIntNumInput can have an optional slider attached, ensures that the entered value is in a given range (use MAX_INT or similar if you don't care about the range) and can maintain a descriptive label and also a unit for the edited value.
The API is almost the same and it simplifies existing code a bit, so give it a try. If you need more functionality, please contact me, Dirk A. Mueller <mueller@kde.org>.
The additional class KDoubleNumInput gives you the same look & feel, but allows you to edit floating point numbers.
Return to the Table of Contents
Xdnd is better anyway, because it has been adopted by all the other major GUI toolkits still under active development (this precludes Motif, but maybe we can convince the lesstif guys!). Some changes are necessary to convert your old KDND-based stuff to Qt DND.
Return to the Table of Contents
Much more extensive documentation on the KConfig and friends API can be found in the kdoc generated documentation from the header files, and in tdecore/KCONFIG_DESIGN.
To use the new iterator, you will probably want to do something like this:
TQMap<TQString, TQString> tmpMap = config-<entryMap(myGroup); TQMap<TQString, TQString>::Iterator aIt(tmpMap.begin()); for (; aIt != tmpMap.end(); ++aIt) { // body here. Access iterator key as aIt.key(), // data as *aIt. }
Return to the Table of Contents
Replacement table :
KFM::download | -> KIO::NetAccess::download (tdelibs/kio/netaccess.h) |
KFM::removeTempFile | -> KIO::NetAccess::removeTempFile |
refreshDesktop, sortDesktop, selectRootIcons : removed; kdesktop handles it | |
KFM::configure | -> see konqueror DCOP interface |
KFM::openURL | -> "(void) new KRun (url)" (tdelibs/kio/krun.h) |
KFM::refreshDirectory | -> not needed anymore since konqy/kdesktop use KDirWatch |
KFM::openProperties | -> "(void) new KPropertiesDialog (url)" (tdelibs/kfile/kpropsdlg.h) |
KFM::exec | -> "(void) new KRun (url)" (tdelibs/kio/krun.h) |
KFM::copy, KFM::move | -> KIO::Job (async, see kio/job.h) or KIO::NetAccess (sync, see kio/netaccess.h) |
DlgLocation | -> Use KLineEditDlg (tdeui/klineeditdlg.h) instead |
Return to the Table of Contents
Note that the best way to write new dialogs is to use KDialogBase (see kdialogbase.h)
Return to the Table of Contents
Most applications will only need to replace kapp->getKCharsets() with KGlobal::charsets().
For conversion of various input formats to QStrings, please have a look at TQTextCodec and classes derived from it.
Character entities are now converted from and to QChars. The name has changed from convertTag to fromEntity and toEntity.
To get a font, which can display a certain charset (if such a font exists), you can use the KCharsets::setQFont methods. Input is a font and a charset. Kcharsets tries to find an output font, which matches the input font most closely, but can display the given charset.
Return to the Table of Contents
KNoteBook (deeply entwined with the former KWizard) has been removed until someone is willing to port it to work with the new wizard. If you want to use it you'll find the necessary files in tdegraphics/kiconedit.
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
TQSplitter *split = new TQSplitter( parent ); TQListBox *lb = new TQListBox( split ); KListView *lv = new KListView( split ); TQMultiLineEdit *ed = new TQMultiLineEdit( split ); |
Return to the Table of Contents
KListView has no addChild(), insertItem() and removeItem() calls. Inserting a root item is done by constructing a TQListViewItem with the KListView passed as the parent widget. adding a child item is done by constructing a TQListViewItem with the parent item as parameter. removeItem() should be replaced by delete <pointer to item>.
The root items are not shown in a tree fashion by default. to get this, use KListView::setDecorativeRoot(true).
Expanding and collapsing can by done by using TQListViewItem::setOpen(bool).
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
KPixmapEffect::gradient(KPixmap&, TQColor, TQColor, enum KPixmapEffect::GradientType, int)
Hence:
pix.gradientFill(ca, cb, direction, ncols)
becomes, for direction == true :
KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::VerticalGradient, ncols)
There are now:
KPixmapEffect:: |
[Vertical, Horizontal, Diagonal, CrossDiagonal, Rectangle, Pyramid, PipeCross, Elliptic] |
Look further in this document for other info about pixmap effect code reorganization (essentially, all effects are now in libtdeui.so: gradient(), unbalancedGradient(), hash(), desaturate(), pattern(), fade(), blend() etc.
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Return to the Table of Contents
Please adjust your code accordingly.
Return to the Table of Contents
Return to the Table of Contents
KPixmap::tile() has been renamed to KPixmapEffects::createTile().
Dirk A. Mueller <mueller@kde.org>
Return to the Table of Contents
tdebase/kcontrol/README
which explains what needs to be done.
Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Return to the Table of Contents
Return to the Table of Contents
Also, note that tqDebug and fprintf aren't disabled by -DNDEBUG, whereas kdDebug is. One more reason to use kdDebug ! (faure@kde.org)
Return to the Table of Contents
Werner Trobin <wtrobin@carinthia.com>
Return to the Table of Contents
If you need some "inspiration" on how that could be done, please have a look at koffice/lib/kofficecore/koFilterManager.cc (PreviewStack).
Werner Trobin <wtrobin@carinthia.com>
Return to the Table of Contents
kFSDither dither(palette, ncols); image = dither.dither(image); |
Now do:
KImageEffect::dither(image, palette, ncols); |
Kurt Granroth <granroth@kde.org>
Return to the Table of Contents
The way to go for this one is to use the KNotify API, which will allow users to reconfigure how your application should sound. On the other hand, they will also be able to disable specific sounds, rather let the events log to a file, and so on. You can provide an rc file with the default configuration. (Include "knotifyclient.h" and use the KNotifyClient class).
On the other hand, if you just want a really small solution, there is the KAudioPlayer class (declared kaudioplayer.h), which has a static member function for playing, like
KAudioPlayer::play("/var/samples/foo.wav");
If you are writing "real multimedia apps", you may also have a look at the even more advanced sound/multimedia support, that using the aRts/MCOP libraries directly can offer you.
Return to the Table of Contents
KImageIO has moved from 'kimgio.h' to 'kimageio.h'. LIB_KIMGIO does no longer exists, you need to link against LIB_KSYCOCA instead.
kimgioRegister() has been replaced by KImageIO::registerFormats().
Waldo Bastian bastian@kde.org