diff options
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 29 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog.h | 9 | ||||
-rw-r--r-- | src/widgets/dialogs/qdialog.h | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.cpp | 43 | ||||
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.h | 4 | ||||
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel_p.h | 1 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 2 |
8 files changed, 61 insertions, 33 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 569a10653f..606b9b00f7 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -433,36 +433,45 @@ int QColorDialog::customCount() /*! \since 4.5 - Returns the custom color at the given \a index as a QRgb value. + Returns the custom color at the given \a index as a QColor value. */ -QRgb QColorDialog::customColor(int index) +QColor QColorDialog::customColor(int index) { - return QColorDialogOptions::customColor(index); + return QColor(QColorDialogOptions::customColor(index)); } /*! - Sets the custom color at \a index to the QRgb \a color value. + Sets the custom color at \a index to the QColor \a color value. \note This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ -void QColorDialog::setCustomColor(int index, QRgb color) +void QColorDialog::setCustomColor(int index, QColor color) { - QColorDialogOptions::setCustomColor(index, color); + QColorDialogOptions::setCustomColor(index, color.rgba()); } /*! - Sets the standard color at \a index to the QRgb \a color value. + \since 5.0 + + Returns the standard color at the given \a index as a QColor value. +*/ +QColor QColorDialog::standardColor(int index) +{ + return QColor(QColorDialogOptions::standardColor(index)); +} + +/*! + Sets the standard color at \a index to the QColor \a color value. \note This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog::DontUseNativeDialog option. */ - -void QColorDialog::setStandardColor(int index, QRgb color) +void QColorDialog::setStandardColor(int index, QColor color) { - QColorDialogOptions::setStandardColor(index, color); + QColorDialogOptions::setStandardColor(index, color.rgba()); } static inline void rgb2hsv(QRgb rgb, int &h, int &s, int &v) diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index cfb54a7eb9..1daead3879 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -102,12 +102,11 @@ public: // obsolete static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = 0, QWidget *parent = 0); - // ### Qt 5: use QColor in signatures static int customCount(); - static QRgb customColor(int index); - static void setCustomColor(int index, QRgb color); - static void setStandardColor(int index, QRgb color); - + static QColor customColor(int index); + static void setCustomColor(int index, QColor color); + static QColor standardColor(int index); + static void setStandardColor(int index, QColor color); Q_SIGNALS: void currentColorChanged(const QColor &color); diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index 7d3052a782..f20ff46d41 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -91,8 +91,8 @@ Q_SIGNALS: void rejected(); public Q_SLOTS: - void open(); - int exec(); + virtual void open(); + virtual int exec(); virtual void done(int); virtual void accept(); virtual void reject(); diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 5446eca383..a7ae4b366b 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -48,6 +48,8 @@ #include <qmessagebox.h> #include <qapplication.h> +#include <algorithm> + #ifdef Q_OS_WIN # include <QtCore/QVarLengthArray> # include <qt_windows.h> @@ -127,7 +129,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QFileSystemModel::rmdir(const QModelIndex &index) const + \fn bool QFileSystemModel::rmdir(const QModelIndex &index) Removes the directory corresponding to the model item \a index in the file system model and \b{deletes the corresponding directory from the @@ -183,7 +185,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QFileSystemModel::remove(const QModelIndex &index) const + \fn bool QFileSystemModel::remove(const QModelIndex &index) Removes the model item \a index from the file system model and \b{deletes the corresponding file from the file system}, returning true if successful. If the @@ -195,7 +197,7 @@ QT_BEGIN_NAMESPACE \sa rmdir() */ -bool QFileSystemModel::remove(const QModelIndex &aindex) const +bool QFileSystemModel::remove(const QModelIndex &aindex) { //### TODO optim QString path = filePath(aindex); @@ -1081,15 +1083,35 @@ public: r->fileName, Qt::CaseInsensitive) < 0; } case 1: + { // Directories go first - if (l->isDir() && !r->isDir()) - return true; - return l->size() < r->size(); + bool left = l->isDir(); + bool right = r->isDir(); + if (left ^ right) + return left; + + qint64 sizeDifference = l->size() - r->size(); + if (sizeDifference == 0) + return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + + return sizeDifference < 0; + } case 2: - return l->type() < r->type(); + { + int compare = QString::localeAwareCompare(l->type(), r->type()); + if (compare == 0) + return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + + return compare < 0; + } case 3: + { + if (l->lastModified() == r->lastModified()) + return QFileSystemModelPrivate::naturalCompare(l->fileName, r->fileName, Qt::CaseInsensitive) < 0; + return l->lastModified() < r->lastModified(); } + } Q_ASSERT(false); return false; } @@ -1129,7 +1151,7 @@ void QFileSystemModelPrivate::sortChildren(int column, const QModelIndex &parent i++; } QFileSystemModelSorter ms(column); - qStableSort(values.begin(), values.end(), ms); + std::sort(values.begin(), values.end(), ms); // First update the new visible list indexNode->visibleChildren.clear(); //No more dirty item we reset our internal dirty index @@ -1631,7 +1653,7 @@ bool QFileSystemModel::event(QEvent *event) return QAbstractItemModel::event(event); } -bool QFileSystemModel::rmdir(const QModelIndex &aindex) const +bool QFileSystemModel::rmdir(const QModelIndex &aindex) { QString path = filePath(aindex); QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func()); @@ -1963,8 +1985,7 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co const bool hideDot = (filters & QDir::NoDot); const bool hideDotDot = (filters & QDir::NoDotDot); - // Note that we match the behavior of entryList and not QFileInfo on this and this - // incompatibility won't be fixed until Qt 5 at least + // Note that we match the behavior of entryList and not QFileInfo on this. bool isDot = (node->fileName == QLatin1String(".")); bool isDotDot = (node->fileName == QLatin1String("..")); if ( (hideHidden && !(isDot || isDotDot) && node->isHidden()) diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index 5a9139266d..875044e785 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -138,12 +138,12 @@ public: QDateTime lastModified(const QModelIndex &index) const; QModelIndex mkdir(const QModelIndex &parent, const QString &name); - bool rmdir(const QModelIndex &index) const; // ### Qt5: should not be const + bool rmdir(const QModelIndex &index); inline QString fileName(const QModelIndex &index) const; inline QIcon fileIcon(const QModelIndex &index) const; QFile::Permissions permissions(const QModelIndex &index) const; inline QFileInfo fileInfo(const QModelIndex &index) const; - bool remove(const QModelIndex &index) const; + bool remove(const QModelIndex &index); protected: QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = 0); diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index 0e982140b5..3a02b91b09 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -315,7 +315,6 @@ public: #ifndef QT_NO_REGEXP QList<QRegExp> nameFilters; #endif - // ### Qt 5: resolvedSymLinks goes away QHash<QString, QString> resolvedSymLinks; QFileSystemNode root; diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 2b932b0724..ea33dc8d0b 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -369,7 +369,7 @@ void QMessageBoxPrivate::updateSize() label->setSizePolicy(policy); } - QFontMetrics fm(QApplication::font("QWorkspaceTitleBar")); + QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar")); int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit); if (windowTitleWidth > width) width = windowTitleWidth; diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 2c4c738681..49450be75b 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -335,7 +335,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter) const int verticalCenter = (btnTop + btnHeight / 2) - 1; const QString text = wizard->window()->windowTitle(); - const QFont font = QApplication::font("QWorkspaceTitleBar"); + const QFont font = QApplication::font("QMdiSubWindowTitleBar"); const QFontMetrics fontMetrics(font); const QRect brect = fontMetrics.boundingRect(text); int textHeight = brect.height(); |