diff options
author | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2009-04-17 11:40:17 (GMT) |
---|---|---|
committer | Carlos Manuel Duclos Vergara <carlos.duclos@nokia.com> | 2009-04-17 11:40:17 (GMT) |
commit | d93c21b9b9e55d76987af098a6912f9214ae2482 (patch) | |
tree | c875ec64797e723468c1b5473b5e3849d1aa9fe6 | |
parent | 4df7355273916eb87eea89f39404c3a1e336766b (diff) | |
parent | 822647ae6c7720f3dc76b3aece4e330eb1780aa4 (diff) | |
download | Qt-d93c21b9b9e55d76987af098a6912f9214ae2482.zip Qt-d93c21b9b9e55d76987af098a6912f9214ae2482.tar.gz Qt-d93c21b9b9e55d76987af098a6912f9214ae2482.tar.bz2 |
Merge branch '4.5.1' of git@scm.dev.troll.no:qt/qt-releases into 4.5.1
24 files changed, 564 insertions, 161 deletions
@@ -6210,6 +6210,9 @@ QT_BUILD_KEY_COMPAT= if [ "$QT_CROSS_COMPILE" = "no" ]; then # previous versions of Qt used a build key built from the uname QT_BUILD_KEY_COMPAT="$CFG_USER_BUILD_KEY $UNAME_MACHINE $UNAME_SYSTEM $COMPILER $BUILD_OPTIONS" + if [ -n "$QT_NAMESPACE" ]; then + QT_BUILD_KEY_COMPAT="$QT_BUILD_KEY_COMPAT $QT_NAMESPACE" + fi fi # strip out leading/trailing/extra whitespace QT_BUILD_KEY=`echo $QT_BUILD_KEY | sed -e "s, *, ,g" -e "s,^ *,," -e "s, *$,,"` diff --git a/configure.exe b/configure.exe Binary files differindex 13ca0e5..ff71f08 100644 --- a/configure.exe +++ b/configure.exe diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp index 94e44f3..32f2ad0 100644 --- a/demos/qtdemo/colors.cpp +++ b/demos/qtdemo/colors.cpp @@ -278,6 +278,9 @@ void Colors::parseArgs(int argc, char *argv[]) + "[-low] [-ticker-letters<int>] [-ticker-speed<float>] [-no-ticker-morph] " + "[-ticker-morph-speed<float>] [-ticker-text<string>]"); exit(0); + } else{ + QMessageBox::warning(0, "QtDemo", QString("Unrecognized argument:\n") + s); + exit(0); } } diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index 8df9eca..369972e 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -184,7 +184,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->tickerInAnim->startDelay = 2000; this->ticker->useGuideQt(); this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(true); } break; case MENU1: @@ -220,7 +219,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->score->queueMovie(this->currentInfo + " -buttons", Score::NEW_ANIMATION_ONLY); if (!Colors::noTicker){ this->score->queueMovie("ticker -out", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(false); } break; case UP:{ @@ -257,7 +255,6 @@ void MenuManager::itemSelected(int userCode, const QString &menuName) this->ticker->doIntroTransitions = false; this->tickerInAnim->startDelay = 500; this->score->queueMovie("ticker", Score::NEW_ANIMATION_ONLY); - this->window->switchTimerOnOff(true); } } else if (this->currentMenuCode != ROOT) itemSelected(ROOT, Colors::rootMenuName); diff --git a/dist/changes-4.5.1 b/dist/changes-4.5.1 index bbf0bf1..0b8dae2 100644 --- a/dist/changes-4.5.1 +++ b/dist/changes-4.5.1 @@ -24,10 +24,28 @@ General Improvements -------------------- - Documentation and Examples + * Added printing feature for the Spreadsheet demo. + * [245675] Clarified the differences between QItemDelegate and + QStyledItemDelegate. + * [248752] Marked QPrintDialog::printer(), setPrinter() and addButton() + as Unix only functions, part of Qt3Support. - Embedded Dialogs demo * [246517] Fixed warnings and bugs in hover handling on Mac OS X + +Optimizations +------------- + +- Graphics View has been optimized in several areas + * Improved the performance of QGraphicsItem::clipPath. + * Improved the performance of QGraphicsItem::setPos. + * Improved the performance of QGraphicsItem::effectiveOpacity. + * Improved the performance of QGrahicsScene::items(*). + * Improved update handling. + * Reduced the number of floating point operations. + * Reduced QVariant overhead. + Third party components ---------------------- @@ -37,68 +55,110 @@ Third party components **************************************************************************** - QAbstractItemModel - * [243195] Clrarified some warning messages printed if the model is invalid. + * [243195] Clarified some warning messages printed if the model is invalid. - QAbstractEventDispatcher - * [248805] Duplicates timerid could happen when timer are running while - the QObject is moved to another thread, and would stop timers from working. + * [248805] Duplicate timerids could occur when a timer is running while + the QObject is moved to another thread, stopping timers from working. - QAbstractSocket - * [192037] Emit disconnected only if we were connected before + * [192037] Emit the disconnected signal only if we were connected before. + +- QAccessible + * [241161] Fixed a bug in browsing menus with the keyboard. + * [221731] Fixed a bug where the accessibility plugin could crash if + there was an "&" at the end or spin forever if a label had a sequence of + "&&". + +- QAtomicInt + * [216492] Fixed compilation on 64-bit PowerPC machines with gcc 4.3. - QAuthenticator - * [237979] fix implemenation of md5-sess + * [237979] Fixed implementation of md5-sess. - QByteArray - * [246233] QByteArray::fromHex() fails with input of size 1 + * [246233] QByteArray::fromHex() fails with input of size 1. - QColorDialog - * [247349] Fixed bug causing the wrong alpha value to be returned. + * [247349] Fixed a bug causing the wrong alpha value to be returned. - QCombobox - * [248094] Fixed scrollbar appearing while not required. + * [248094] Fixed scrollbar from appearing when not required. - QCompleter - * [250064] Fixed focus policy propagation regression. - * [246056] Fixed assertion failure in setCompletionPrefix(). + * [250064] Fixed a focus policy propagation regression. + * [246056] Fixed an assertion failure in setCompletionPrefix(). + +- QtConcurrent + * [244718] Reduced the number of calls to QThread::idealThreadCount(). - QDirIterator - * [247645] Fix a bug that may loose all cached data inside the QFileInfo + * [247645] Fixed a bug that may loose all cached data inside QFileInfo. - QFile - * [244500] QFile::rename() doesn't always return false when the method fails - * [244485] Renaming a file does not change QFile::fileName() + * [244500] QFile::rename() does not always return false when the method + fails + * [244485] Renaming a file does not change QFile::fileName(). - QFileInfo - * [205244] return valid file info also for relative UNC paths + * [205244] Return valid file info also for relative UNC paths. - QFileDialog - * [250194] QFileDialog and QSortFilterProxyModel index mapping issue - * [248332] QFileDialog is slow after visiting a large directory - * [221323] QFileDialog programatical file selection bug + * [250194] Fixed an issue with QFileDialog and QSortFilterProxyModel + index mapping. + * [248332] QFileDialog is slow after visiting a large directory. + * [221323] QFileDialog programmatical file selection bug. - QGraphicsItem - * [247890] Cached QGraphicsItems are not updated if update() is called when they are hidden + * [247890] Cached QGraphicsItems are not updated if update() is called + when they are hidden. * [250272] When an item is deleted it does not get removed from the - sceneeventfilters meaning a crash can occur - * Fixed slowdown regression in QGraphicsItem::ItemCoordinateCache + sceneeventfilters, meaning a crash can occur. + * Fixed a slow down regression in QGraphicsItem::ItemCoordinateCache. + +- QGraphicsGridLayout + * [242472] Fixed a bug where the calculation of the maximum width of a + column was incorrect. - QGraphicsScene - * [243707] Fixed crash when adding child before parent to scene + * [243707] Fixed a crash when adding child before parent to scene. + +- QGraphicsView + * [245766] Rubber Band drag mode does not update correctly when + scrolling. --QGraphicsView - * [245766] Rubber Band drag mode not updated correctly when scrolling +- QGraphicsWidget + * [246215] Fixed a regression where we could cache the wrong size hint + because we called the virtual sizeHint() from the constructor. - QHttp - * [208445] cancel request upon receiving unknown authentication method + * [208445] Cancel request upon receiving unknown authentication method. + * Compile fixes for QT_BEGIN_NAMESPACE being in the wrong place in + some private headers. + +- QHostAddress + * [247330] Fixed compilation on MinGW by adding a missing QPair include. + +- QLocalSocket + * Fixed a bug that would cause QLocalSocket to disconnect 30 seconds + after a succesful delayed connection on UNIX. - QMacStyle - * [248769] Fix regression where QMacStyle would only draw tabs when passed a QStyleOptionTabV3. - * Adjust the opacity value for popups. + * [248769] Fixed a regression where QMacStyle would only draw tabs when + passed a QStyleOptionTabV3. + * Adjusted the opacity value for popups. - QMainWindow * [248048] Fix a regression that would cause tooltips to disappear when using the unified toolbar. +- QMetaType + * [248890] Detailed description of QMetaType no longer contradicts + documentation of QMetaType::type() + +- QMutex + * Fix performance regression for contended mutexes as reported on + the qt4-preview-feedback list. + - QPainter * [247492] Fix rendering bug in raster paint engine causing one-pixel offset when drawing premultiplied ARGB32 images on RGB16 images. @@ -110,11 +170,17 @@ Third party components * [247505] Fix missing fills of rectangles with negative width/height in raster paint engine. * [249628] Fix crash in OpenGL paint engine when filling using Qt::NoBrush. + * Compile fixes for OpenGL paint engine on OpenGL/ES 1.1 CommonLite + and OpenGL/ES 1.0. - QPixmap * [249175] Fix QPixmap::fromImage() of monochrome images to result in black/white pixels and not transparent/white pixels. +- QProcess + * [247865] Fix a crash when calling QProcess::start() and + startDetached() with an empty program string. + - QScrollBar * [247985] Stylesheet: added ability to style scrollbar menus. @@ -130,6 +196,9 @@ Third party components * [245668] set also protocol, verifyMode and verifyDepth in setSslConfiguration() +- QString + * [249517] Fixed regression in replace(int, int, QChar) when string is empty + - QStyleSheetStyle * Improved support for setting background and foreground roles in styles such as the text color in a combo box popup on Mac and Cleanlooks, or @@ -138,14 +207,30 @@ Third party components * Fixed crash while styling the title bar of a QMdiArea. * [246542] Fixed QToolButton::hover{ color:.... } +- QThread + * [249997] Add documentation indicating that the priority set by + the programmer may be ignored, for example on Linux. + - QTreeView * Fixed crash that may occurs when event are processed just after QSortFilterProxyModel has been invalidated * [246025] Fixed auto-expand that occurs while quicly collapsing an item after clicking on a child - * [248805] Calling programatically QTreeView::sortByColumn was not working if manual + * [248805] Calling programatically QTreeView::sortByColumn was not working if manual sorting is disabled * [248163] Fixed possible crash in the paintEvent when spans are used. +- QWidget + * [250388] Fixed potential crash in QWidget::scroll() when using the raster + graphics system. + +- QWidget + * [246852] Better handling WindowMaximizeButtonHint for widget with + layouts. + +-QLocale + * String-to-number conversion functions are now ignore trailing and + leading whitespaces in all locales as it is documented. + - QWizard * [248107] Fixed bug on Vista causing Back button to connect twice to the back() signal. @@ -161,10 +246,28 @@ Third party components * Fixed path fill styles (Zack Rusin) * Fixed pre-edit text handling with input methods. +- QSqlTableModel + * [189093] QSqlTableModel did not handle updates when one of the fields + had a NULL value. + * Made setTable() try and use the db's casing of the passed tablename. + **************************************************************************** * Database Drivers * **************************************************************************** + * Fixed DB2 driver returning double field as empty + * Fixed memory leak in DB2 driver + * [249059] Fixed QPSQL datetime/time fields with negative timezone offsets + not being handled correctly. + * Fixed DB2 not enquoting table/field names properly. + * Fixed an issue with ODBC & FreeTDS not accepting quotes in statements. + * Fixed sqlite2 driver not returning false on failing to exec a statement. + * PrecisionPolicy now works in the oracle driver. + * Fixed ODBC driver returning a list of tables when requested. + * Fixed Interbase retrieving scale/precision information on numeric/decimal fields. + * Stopped drivers doing quoting again when escapeIdentifier called twice. + * Fixed sqlite2 driver not quoting fields correctly. + * [232769] Fixed memory overflow issue on bound out strings in ODBC Driver **************************************************************************** * Platform Specific Changes * @@ -173,6 +276,37 @@ Third party components Qt for Linux/X11 ---------------- + * Proper resetting input contexts when switching between multiple + input context plugins. + + * [244337] Improved input method handling when the widgets native + window id is recreated. + + * Input methods preedit strings are properly reset when user + switches focus without commiting a string. + + * [244607] Current focus widget is properly set and input method is + properly initialized when showing a toplevel that accepts + keyboard input. + + * Unicode conversion functions will handle Latin-1 character set + only if they are used before QCoreApplication/QApplication is + constructed. + + * Improved handling of failed unicode conversion. + + * [232632] Fixed reparenting widgets to a difference X11 screen. + + * [241888] The background of the drag-n-drop cursor is respected + according to the stylesheet. + + * Fixed clipboard handling when the user manually creates an + instance of the QDesktopWidget. + + * [226048] Fixed emitting a QDesktopWidget::resized() signal when + new screen appears or screen geometry is changed without + affecting the whole desktop geometry. + - Phonon/GStreamer * [244259] Fixed a problem where the backend would fail to indicate an error when streaming fails. @@ -184,13 +318,13 @@ Qt for Linux/X11 CD playback. - QGtkStyle - * The system palette is no longer strictly forced. Also behavior related + * The system palette is no longer strictly forced. Also behavior related to system theme changes have been improved. * [249363] QFrame is now styled as a GtkScrolledWindow. * [247653] Fixed a compilation issue on solaris. - * Fixed palette and styling issues with the background color of + * Fixed palette and styling issues with the background color of combo box popups. - * [239829] Disabled alt-key navigation for QGtkStyle to follow + * [239829] Disabled alt-key navigation for QGtkStyle to follow GTK+ behavior. * [238196] Allow middle click to set scrollbar position to follow GTK+ behavior. @@ -210,10 +344,17 @@ Qt for Linux/X11 * Event posted to a thread before it is started are not processed until others events are posted. +- QWidget + * [213512] Fixed a bug that would cause wrong clipping when using the + Qt::WA_PaintOutsidePaintEvent attribute. + Qt for Windows -------------- + * [243583] Improved drag-and-drop handling when switching mouse + buttons fast. + - QCoreApplication * [247401] Fixed a bug that would cause a restarted timer to fire too early, causing Javascript in QtWebKit to consume 100% CPU on @@ -222,6 +363,10 @@ Qt for Windows * [248036] Fixed an issue where tool buttons would incorrectly hover when disabled. +- QWidget + * [248391] Fixed a bug that made it impossible to dynamically switch + from QPainter based graphics to native graphics API and back. + - [249576] Fixed a crash when using a combobox with Qt::NoFocus. - [244875] System menu will now be shown for a fullscreen window. - [240891] Corrected the focus behavior of native file dialogs, when application has multiple toplevels. @@ -247,14 +392,43 @@ Qt for Mac OS X * Modify the colliding mice example to work better with coalesced updates. * Fixed a bug where the drag cursor was not updated when modifier keys are used. * [247947] Fixed a crash in drag and drop. + * The command + h shortcut is now enabled. (Hides the current window.) + * [239043] Fixed a bug that would cause QGraphicsProxyWidget to shrink when moving it. -- Fix a crash when showing a widget that is window modal but has no parent. -- [248803] Showing two dialogs at the same time don't get shared activation. -- Added QSysInfo::MV_10_6 as an enum to test against. -- Various compile fixes for Snow Leopard (preliminary support). +- QDesktopWidget + * [244004] Support multiple screens that have different sizes properly. + +- QDialog + * [239155] QDialog(foo, Qt::Sheet) with QComboBox have none native behavior. + * [218980] Modeless dialogs should be stacked above normal windows. + * [195904] Parent dialog is displayed on top of its modal child. + +- QFileDialog + * [219844] QFileDialog::getOpenFileName() search buttons lead to crash (native version). + * [225705] QFileDialog::getSaveFileName()'s filter does not display correctly. + +- QMenu + * [228017] QMenu should close when expanding a system menu. + +- Event system + * [210912] ShowEvent not sendt when reshowing a window after it was minimized. +- macdeployqt + * The binary packages now includes the macdeployqt tool. + * macdeployqt now runs 'strip' on the deployed binaries. + * Fixed issue preventing the QtSvg from being deployed. +- configure script + * Now supports "-arch i386" as an alias for "-arch x86". + * Detects invalid arch arguemnts and exits. + +- Fix a crash when showing a widget that is window modal but has no parent. +- [248803] Showing two dialogs at the same time don't get shared activation. +- Added QSysInfo::MV_10_6 as an enum to test against. +- Various compile fixes for Snow Leopard (preliminary support). - The uninstall-qt.py script included in the binary package no longer complains about removing itself multiple times. +- [223525] Macmainwindow Demo Application (crashfix). + - Document a bit clearer how qt_mac_set_dock_menu() works. @@ -267,10 +441,13 @@ Qt for Embedded Linux --------------------- - Various improvements to the Qt DirectFB plugin. +- Fix recreation of temporary EGL surfaces in PowerVR gfxdriver. +- Document some necessary #define's for building the PowerVR gfxdriver. Qt for Windows CE ----------------- + * [246619] Fixed tap and hold bug for QCheckbox. **************************************************************************** * Compiler Specific Changes * @@ -297,12 +474,23 @@ Qt for Windows CE * [245503] Fixed redundant backslashes in string property in property browser. - Linguist + - Linguist GUI - - lupdate + * [248076] Fixed crash upon opening files for which we have no plural rules + * [249519] Fixed crash upon dropping text into non-focused lineedit - - lrelease + - Entire Linguist toolchain + + * [244035] Fixed endless loop in PO writer + * [247738] Improved handling of duplicated messages + * [248849] Fixed encoding in XLIFF writer + * [249022] Fixed TS' and QM's handling of messages which appear in multiple encodings + + - lupdate + * [248724] Fixed encoding of messages from .ui files if CODECFORTR is not utf8 + * [249633] Fixed processing of C++ backslash line continuations - rcc @@ -324,6 +512,7 @@ Qt for Windows CE * [248806] Ensure that the Xcode generator includes the right path to frameworks. * [201495] Comment processing in qmake prevented file from being moc'ed * On Mac OS, properly escape file names in QMAKE_BUNDLE_DATA + * Fixed moc and uic features to make shadow builds work even if a non-shadow build is present - configure diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index d62bee2..111ef35 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -59,7 +59,7 @@ Dialog::Dialog(QWidget *parent) integerLabel = new QLabel; integerLabel->setFrameStyle(frameStyle); QPushButton *integerButton = - new QPushButton(tr("QInputDialog::get&Integer()")); + new QPushButton(tr("QInputDialog::get&Int()")); doubleLabel = new QLabel; doubleLabel->setFrameStyle(frameStyle); @@ -198,8 +198,8 @@ void Dialog::setInteger() { //! [0] bool ok; - int i = QInputDialog::getInteger(this, tr("QInputDialog::getInteger()"), - tr("Percentage:"), 25, 0, 100, 1, &ok); + int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"), + tr("Percentage:"), 25, 0, 100, 1, &ok); if (ok) integerLabel->setText(tr("%1%").arg(i)); //! [0] diff --git a/examples/layouts/flowlayout/flowlayout.cpp b/examples/layouts/flowlayout/flowlayout.cpp index 5464c7c..f628e94 100644 --- a/examples/layouts/flowlayout/flowlayout.cpp +++ b/examples/layouts/flowlayout/flowlayout.cpp @@ -43,16 +43,16 @@ #include "flowlayout.h" -FlowLayout::FlowLayout(QWidget *parent, int margin, int spacing) - : QLayout(parent) +FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) + : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) { setMargin(margin); - setSpacing(spacing); } -FlowLayout::FlowLayout(int spacing) +FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) + : m_hSpace(hSpacing), m_vSpace(vSpacing) { - setSpacing(spacing); + setMargin(margin); } FlowLayout::~FlowLayout() @@ -67,6 +67,24 @@ void FlowLayout::addItem(QLayoutItem *item) itemList.append(item); } +int FlowLayout::horizontalSpacing() const +{ + if (m_hSpace >= 0) { + return m_hSpace; + } else { + return smartSpacing(QStyle::PM_LayoutHorizontalSpacing); + } +} + +int FlowLayout::verticalSpacing() const +{ + if (m_vSpace >= 0) { + return m_vSpace; + } else { + return smartSpacing(QStyle::PM_LayoutVerticalSpacing); + } +} + int FlowLayout::count() const { return itemList.size(); @@ -125,20 +143,27 @@ QSize FlowLayout::minimumSize() const int FlowLayout::doLayout(const QRect &rect, bool testOnly) const { - int x = rect.x(); - int y = rect.y(); + int left, top, right, bottom; + getContentsMargins(&left, &top, &right, &bottom); + QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); + int x = effectiveRect.x(); + int y = effectiveRect.y(); int lineHeight = 0; QLayoutItem *item; foreach (item, itemList) { QWidget *wid = item->widget(); - int spaceX = spacing() + wid->style()->layoutSpacing( + int spaceX = horizontalSpacing(); + if (spaceX == -1) + spaceX = wid->style()->layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal); - int spaceY = spacing() + wid->style()->layoutSpacing( + int spaceY = verticalSpacing(); + if (spaceY == -1) + spaceY = wid->style()->layoutSpacing( QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical); int nextX = x + item->sizeHint().width() + spaceX; - if (nextX - spaceX > rect.right() && lineHeight > 0) { - x = rect.x(); + if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) { + x = effectiveRect.x(); y = y + lineHeight + spaceY; nextX = x + item->sizeHint().width() + spaceX; lineHeight = 0; @@ -150,5 +175,19 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const x = nextX; lineHeight = qMax(lineHeight, item->sizeHint().height()); } - return y + lineHeight - rect.y(); + return y + lineHeight - rect.y() + bottom; } + +int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const +{ + QObject *parent = this->parent(); + if (!parent) { + return -1; + } else if (parent->isWidgetType()) { + QWidget *pw = static_cast<QWidget *>(parent); + return pw->style()->pixelMetric(pm, 0, pw); + } else { + return static_cast<QLayout *>(parent)->spacing(); + } +} + diff --git a/examples/layouts/flowlayout/flowlayout.h b/examples/layouts/flowlayout/flowlayout.h index 24f4c4b..192501c 100644 --- a/examples/layouts/flowlayout/flowlayout.h +++ b/examples/layouts/flowlayout/flowlayout.h @@ -49,11 +49,13 @@ class FlowLayout : public QLayout { public: - FlowLayout(QWidget *parent, int margin = -1, int spacing = 0); - FlowLayout(int spacing = 0); + FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); + FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); ~FlowLayout(); void addItem(QLayoutItem *item); + int horizontalSpacing() const; + int verticalSpacing() const; Qt::Orientations expandingDirections() const; bool hasHeightForWidth() const; int heightForWidth(int) const; @@ -66,8 +68,11 @@ public: private: int doLayout(const QRect &rect, bool testOnly) const; + int smartSpacing(QStyle::PixelMetric pm) const; QList<QLayoutItem *> itemList; + int m_hSpace; + int m_vSpace; }; #endif diff --git a/examples/tutorials/addressbook/README b/examples/tutorials/addressbook/README index 2d528b5..9b7f908 100644 --- a/examples/tutorials/addressbook/README +++ b/examples/tutorials/addressbook/README @@ -4,7 +4,7 @@ Qt documentation, which can be viewed using Qt Assistant or a Web browser. The tutorial is also available online at -http://doc.trolltech.com/4.4/tutorial.html +http://doc.trolltech.com/tutorial.html All programs corresponding to the chapters in the tutorial should automatically be built when Qt is compiled, or will be provided as diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 876a251..4ae1c17 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2330,6 +2330,10 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \o \c{HKEY_LOCAL_MACHINE\Software\MySoft} \endlist + \note On Windows, for 32-bit programs running in WOW64 mode, settings are + stored in the following registry path: + \c{HKEY_LOCAL_MACHINE\Software\WOW6432node}. + If the file format is IniFormat, the following files are used on Unix and Mac OS X: diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index 3796e71..05f331b 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -424,26 +424,27 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex, /*! \class QInputDialog - \brief The QInputDialog class provides a simple convenience dialog to get a single value from the user. + \brief The QInputDialog class provides a simple convenience dialog to get a + single value from the user. \ingroup dialogs \mainclass - The input value can be a string, a number or an item from a list. A - label must be set to tell the user what they should enter. + The input value can be a string, a number or an item from a list. A label + must be set to tell the user what they should enter. - Four static convenience functions are provided: - getText(), getInt(), getDouble(), and getItem(). All the - functions can be used in a similar way, for example: + Four static convenience functions are provided: getText(), getInt(), + getDouble(), and getItem(). All the functions can be used in a similar way, + for example: \snippet examples/dialogs/standarddialogs/dialog.cpp 3 - The \c ok variable is set to true if the user clicks \gui OK; - otherwise it is set to false. + The \c ok variable is set to true if the user clicks \gui OK; otherwise it + is set to false. \img inputdialogs.png Input Dialogs - The \l{dialogs/standarddialogs}{Standard Dialogs} example shows - how to use QInputDialog as well as other built-in Qt dialogs. + The \l{dialogs/standarddialogs}{Standard Dialogs} example shows how to use + QInputDialog as well as other built-in Qt dialogs. \sa QMessageBox, {Standard Dialogs Example} */ @@ -452,11 +453,13 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex, \enum QInputDialog::InputMode \since 4.5 - This enum describes the different modes of input that can be selected for the dialog. + This enum describes the different modes of input that can be selected for + the dialog. \value TextInput Used to input text strings. \value IntInput Used to input integers. - \value DoubleInput Used to input floating point numbers with double precision accuracy. + \value DoubleInput Used to input floating point numbers with double + precision accuracy. \sa inputMode */ @@ -487,7 +490,8 @@ QInputDialog::~QInputDialog() \brief the mode used for input - This property help determines which widget is used for entering input into the dialog. + This property help determines which widget is used for entering input into + the dialog. */ void QInputDialog::setInputMode(InputMode mode) { @@ -1104,15 +1108,18 @@ void QInputDialog::done(int result) } /*! - Static convenience function to get a string from the user. \a - title is the text which is displayed in the title bar of the - dialog. \a label is the text which is shown to the user (it should - say what should be entered). \a text is the default text which is - placed in the line edit. The \a mode is the echo mode the line - edit will use. If \a ok is nonnull \e *\a ok will be set to true - if the user pressed \gui OK and to false if the user pressed - \gui Cancel. The dialog's parent is \a parent. The dialog will be - modal and uses the specified widget \a flags. + Static convenience function to get a string from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a text is the default text which is placed in the line edit. + \a mode is the echo mode the line edit will use. + + If \a ok is nonnull \e *\a ok will be set to true if the user pressed + \gui OK and to false if the user pressed \gui Cancel. The dialog's parent + is \a parent. The dialog will be modal and uses the specified widget + \a flags. This function returns the text which has been entered in the line edit. It will not return an empty string. @@ -1121,11 +1128,11 @@ void QInputDialog::done(int result) \snippet examples/dialogs/standarddialogs/dialog.cpp 3 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getInteger(), getDouble(), getItem() + \sa getInt(), getDouble(), getItem() */ QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, @@ -1149,30 +1156,32 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri } /*! - Static convenience function to get an integer input from the - user. \a title is the text which is displayed in the title bar - of the dialog. \a label is the text which is shown to the user - (it should say what should be entered). \a value is the default - integer which the spinbox will be set to. \a min and \a - max are the minimum and maximum values the user may choose, - and \a step is the amount by which the values change as the user - presses the arrow buttons to increment or decrement the value. - - If \a ok is nonnull *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - On success, this function returns the integer which has been - entered by the user; on failure, it returns the initial \a value. + \since 4.5 + + Static convenience function to get an integer input from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a value is the default integer which the spinbox will be set to. + \a min and \a max are the minimum and maximum values the user may choose. + \a step is the amount by which the values change as the user presses the + arrow buttons to increment or decrement the value. + + If \a ok is nonnull *\a ok will be set to true if the user pressed \gui OK + and to false if the user pressed \gui Cancel. The dialog's parent is + \a parent. The dialog will be modal and uses the widget \a flags. + + On success, this function returns the integer which has been entered by the + user; on failure, it returns the initial \a value. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 0 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. \sa getText(), getDouble(), getItem() */ @@ -1198,32 +1207,32 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l } /*! - Static convenience function to get a floating point number from - the user. \a title is the text which is displayed in the title - bar of the dialog. \a label is the text which is shown to the user - (it should say what should be entered). \a value is the default - floating point number that the line edit will be set to. \a - min and \a max are the minimum and maximum values the - user may choose, and \a decimals is the maximum number of decimal - places the number may have. - - If \a ok is nonnull, *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - This function returns the floating point number which has been - entered by the user. + Static convenience function to get a floating point number from the user. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a value is the default floating point number that the line edit will be + set to. + \a min and \a max are the minimum and maximum values the user may choose. + \a decimals is the maximum number of decimal places the number may have. + + If \a ok is nonnull, *\a ok will be set to true if the user pressed \gui OK + and to false if the user pressed \gui Cancel. The dialog's parent is + \a parent. The dialog will be modal and uses the widget \a flags. + + This function returns the floating point number which has been entered by + the user. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 1 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getText(), getInteger(), getItem() + \sa getText(), getInt(), getItem() */ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QString &label, @@ -1248,32 +1257,34 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr } /*! - Static convenience function to let the user select an item from a - string list. \a title is the text which is displayed in the title - bar of the dialog. \a label is the text which is shown to the user (it - should say what should be entered). \a items is the - string list which is inserted into the combobox, and \a current is the number - of the item which should be the current item. If \a editable is true - the user can enter their own text; if \a editable is false the user - may only select one of the existing items. - - If \a ok is nonnull \e *\a ok will be set to true if the user - pressed \gui OK and to false if the user pressed \gui Cancel. The - dialog's parent is \a parent. The dialog will be modal and uses - the widget \a flags. - - This function returns the text of the current item, or if \a - editable is true, the current text of the combobox. + Static convenience function to let the user select an item from a string + list. + + \a title is the text which is displayed in the title bar of the dialog. + \a label is the text which is shown to the user (it should say what should + be entered). + \a items is the string list which is inserted into the combobox. + \a current is the number of the item which should be the current item. + + If \a editable is true the user can enter their own text; otherwise the + user may only select one of the existing items. + + If \a ok is nonnull \e *\a ok will be set to true if the user pressed + \gui OK and to false if the user pressed \gui Cancel. The dialog's parent + is \a parent. The dialog will be modal and uses the widget \a flags. + + This function returns the text of the current item, or if \a editable is + true, the current text of the combobox. Use this static function like this: \snippet examples/dialogs/standarddialogs/dialog.cpp 2 - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QInputDialog constructors. + \warning Do not delete \a parent during the execution of the dialog. If you + want to do this, you should create the dialog yourself using one of the + QInputDialog constructors. - \sa getText(), getInteger(), getDouble() + \sa getText(), getInt(), getDouble() */ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label, diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 801ba99..de4332c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -8489,6 +8489,7 @@ void QGraphicsSimpleTextItem::setText(const QString &text) return; d->text = text; d->updateBoundingRect(); + update(); } /*! diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index 7cef88f..011e326 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1569,6 +1569,10 @@ bool QSortFilterProxyModel::hasChildren(const QModelIndex &parent) const return false; if (!d->model->hasChildren(source_parent)) return false; + + if (d->model->canFetchMore(source_parent)) + return true; //we assume we might have children that can be fetched + QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); return m->source_rows.count() != 0 && m->source_columns.count() != 0; } diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index 9a7237d..ad0d8f6 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -49,8 +49,10 @@ #include <QtGui/QWidget> +QT_FORWARD_DECLARE_CLASS(QWidget); +QT_BEGIN_NAMESPACE extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm - +QT_END_NAMESPACE QT_USE_NAMESPACE @implementation QT_MANGLE_NAMESPACE(QCocoaPanel) @@ -108,7 +110,7 @@ QT_USE_NAMESPACE [self retain]; QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; - QCocoaView *view = static_cast<QCocoaView *>(qt_mac_nativeview_for(widget)); + QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget)); Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); // sometimes need to redirect mouse events to the popup. @@ -172,7 +174,7 @@ QT_USE_NAMESPACE + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask { if (styleMask & QtMacCustomizeWindow) - return [QCocoaWindowCustomThemeFrame class]; + return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class]; return [super frameViewClassForStyleMask:styleMask]; } diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index b5ee5a6..4158469 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -53,9 +53,10 @@ #include <QtGui/QWidget> QT_FORWARD_DECLARE_CLASS(QWidget); -QT_USE_NAMESPACE - +QT_BEGIN_NAMESPACE extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm +QT_END_NAMESPACE +QT_USE_NAMESPACE @implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration)) @@ -130,7 +131,7 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. [self retain]; QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; - QCocoaView *view = static_cast<QCocoaView *>(qt_mac_nativeview_for(widget)); + QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget)); Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]); // sometimes need to redirect mouse events to the popup. diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index aa1f736..43f6725 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -465,7 +465,18 @@ Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w) if (hiview){ OSWindowRef window = qt_mac_window_for(hiview); if (!window && qt_isGenuineQWidget(hiview)) { - w->window()->d_func()->createWindow_sys(); + QWidget *myWindow = w->window(); + // This is a workaround for NSToolbar. When a widget is hidden + // by clicking the toolbar button, Cocoa reparents the widgets + // to another window (but Qt doesn't know about it). + // When we start showing them, it reparents back, + // but at this point it's window is nil, but the window it's being brought + // into (the Qt one) is for sure created. + // This stops the hierarchy moving under our feet. + if (myWindow != w && qt_mac_window_for(qt_mac_nativeview_for(myWindow))) + return qt_mac_window_for(qt_mac_nativeview_for(myWindow)); + + myWindow->d_func()->createWindow_sys(); // Reget the hiview since the "create window could potentially move the view (I guess). hiview = qt_mac_nativeview_for(w); window = qt_mac_window_for(hiview); diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 22cae87..f991275 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -481,7 +481,7 @@ QX11EmbedWidget::QX11EmbedWidget(QWidget *parent) | ExposureMask | StructureNotifyMask | SubstructureNotifyMask | PropertyChangeMask); - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), internalWinId(), ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*) data, 2); @@ -1571,7 +1571,7 @@ void QX11EmbedContainer::showEvent(QShowEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } @@ -1587,8 +1587,7 @@ void QX11EmbedContainer::hideEvent(QHideEvent *) { Q_D(QX11EmbedContainer); if (d->client) { - unsigned int data[] = {XEMBED_VERSION, XEMBED_MAPPED}; - + long data[] = {XEMBED_VERSION, XEMBED_MAPPED}; XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32, PropModeReplace, (unsigned char *) data, 2); } diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 1adbcc5..7cb0dea2 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -310,10 +310,13 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) int lineskip = img.bytesPerLine(); int depth = img.depth() >> 3; - - const QRect r = rect & QRect(0, 0, img.width(), img.height()); + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); const QPoint p = rect.topLeft() + offset; + if (r.isEmpty()) + return; + const uchar *src; uchar *dest; diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index 8d3239e..147e591 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -55,11 +55,17 @@ QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QApplication) +QT_FORWARD_DECLARE_CLASS(QCoreApplication) +QT_FORWARD_DECLARE_CLASS(QApplicationPrivate) +QT_FORWARD_DECLARE_CLASS(QKeyEvent) +QT_FORWARD_DECLARE_CLASS(QEvent) QT_BEGIN_NAMESPACE extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication.cpp QT_END_NAMESPACE +QT_USE_NAMESPACE + @implementation QT_MANGLE_NAMESPACE(QCocoaMenu) - (id)initWithQMenu:(QMenu*)menu diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index cc7d9a7..ad42efb 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -629,7 +629,7 @@ void QGLContext::updatePaintDevice() // ideally we would use QWidget::isVisible(), but we get "invalid drawable" errors if (![(NSWindow *)qt_mac_window_for(w) isVisible]) return; - if ([static_cast<NSOpenGLContext *>(d->cx) view] != view) + if ([static_cast<NSOpenGLContext *>(d->cx) view] != view && ![view isHidden]) [static_cast<NSOpenGLContext *>(d->cx) setView:view]; } else if (d->paintDevice->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap *>(d->paintDevice); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 29b6cdd..ef84f50 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -222,6 +222,7 @@ private slots: // task specific tests below me void task141694_textItemEnsureVisible(); void task128696_textItemEnsureMovable(); + void ensureUpdateOnTextItem(); void task177918_lineItemUndetected(); void task240400_clickOnTextItem_data(); void task240400_clickOnTextItem(); @@ -5272,6 +5273,39 @@ void tst_QGraphicsItem::task240400_clickOnTextItem() QCOMPARE(item->textCursor().columnNumber(), 0); } +class TextItem : public QGraphicsSimpleTextItem +{ +public: + TextItem(const QString& text) : QGraphicsSimpleTextItem(text) + { + updates = 0; + } + + void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) + { + updates++; + QGraphicsSimpleTextItem::paint(painter, option, widget); + } + + int updates; +}; + +void tst_QGraphicsItem::ensureUpdateOnTextItem() +{ + QGraphicsScene scene; + TextItem *text1 = new TextItem(QLatin1String("123")); + scene.addItem(text1); + QGraphicsView view(&scene); + view.show(); + QTest::qWait(250); + QCOMPARE(text1->updates,1); + + //same bouding rect but we have to update + text1->setText(QLatin1String("321")); + QTest::qWait(250); + QCOMPARE(text1->updates,2); +} + void tst_QGraphicsItem::task243707_addChildBeforeParent() { // Task reports that adding the child before the parent leads to an diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index cf9b4aa..940fbbb 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -131,6 +131,7 @@ private slots: void task247867_insertRowsSort(); void task248868_staticSorting(); void task248868_dynamicSorting(); + void task250023_fetchMore(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -2590,6 +2591,96 @@ void tst_QSortFilterProxyModel::task248868_dynamicSorting() } } +class QtTestModel: public QAbstractItemModel +{ + public: + QtTestModel(int _rows, int _cols, QObject *parent = 0): QAbstractItemModel(parent), + rows(_rows), cols(_cols), wrongIndex(false) { } + + bool canFetchMore(const QModelIndex &idx) const { + return !fetched.contains(idx); + } + + void fetchMore(const QModelIndex &idx) { + if (fetched.contains(idx)) + return; + beginInsertRows(idx, 0, rows-1); + fetched.insert(idx); + endInsertRows(); + } + + bool hasChildren(const QModelIndex & = QModelIndex()) const { + return true; + } + + int rowCount(const QModelIndex& parent = QModelIndex()) const { + return fetched.contains(parent) ? rows : 0; + } + int columnCount(const QModelIndex& parent = QModelIndex()) const { + return cols; + } + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const + { + if (row < 0 || column < 0 || column >= cols || row >= rows) { + return QModelIndex(); + } + QModelIndex i = createIndex(row, column, int(parent.internalId() + 1)); + parentHash[i] = parent; + return i; + } + + QModelIndex parent(const QModelIndex &index) const + { + if (!parentHash.contains(index)) + return QModelIndex(); + return parentHash[index]; + } + + QVariant data(const QModelIndex &idx, int role) const + { + if (!idx.isValid()) + return QVariant(); + + if (role == Qt::DisplayRole) { + if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols || idx.row() >= rows) { + wrongIndex = true; + qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), + idx.internalPointer()); + } + return QString("[%1,%2]").arg(idx.row()).arg(idx.column()); + } + return QVariant(); + } + + QSet<QModelIndex> fetched; + int rows, cols; + mutable bool wrongIndex; + mutable QMap<QModelIndex,QModelIndex> parentHash; +}; + +void tst_QSortFilterProxyModel::task250023_fetchMore() +{ + QtTestModel model(10,10); + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + QVERIFY(proxy.canFetchMore(QModelIndex())); + QVERIFY(proxy.hasChildren()); + while (proxy.canFetchMore(QModelIndex())) + proxy.fetchMore(QModelIndex()); + QCOMPARE(proxy.rowCount(), 10); + QCOMPARE(proxy.columnCount(), 10); + + QModelIndex idx = proxy.index(1,1); + QVERIFY(idx.isValid()); + QVERIFY(proxy.canFetchMore(idx)); + QVERIFY(proxy.hasChildren(idx)); + while (proxy.canFetchMore(idx)) + proxy.fetchMore(idx); + QCOMPARE(proxy.rowCount(idx), 10); + QCOMPARE(proxy.columnCount(idx), 10); +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tools/linguist/shared/ui.cpp b/tools/linguist/shared/ui.cpp index 02a3539..d30f6e5 100644 --- a/tools/linguist/shared/ui.cpp +++ b/tools/linguist/shared/ui.cpp @@ -95,7 +95,7 @@ bool UiReader::startElement(const QString &namespaceURI, Q_UNUSED(namespaceURI); Q_UNUSED(localName); - if (qName == QLatin1String("item")) { + if (qName == QLatin1String("item")) { // UI3 menu entries flush(); if (!atts.value(QLatin1String("text")).isEmpty()) m_source = atts.value(QLatin1String("text")); @@ -123,15 +123,15 @@ bool UiReader::endElement(const QString &namespaceURI, m_accum.replace(QLatin1String("\r\n"), QLatin1String("\n")); - if (qName == QLatin1String("class")) { + if (qName == QLatin1String("class")) { // UI "header" if (m_context.isEmpty()) m_context = m_accum; } else if (qName == QLatin1String("string") && m_isTrString) { m_source = m_accum; - } else if (qName == QLatin1String("comment")) { + } else if (qName == QLatin1String("comment")) { // FIXME: what's that? m_comment = m_accum; flush(); - } else if (qName == QLatin1String("function")) { + } else if (qName == QLatin1String("function")) { // UI3 embedded code fetchtrInlinedCpp(m_accum, m_translator, m_context); } else { flush(); diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 298311e..4d401a4 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.450 +qhp.Qt.namespace = com.trolltech.qt.451 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = |