You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
807 lines
32 KiB
807 lines
32 KiB
/****************************************************************************
|
|
**
|
|
** Help with porting from TQt 2.x to TQt 3.x
|
|
**
|
|
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
|
|
**
|
|
** This file is part of the TQt GUI Toolkit.
|
|
**
|
|
** This file may be used under the terms of the GNU General
|
|
** Public License versions 2.0 or 3.0 as published by the Free
|
|
** Software Foundation and appearing in the files LICENSE.GPL2
|
|
** and LICENSE.GPL3 included in the packaging of this file.
|
|
** Alternatively you may (at your option) use any later version
|
|
** of the GNU General Public License if such license has been
|
|
** publicly approved by Trolltech ASA (or its successors, if any)
|
|
** and the KDE Free TQt Foundation.
|
|
**
|
|
** Please review the following information to ensure GNU General
|
|
** Public Licensing requirements will be met:
|
|
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
|
|
** If you are unsure which license is appropriate for your use, please
|
|
** review the following information:
|
|
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
|
|
** or contact the sales department at sales@trolltech.com.
|
|
**
|
|
** This file may be used under the terms of the Q Public License as
|
|
** defined by Trolltech ASA and appearing in the file LICENSE.QPL
|
|
** included in the packaging of this file. Licensees holding valid Qt
|
|
** Commercial licenses may use this file in accordance with the Qt
|
|
** Commercial License Agreement provided with the Software.
|
|
**
|
|
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
|
|
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
|
|
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
|
|
** herein.
|
|
**
|
|
**********************************************************************/
|
|
|
|
/*!
|
|
\page porting.html
|
|
|
|
\title Porting to TQt 3.x
|
|
|
|
This document describes porting applications from TQt 2.x to TQt 3.x.
|
|
|
|
The TQt 3.x series is not binary compatible with the 2.x series. This
|
|
means programs compiled for TQt 2.x must be recompiled to work with Qt
|
|
3.x. TQt 3.x is also not completely \e source compatible with 2.x,
|
|
however all points of incompatibility cause compiler errors or
|
|
run-time messages (rather than mysterious results). TQt 3.x includes
|
|
many additional features and discards obsolete functionality. Porting
|
|
from TQt 2.x to TQt 3.x is straightforward, and once completed makes
|
|
the considerable additional power and flexibility of TQt 3.x available
|
|
for use in your applications.
|
|
|
|
To port code from TQt 2.x to TQt 3.x:
|
|
|
|
\list 1
|
|
|
|
\i Briefly read the porting notes below to get an idea of what to expect.
|
|
\i Be sure your code compiles and runs well on all your target platforms
|
|
with TQt 2.x.
|
|
\i Recompile with TQt 3.x. For each error, search below for related
|
|
identifiers (e.g. function names, class names). This document
|
|
mentions all relevant identifiers to help you get the information
|
|
you need at the cost of being a little verbose.
|
|
\i If you get stuck, ask on the \link http://qt-interest.trolltech.com/
|
|
qt-interest \endlink mailing list, or Trolltech Technical Support if
|
|
you're a registered licensee.
|
|
|
|
\endlist
|
|
|
|
Table of contents:
|
|
|
|
\tableofcontents
|
|
|
|
\target Linkerrors
|
|
\section1 Link Errors on Windows
|
|
|
|
On Windows, originally in TQt 2.x, the default configuration of the Qt
|
|
library is static. If you just use the default configuration you
|
|
don't need to set certain preprocessor defines. In TQt 3.0, the
|
|
default configuration of the TQt library is to build it as a shared
|
|
library, therefore the preprocessor define \c QT_DLL is needed.
|
|
|
|
If you use tmake with TQt 2.x, and now use qmake with TQt 3.x, then the
|
|
cause of the problem is with the project file. In the project file,
|
|
there is usually line that looks like:
|
|
|
|
\c CONFIG = ...
|
|
|
|
this should be changed to
|
|
|
|
\c CONFIG += ...
|
|
|
|
so that qmake can look at the configuration that TQt was built with and
|
|
set any relevant preprocessor defines in the makefile.
|
|
|
|
\target Headers
|
|
\section1 Header file inclusion changes
|
|
|
|
Qt 3.x remove some unnecessary nested #include directives from
|
|
header files. This speeds up compilation when you don't need those
|
|
nested header files. But in some cases you will find you need to add
|
|
an extra #include to your files.
|
|
|
|
For example, if you get a message about TQStringList or its functions
|
|
not being defined, then add \c {#include <tqstringlist.h>} at
|
|
the top of the file giving the error.
|
|
|
|
Header files that you might need to add #include directives for include:
|
|
\list
|
|
\i \c <ntqcursor.h>
|
|
\i \c <tqpainter.h>
|
|
\i \c <ntqpen.h>
|
|
\i \c <tqstringlist.h>
|
|
\i \c <tqregexp.h>
|
|
\i \c <tqstrlist.h>
|
|
\i \c <tqstyle.h>
|
|
\i \c <tqvaluelist.h>
|
|
\endlist
|
|
|
|
\section1 Namespace
|
|
|
|
Qt 3.x is namespace clean. A few global identifiers that had been
|
|
left in TQt 2.x have been discarded.
|
|
|
|
Enumeration \l TQt::CursorShape and its values are now part of the
|
|
special \c TQt class defined in ntqnamespace.h. If you get compilation
|
|
errors about these being missing (unlikely, since most of your code will
|
|
be in classes that inherit from the TQt namespace class), then apply
|
|
the following changes:
|
|
|
|
\list
|
|
\i \c QCursorShape becomes \c TQt::CursorShape
|
|
\i \c ArrowCursor becomes \c TQt::ArrowCursor
|
|
\i \c UpArrowCursor becomes \c TQt::UpArrowCursor
|
|
\i \c CrossCursor becomes \c TQt::CrossCursor
|
|
\i \c WaitCursor becomes \c TQt::WaitCursor
|
|
\i \c IbeamCursor becomes \c TQt::IbeamCursor
|
|
\i \c SizeVerCursor becomes \c TQt::SizeVerCursor
|
|
\i \c SizeHorCursor becomes \c TQt::SizeHorCursor
|
|
\i \c SizeBDiagCursor becomes \c TQt::SizeBDiagCursor
|
|
\i \c SizeFDiagCursor becomes \c TQt::SizeFDiagCursor
|
|
\i \c SizeAllCursor becomes \c TQt::SizeAllCursor
|
|
\i \c BlankCursor becomes \c TQt::BlankCursor
|
|
\i \c SplitVCursor becomes \c TQt::SplitVCursor
|
|
\i \c SplitHCursor becomes \c TQt::SplitHCursor
|
|
\i \c PointingHandCursor becomes \c TQt::PointingHandCursor
|
|
\i \c BitmapCursor becomes \c TQt::BitmapCursor
|
|
\endlist
|
|
|
|
The names of some debugging macro variables have been changed. We have
|
|
tried not to break source compatibility as much as possible. If you observe
|
|
error messages on the UNIX console or the Windows debugging stream that were
|
|
previously disabled, please check these macro variables:
|
|
|
|
\list
|
|
\i \c DEBUG becomes \c QT_DEBUG
|
|
\i \c NO_DEBUG becomes \c TQT_NO_DEBUG
|
|
\i \c NO_CHECK becomes \c TQT_NO_CHECK
|
|
\i \c CHECK_STATE becomes \c QT_CHECK_STATE
|
|
\i \c CHECK_RANGE becomes \c QT_CHECK_RANGE
|
|
\i \c CHECK_NULL becomes \c QT_CHECK_NULL
|
|
\i \c CHECK_MATH becomes \c QT_CHECK_MATH
|
|
\endlist
|
|
|
|
The name of some debugging macro functions has been changed:
|
|
|
|
\list
|
|
\i \c ASSERT becomes \c Q_ASSERT
|
|
\endlist
|
|
|
|
For the record, undocumented macro variables that are not part of the API
|
|
have been changed:
|
|
|
|
\list
|
|
\i \c _OS_*_ becomes \c Q_OS_*
|
|
\i \c _WS_*_ becomes \c TQ_WS_*
|
|
\i \c _CC_*_ becomes \c Q_CC_*
|
|
\endlist
|
|
|
|
\section1 Removed Properties
|
|
|
|
\list
|
|
\i QLineEdit::hasMarkedText. Use TQLineEdit::hasSelectedText instead.
|
|
\i QLineEdit::markedText. Use TQLineEdit::selectedText instead.
|
|
\i TQToolButton::offIconSet. Use TQToolButton::iconSet instead.
|
|
\i TQToolButton::onIconSet. Use TQToolButton::iconSet instead.
|
|
\endlist
|
|
|
|
\section1 Removed Functions
|
|
|
|
All these functions have been removed in TQt 3.x:
|
|
\list
|
|
\i QButton::autoResize() const
|
|
\i QButton::setAutoResize(bool)
|
|
\i TQFont::charSet()
|
|
\i TQFont::setCharSet()
|
|
\i QLineEdit::cursorLeft(bool mark, int steps = 1). Use TQLineEdit::cursorBackward() instead.
|
|
\i QLineEdit::cursorRight(bool mark, int steps = 1). Use TQLineEdit::cursorForward() instead.
|
|
\i QLineEdit::hasMarkedText() const. Use TQLineEdit::hasSelectedText() instead.
|
|
\i QLineEdit::markedText() const. Use TQLineEdit::selectedText() instead.
|
|
\i QLineEdit::repaintArea(int, int). Use TQLineEdit::update() instead.
|
|
\i TQMenuBar::setActItem()
|
|
\i TQMenuBar::setWindowsAltMode()
|
|
\i TQObject::initMetaObject()
|
|
\i TQPainter::drawQuadBezier()
|
|
\i QPalette::normal(). Use TQPalette::active() instead.
|
|
\i QPalette::setNormal(). Use TQPalette::setActive() instead.
|
|
\i QPointArray::quadBezier()
|
|
\i TQRegExp::find()
|
|
\i TQSignal::block(bool b)
|
|
\i TQSignal::isBlocked() const
|
|
\i TQSignal::parameter() const. Use TQSignal::value() instead.
|
|
\i TQSignal::setParameter(int value). Use TQSignal::setValue() instead.
|
|
\i QSpinBox::downButton()
|
|
\i QSpinBox::upButton()
|
|
\i TQString::basicDirection()
|
|
\i TQString::visual()
|
|
\i TQStyle::set...() functions
|
|
\i TQStyle::drawArrow()
|
|
\i TQThread::postEvent(TQObject *receiver, TQEvent *event). Use TQApplication::postEvent() instead.
|
|
\i TQToolButton::iconSet(bool on) const
|
|
\i TQToolButton::offIconSet() const
|
|
\i TQToolButton::onIconSet() const
|
|
\i TQToolButton::setIconSet(const TQIconSet \&set, bool on)
|
|
\i TQToolButton::setOffIconSet(const TQIconSet \&)
|
|
\i TQToolButton::setOnIconSet(const TQIconSet \&)
|
|
\i TQWidget::setFontPropagation()
|
|
\i TQWidget::setPalettePropagation()
|
|
\endlist
|
|
|
|
Also, to avoid conflicts with \c <iostream>, the following three
|
|
global functions have been renamed:
|
|
\list
|
|
\i setw() (renamed qSetW())
|
|
\i setfill() (renamed qSetFill())
|
|
\i setprecision() (renamed qSetPrecision())
|
|
\endlist
|
|
|
|
\section1 Obsoleted Functions
|
|
|
|
The following functions have been obsoleted in TQt 3.0. The
|
|
documentation of each of these functions should explain how to
|
|
replace them in TQt 3.0.
|
|
|
|
\warning It is best to consult \l http://doc.trolltech.com/3.0/
|
|
rather than the documentation supplied with TQt to obtain the latest
|
|
information regarding obsolete functions and how to replace them in
|
|
new code.
|
|
|
|
\list
|
|
\i QAccel::keyToString( QKeySequence k )
|
|
\i QAccel::stringToKey( const TQString \& s )
|
|
\i TQActionGroup::insert( TQAction *a )
|
|
\i TQCanvasItem::active() const
|
|
\i TQCanvasItem::enabled() const
|
|
\i TQCanvasItem::selected() const
|
|
\i TQCanvasItem::visible() const
|
|
\i TQCanvasPixmapArray::TQCanvasPixmapArray( TQPtrList\<QPixmap\> list, TQPtrList\<QPoint\> hotspots )
|
|
\i TQCanvasPixmapArray::operator!()
|
|
\i TQColorGroup::TQColorGroup( const TQColor \& foreground, const TQColor \& background, const TQColor \& light, const TQColor \& dark, const TQColor \& mid, const TQColor \& text, const TQColor \& base )
|
|
\i QComboBox::autoResize() const
|
|
\i QComboBox::setAutoResize( bool )
|
|
\i TQDate::dayName( int weekday )
|
|
\i TQDate::monthName( int month )
|
|
\i TQDir::encodedEntryList( const TQString \& nameFilter, int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const
|
|
\i TQDir::encodedEntryList( int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const
|
|
\i QDockWindow::isHorizontalStretchable() const
|
|
\i QDockWindow::isVerticalStretchable() const
|
|
\i QDockWindow::setHorizontalStretchable( bool b )
|
|
\i QDockWindow::setVerticalStretchable( bool b )
|
|
\i TQFont::defaultFont()
|
|
\i TQFont::setDefaultFont( const TQFont \& f )
|
|
\i TQFont::setPixelSizeFloat( float pixelSize )
|
|
\i TQFontDatabase::bold( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::families( bool ) const
|
|
\i TQFontDatabase::font( const TQString \& familyName, const TQString \& style, int pointSize, const TQString \& )
|
|
\i TQFontDatabase::isBitmapScalable( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::isFixedPitch( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::isScalable( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::isSmoothlyScalable( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::italic( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i TQFontDatabase::pointSizes( const TQString \& family, const TQString \& style, const TQString \& )
|
|
\i TQFontDatabase::smoothSizes( const TQString \& family, const TQString \& style, const TQString \& )
|
|
\i TQFontDatabase::styles( const TQString \& family, const TQString \& ) const
|
|
\i TQFontDatabase::weight( const TQString \& family, const TQString \& style, const TQString \& ) const
|
|
\i QLabel::autoResize() const
|
|
\i QLabel::setAutoResize( bool enable )
|
|
\i QListBox::cellHeight( int i ) const
|
|
\i QListBox::cellHeight() const
|
|
\i QListBox::cellWidth() const
|
|
\i QListBox::findItem( int yPos ) const
|
|
\i QListBox::inSort( const QListBoxItem *lbi )
|
|
\i QListBox::inSort( const TQString \& text )
|
|
\i QListBox::itemYPos( int index, int *yPos ) const
|
|
\i QListBox::numCols() const
|
|
\i QListBox::totalHeight() const
|
|
\i QListBox::totalWidth() const
|
|
\i QListBoxItem::current() const
|
|
\i QListBoxItem::selected() const
|
|
\i QListView::removeItem( QListViewItem *item )
|
|
\i QListViewItem::removeItem( QListViewItem *item )
|
|
\i TQMainWindow::addToolBar( QDockWindow *, Dock = DockTop, bool newLine = FALSE )
|
|
\i TQMainWindow::addToolBar( QDockWindow *, const TQString \& label, Dock = DockTop, bool newLine = FALSE )
|
|
\i TQMainWindow::lineUpToolBars( bool keepNewLines = FALSE )
|
|
\i TQMainWindow::moveToolBar( QDockWindow *, Dock = DockTop )
|
|
\i TQMainWindow::moveToolBar( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 )
|
|
\i TQMainWindow::removeToolBar( QDockWindow *)
|
|
\i TQMainWindow::setToolBarsMovable( bool )
|
|
\i TQMainWindow::toolBarPositionChanged( TQToolBar *)
|
|
\i TQMainWindow::toolBarsMovable() const
|
|
\i QMessageBox::message( const TQString \& caption, const TQString \& text, const TQString \& buttonText = TQString::null, TQWidget *parent = 0, const char *= 0 )
|
|
\i QMessageBox::query( const TQString \& caption, const TQString \& text, const TQString \& yesButtonText = TQString::null, const TQString \& noButtonText = TQString::null, TQWidget *parent = 0, const char *= 0 )
|
|
\i QMessageBox::standardIcon( Icon icon, GUIStyle style )
|
|
\i TQRegExp::match( const TQString \& str, int index = 0, int *len = 0, bool indexIsStart = TRUE ) const
|
|
\i QScrollView::childIsVisible( TQWidget *child )
|
|
\i QScrollView::showChild( TQWidget *child, bool show = TRUE )
|
|
\i QSimpleRichText::draw( TQPainter *p, int x, int y, const QRegion \& clipRegion, const TQColorGroup \& cg, const TQBrush *paper = 0 ) const
|
|
\i TQString::ascii() const
|
|
\i TQString::data() const
|
|
\i TQString::setExpand( uint index, TQChar c )
|
|
\i TQStyle::defaultFrameWidth() const
|
|
\i TQStyle::scrollBarExtent() const
|
|
\i TQStyle::tabbarMetrics( const TQWidget *t, int \& hf, int \& vf, int \& ov ) const
|
|
\i QTabDialog::isTabEnabled( const char *name ) const
|
|
\i QTabDialog::selected( const TQString \& )
|
|
\i QTabDialog::selected( const TQString \& tabLabel )
|
|
\i QTabDialog::setTabEnabled( const char *name, bool enable )
|
|
\i TQTextStream::TQTextStream( TQString \& str, int filemode )
|
|
\i TQToolBar::TQToolBar( const TQString \& label, TQMainWindow *, ToolBarDock = DockTop, bool newLine = FALSE, const char *name = 0 )
|
|
\i TQToolTip::enabled()
|
|
\i TQToolTip::setEnabled( bool enable )
|
|
\i QTranslator::find( const char *context, const char *sourceText, const char *comment = 0 ) const
|
|
\i QTranslator::insert( const char *context, const char *sourceText, const TQString \& translation )
|
|
\i QTranslator::remove( const char *context, const char *sourceText )
|
|
\i TQUriDrag::setFilenames( const TQStringList \& fnames )
|
|
\i TQWidget::backgroundColor() const
|
|
\i TQWidget::backgroundPixmap() const
|
|
\i TQWidget::iconify()
|
|
\i TQWidget::setBackgroundColor( const TQColor \& c )
|
|
\i TQWidget::setBackgroundPixmap( const QPixmap \& pm )
|
|
\i TQWidget::setFont( const TQFont \& f, bool )
|
|
\i TQWidget::setPalette( const QPalette \& p, bool )
|
|
\i QWizard::setFinish( TQWidget *, bool )
|
|
\i TQXmlInputSource::TQXmlInputSource( TQFile \& file )
|
|
\i TQXmlInputSource::TQXmlInputSource( TQTextStream \& stream )
|
|
\i TQXmlReader::parse( const TQXmlInputSource \& input )
|
|
\endlist
|
|
|
|
Additionally, these preprocessor directives have been removed:
|
|
|
|
\list
|
|
\i \c {#define strlen tqstrlen}
|
|
\i \c {#define strcpy qstrcpy}
|
|
\i \c {#define strcmp qstrcmp}
|
|
\i \c {#define strncmp tqstrncmp}
|
|
\i \c {#define stricmp tqstricmp}
|
|
\i \c {#define strnicmp tqstrnicmp}
|
|
\endlist
|
|
|
|
See the changes-3.0.0 document for an explanation of why this had to be done.
|
|
You might have been relying on the non-portable and unpredictable behavior
|
|
resulting from these directives. We strongly recommend that you either make
|
|
use of the safe qstr* variants directly or ensure that no 0 pointer is
|
|
passed to the standard C functions in your code base.
|
|
|
|
\section1 Collection Class Renaming
|
|
|
|
The classes QArray, QCollection, QList, QListIterator, QQueue, QStack
|
|
and QVector have been renamed as per the following table. The original
|
|
names are no longer avaialable.
|
|
|
|
\table
|
|
\header \i Old Name \i New Name \i New Header File
|
|
\row \i QArray \i \l TQMemArray \i \c <tqmemarray.h>
|
|
\row \i QCollection \i \l TQPtrCollection \i \c <tqptrcollection.h>
|
|
\row \i QList \i \l TQPtrList \i \c <tqptrlist.h>
|
|
\row \i QListIterator \i \l TQPtrListIterator \i \c <tqptrlist.h>
|
|
\row \i QQueue \i \l TQPtrQueue \i \c <tqptrqueue.h>
|
|
\row \i QStack \i \l TQPtrStack \i \c <tqptrstack.h>
|
|
\row \i QVector \i \l TQPtrVector \i \c <tqptrvector.h>
|
|
\endtable
|
|
|
|
\section1 QButtonGroup
|
|
|
|
In TQt 2.x, the function QButtonGroup::selected() returns the selected
|
|
\e radio button (QRadioButton). In TQt 3.0, it returns the selected \e
|
|
toggle button (\l QButton::toggleButton), a more general concept.
|
|
This might affect programs that use QButtonGroups that contain a
|
|
mixture of radio buttons and non-radio (e.g. QCheckBox) toggle buttons.
|
|
|
|
\section1 TQDate
|
|
|
|
Two TQDate member functions that were virtual in TQt 2.0 are not virtual
|
|
in TQt 3.0. This is only relevant if you subclassed TQDate and
|
|
reimplemented these functions:
|
|
|
|
\list
|
|
\i TQString TQDate::monthName( int month ) const
|
|
\i TQString TQDate::dayName( int weekday ) const
|
|
\endlist
|
|
|
|
In addition to no longer being virtual, TQDate::monthName() and
|
|
TQDate::dayName() have been renamed TQDate::shortMonthName() and
|
|
TQDate::shortDayName() and have been made static (as they should had
|
|
been in the first place). The old names are still provided for source
|
|
compatibility.
|
|
|
|
\section1 TQFileDialog
|
|
|
|
If the mode was not set explicitly, and the user entered a
|
|
non-existent file, the dialog would accept this. In TQt 3.x, you must
|
|
set the mode, e.g. setMode(TQFileDialog::AnyFile), to get the same
|
|
behavior.
|
|
|
|
\section1 TQFont
|
|
|
|
The internals of TQFont have changed significantly between TQt 2.2 and
|
|
Qt 3.0, to give better Unicode support and to make developing
|
|
internationalized applications easier. The original API has been
|
|
preserved with minimal changes. The CharSet enum and its related
|
|
functions have disappeared. This is because TQt now handles all charset
|
|
related issues internally, and removes this burden from the developer.
|
|
|
|
If you used the CharSet enum or its related functions, e.g
|
|
TQFont::charSet() or TQFont::setCharSet(), just remove them from your
|
|
code. There are a few functions that took a TQFont::CharSet as a
|
|
parameter; in these cases simply remove the charset from the
|
|
parameter list.
|
|
|
|
\section1 QInputDialog
|
|
|
|
The two static getText(...) methods in QInputDialog have been merged.
|
|
The \c echo parameter is the third parameter and defaults to
|
|
QLineEdit::Normal.
|
|
|
|
If you used calls to QInputDialog::getText(...) that provided more
|
|
than the first two required parameters you will must add a value
|
|
for the \c echo parameter.
|
|
|
|
\section1 QLayout and Other Abstract Layout Classes
|
|
|
|
The definitions of \l QGLayoutIterator, \l QLayout, \l QLayoutItem, \l
|
|
QLayoutIterator, \l QSpacerItem and \l TQWidgetItem have been moved from \c
|
|
<ntqabstractlayout.h> to \c <ntqlayout.h>. The header \c
|
|
<ntqabstractlayout.h> now includes \c <ntqlayout.h> for compatibility. It
|
|
might be removed in a future version.
|
|
|
|
\section1 QListViewItem
|
|
|
|
The paintBranches() function in TQt 2.x had a GUIStyle parameter; this
|
|
has been dropped for TQt 3.x since GUI style is handled by the new
|
|
style engine (See \l TQStyle.)
|
|
|
|
\section1 QMoveEvent
|
|
|
|
In TQt 2.x, the function QMoveEvent::pos() returned the position of the
|
|
widget in its parent widget, including the window frame. In TQt 3.0,
|
|
it returns the new position of the widget, excluding window frame for
|
|
top level widgets.
|
|
|
|
\section1 QMultiLineEdit
|
|
|
|
The QMultiLineEdit was a simple editor widget in previous TQt versions.
|
|
Since TQt 3.0 includes a new richtext engine, which also supports
|
|
editing, QMultiLineEdit is obsolete. For the sake of compatibility
|
|
QMultiLineEdit is still provided. It is now a subclass of TQTextEdit
|
|
which wraps the old QMultiLineEdit so that it is mostly source
|
|
compatible to keep old applications working.
|
|
|
|
For new applications and when maintaining existing applications we
|
|
recommend that you use TQTextEdit instead of QMultiLineEdit wherever
|
|
possible.
|
|
|
|
Although most of the old QMultiLineEdit API is still available, there
|
|
is one important difference. The old QMultiLineEdit operated in terms
|
|
of lines, whereas TQTextEdit operates in terms of paragraphs. This is
|
|
because lines change all the time during wordwrap, whereas paragraphs
|
|
remain paragraphs. The consequence of this change is that functions
|
|
which previously operated on lines, e.g. numLines(), textLine(), etc.,
|
|
now work on paragraphs.
|
|
|
|
Also the function getString() has been removed since it
|
|
published the internal data structure.
|
|
|
|
In most cases, applications that used QMultiLineEdit will continue to
|
|
work without problems. Applications that worked in terms of lines may
|
|
require some porting.
|
|
|
|
The source code for the old 2.x version of QMultiLineEdit can be found
|
|
in \c $TQTDIR/src/attic/qtmultilineedit.h/cpp. Note that the class has
|
|
been renamed to QtMultiLineEdit to avoid name clashes. If you really
|
|
need to keep compatibility with the old QMultiLineEdit, simply include
|
|
this class in your project and rename QMultiLineEdit to
|
|
QtMultiLineEdit throughout.
|
|
|
|
\section1 QPrinter
|
|
|
|
QPrinter has undergone some changes, to make it more flexible and
|
|
to ensure it has the same runtime behaviour on both Unix and Windows. In 2.x,
|
|
QPrinter behaved differently on Windows and Unix, when using view
|
|
transformations on the TQPainter. This has changed now, and QPrinter
|
|
behaves consistently across all platforms. A compatibilty mode has been
|
|
added that forces the old behaviour, to ease porting from TQt 2.x
|
|
to TQt 3.x. This compatibilty mode can be enabled by passing the
|
|
QPrinter::Compatible flag to the QPrinter constructor.
|
|
|
|
On X11, QPrinter used to generate encapsulated postscript when
|
|
fullPage() was TRUE and only one page was printed. This does not
|
|
happen by default anymore, providing a more consistent printing output.
|
|
|
|
\section1 TQRegExp
|
|
|
|
The \l TQRegExp class has been rewritten to support many of the features of Perl
|
|
regular expressions. Both the regular expression syntax and the TQRegExp
|
|
interface have been modified.
|
|
|
|
Be also aware that \c <tqregexp.h> is no longer included
|
|
automatically when you include \c <tqstringlist.h>. See
|
|
\link #Headers above \endlink for details.
|
|
|
|
\omit
|
|
In TQt 3.0, tqregexp.h has to
|
|
include tqstringlist.h, so it's no good to have tqstringlist.h include tqregexp.h,
|
|
unless one wants to achieve an Escher effect.
|
|
\endomit
|
|
|
|
\section2 New special characters
|
|
|
|
There are five new special characters: <tt>(</tt>, <tt>)</tt>, <tt>{</tt>,
|
|
<tt>|</tt> and <tt>}</tt> (parentheses, braces and pipe). When porting old
|
|
regular expressions, you must add <tt>\</tt> (backslash) in front of any
|
|
of these (actually, <tt>\\</tt> in C++ strings), unless it is already
|
|
there.
|
|
|
|
Example: Old code like
|
|
\code
|
|
TQRegExp rx( "([0-9|]*\\)" ); // works in TQt 2.x
|
|
\endcode
|
|
should be converted into
|
|
\code
|
|
TQRegExp rx( "\\([0-9\\|]*\\)" ); // works in TQt 2.x and 3.x
|
|
\endcode
|
|
(Within character classes, the backslash is not necessary in front of certain
|
|
characters, e.g. <tt>|</tt>, but it doesn't hurt.)
|
|
|
|
Wildcard patterns need no conversion. Here are two examples:
|
|
\code
|
|
TQRegExp wild( "(*.*)" );
|
|
wild.setWildcard( TRUE );
|
|
\endcode
|
|
\code
|
|
// TRUE as third argument means wildcard
|
|
TQRegExp wild( "(*.*)", FALSE, TRUE );
|
|
\endcode
|
|
However, when they are used, make sure to use TQRegExp::exactMatch()
|
|
rather than the obsolete TQRegExp::match(). TQRegExp::match(), like
|
|
TQRegExp::find(), tries to find a match somewhere in the target
|
|
string, while TQRegExp::exactMatch() tries to match the whole target
|
|
string.
|
|
|
|
\section2 TQRegExp::operator=()
|
|
|
|
This function has been replaced by \l TQRegExp::setPattern() in TQt 2.2.
|
|
Old code such as
|
|
\code
|
|
TQRegExp rx( "alpha" );
|
|
rx.setCaseSensitive( FALSE );
|
|
rx.setWildcard( TRUE );
|
|
rx = "beta";
|
|
\endcode
|
|
still compiles with TQt 3, but produces a different result (the case sensitivity
|
|
and wildcard options are forgotten). This way,
|
|
\code
|
|
rx = "beta";
|
|
\endcode
|
|
is the same as
|
|
\code
|
|
rx = TQRegExp( "beta" );
|
|
\endcode
|
|
which is what one expects.
|
|
|
|
\section2 TQRegExp::match()
|
|
|
|
The following function is now obsolete, as it has an unwieldy
|
|
parameter list and was poorly named:
|
|
\list
|
|
\i bool TQRegExp::match( const TQString \& str, int index = 0,
|
|
int * len = 0, bool indexIsStart = TRUE ) const
|
|
\endlist
|
|
It will be removed in a future version of Qt. Its \link
|
|
TQRegExp::match() documentation \endlink explains how to replace it.
|
|
|
|
\section2 TQRegExp::find()
|
|
|
|
This function was removed, after a brief appearance in TQt 2.2. Its
|
|
name clashed with TQString::find(). Use \l TQRegExp::search() or \l
|
|
TQString::find() instead.
|
|
|
|
\section2 TQString::findRev() and TQString::contains()
|
|
|
|
\l TQString::findRev()'s and \l TQString::contains()'s semantics have changed
|
|
between 2.0 and 3.0 to be more consistent with the other overloads.
|
|
|
|
For example,
|
|
\code
|
|
TQString( "" ).contains( TQRegExp("") )
|
|
\endcode
|
|
returns 1 in TQt 2.0; it returns 0 in TQt 3.0. Also, "^" now really means
|
|
start of input, so
|
|
\code
|
|
TQString( "Heisan Hoppsan" ).contains( TQRegExp("^.*$") )
|
|
\endcode
|
|
returns 1, not 13 or 14.
|
|
|
|
This change affect very few existing programs.
|
|
|
|
\section2 TQString::replace()
|
|
|
|
With TQt 1.0 and 2.0, a TQString is converted implicitly into a TQRegExp
|
|
as the first argument to TQString::replace():
|
|
\code
|
|
TQString text = fetch_it_from_somewhere();
|
|
text.replace( TQString("[A-Z]+"), "" );
|
|
\endcode
|
|
With TQt 3.0, the compiler gives an error. The solution is to use a
|
|
TQRegExp cast:
|
|
\code
|
|
text.replace( TQRegExp("[A-Z]+"), "" );
|
|
\endcode
|
|
This change makes it possible to introduce a
|
|
TQString::replace(TQString, TQString) overload in a future version of Qt
|
|
without breaking source compatibility.
|
|
|
|
\section1 QSemiModal
|
|
|
|
The QSemiModal class is now obsolete. You should call show() on a
|
|
modal dialog instead.
|
|
|
|
\section1 QSortedList
|
|
|
|
The QSortedList class is now obsolete. Consider using a TQDict, a TQMap
|
|
or a plain TQPtrList instead.
|
|
|
|
\section1 QTableView
|
|
|
|
The QTableView class has been obsoleted and is no longer a part of the
|
|
Qt API. Either use the powerful QTable class or the simplistic
|
|
QGridView in any new code you create. If you really need the old table
|
|
view for compatibility you can find it in \c
|
|
$TQTDIR/src/attic/qttableview.{cpp,h}. Note that the class has been
|
|
renamed from QTableView to QtTableView to avoid name clashes. To use
|
|
it, simply include it in your project and rename QTableView to
|
|
QtTableView throughout.
|
|
|
|
\section1 TQToolButton
|
|
|
|
The \l TQToolButton class used to distinguish between "on" and "off"
|
|
icons. In 3.0, this mechanism was moved into the \l TQIconSet class
|
|
(see \l TQIconSet::State). The two TQToolButton::onIconSet and
|
|
TQToolButton::offIconSet properties have been removed, together with
|
|
the following two functions as well.
|
|
|
|
\list
|
|
\i void TQToolButton::setIconSet ( const TQIconSet \& set, bool on )
|
|
\i TQIconSet TQToolButton::iconSet ( bool on ) const
|
|
\endlist
|
|
|
|
New code should use the following functions instead:
|
|
|
|
\list
|
|
\i void TQToolButton::setIconSet( const TQIconSet \& set )
|
|
\i TQIconSet TQToolButton::iconSet() const
|
|
\endlist
|
|
|
|
\section1 TQTextStream
|
|
|
|
The global TQTextStream manipulators setw(), setfill() and setprecison()
|
|
were renamed to qSetW(), qSetFill() and qSetPrecision() to avoid conflicts
|
|
with \c <iostream.h>. If you used them, you must rename the occurrences to
|
|
the new names.
|
|
|
|
\section1 QTranslator
|
|
|
|
The \l QTranslator class was extended in TQt 2.2, and these extensions
|
|
lead to a new interface. This interface is used mainly by translation
|
|
tools (for example, \link linguist-manual.book Qt
|
|
Linguist \endlink). For source compatibility, no member function was
|
|
effectively removed. The \l QTranslator documentation points out
|
|
which functions are obsolete.
|
|
|
|
This function is no longer virtual:
|
|
|
|
\list
|
|
\i TQString QTranslator::find( const char * context,
|
|
const char * sourceText ) const
|
|
\endlist
|
|
|
|
If you have a class that inherits QTranslator and which reimplements
|
|
QTranslator::find(), you should reimplement QTranslator::findMessage() instead.
|
|
In fact, find() is now defined in terms of findMessage(). By doing the
|
|
conversion, you will also gain support for translator comments and for any
|
|
future extensions.
|
|
|
|
\section1 TQWidget
|
|
|
|
TQWidget::backgroundColor(), TQWidget::setBackgroundColor(),
|
|
TQWidget::backgroundPixmap() and TQWidget::setBackgroundPixmap() have
|
|
often been the source of much confusion in previous releases. TQt 3.0
|
|
addresses this by obsoleting these functions and by replacing them
|
|
with eight new functions: TQWidget::eraseColor(),
|
|
TQWidget::setEraseColor(), TQWidget::erasePixmap(),
|
|
TQWidget::setErasePixmap(), TQWidget::paletteBackgroundColor(),
|
|
TQWidget::setPaletteBackgroundColor(),
|
|
TQWidget::paletteBackgroundPixmap() and
|
|
TQWidget::setPaletteBackgroundPixmap(). See their documentation for
|
|
details.
|
|
|
|
\section1 TQXml Classes
|
|
|
|
\section2 TQXmlInputSource
|
|
|
|
The semantics of TQXmlInputSource has changed slightly. This change
|
|
only affects code that parses the same data from the same input source
|
|
multiple times. In such cases you must call
|
|
TQXmlInputSource::reset() before the second call to
|
|
TQXmlSimpleReader::parse().
|
|
|
|
So code like
|
|
\code
|
|
TQXmlInputSource source( &xmlFile );
|
|
TQXmlSimpleReader reader;
|
|
...
|
|
reader.parse( source );
|
|
...
|
|
reader.parse( source );
|
|
\endcode
|
|
must be changed to
|
|
\code
|
|
TQXmlInputSource source( &xmlFile );
|
|
TQXmlSimpleReader reader;
|
|
...
|
|
reader.parse( source );
|
|
...
|
|
source.reset();
|
|
reader.parse( source );
|
|
\endcode
|
|
|
|
\section2 TQXmlLocator
|
|
|
|
Due to some internal changes, it was necessary to clean-up the semantics of
|
|
TQXmlLocator: this class is now an abstract class. This shouldn't cause
|
|
any problems, since programmers usually used the TQXmlLocator that was
|
|
reported by TQXmlContentHandler::setDocumentLocator(). If you used this
|
|
class in some other way, you must adjust your code to use the
|
|
TQXmlLocator that is reported by the
|
|
TQXmlContentHandler::setDocumentLocator() function.
|
|
|
|
\section1 Asynchronous I/O Classes
|
|
|
|
QASyncIO, TQDataSink, TQDataSource, TQIODeviceSource and TQDataPump were
|
|
used internally in previous versions of Qt, but are not used anymore.
|
|
They are now obsolete.
|
|
|
|
\section1 Transparent widgets
|
|
|
|
In TQt 2.x, the AutoMask property was used to obtain a
|
|
transparent-looking widget. In general, this approach is slow and
|
|
processor hungry. TQt 3.0 uses the BackgroundOrigin which provides
|
|
vastly improved performance and more flexibility in most cases. The
|
|
few classes for which the AutoMask property is still the best approach
|
|
are QCheckBox, QComboBox, QPushButton, QRadioButton and QTabWidget.
|
|
|
|
\section1 Bezier Curves
|
|
|
|
The function names for Bezier curves in TQPainter and QPointArray have
|
|
been corrected. They now properly reflect their cubic form instead of
|
|
a quadratic one. If you have been using either
|
|
TQPainter::drawQuadBezier() or QPointArray::quadBezier() you must
|
|
replace these calls with
|
|
\list
|
|
\i void TQPainter::drawCubicBezier( const QPointArray \&, int index=0 ) and
|
|
\i QPointArray QPointArray::cubicBezier() const
|
|
\endlist
|
|
respectively. Neither the arguments nor the resulting curve have changed.
|
|
|
|
\section1 Locale-aware String Comparisons in TQIconView, QListBox,
|
|
QListView and QTable
|
|
|
|
In TQt 2.x, TQString only provided string comparisons using the Unicode
|
|
values of the characters of a string. This is efficient and reliable,
|
|
but it is not the appropriate order for most languages. For example,
|
|
French users expect 'é' (e acute) to be treated essentially as
|
|
'e' and not put after 'z'.
|
|
|
|
In TQt 3.0, TQString::localeAwareCompare() implements locale aware
|
|
string comparisions on certain platforms. The classes \l TQIconView, \l
|
|
QListBox, \l QListView and \l QTable now use
|
|
TQString::localeAwareCompare() instead of TQString::compare(). If you
|
|
want to control the behaviour yourself you can always reimplement
|
|
TQIconViewItem::compare(), QListBox::text(), QListViewItem::compare()
|
|
or QTableItem::key() as appropriate.
|
|
|
|
*/
|