Changes various internal usages of QMap when the key is a pointer type.
Being ordered by the pointer value itself, it makes very little sense
to use QMap<K*, V> (esp. in cases where the key is actually allocated
on the heap).
The usages have been found with the following script:
#!/usr/bin/perl
use strict;
use warnings;
use Regexp::Common;
use File::Find;
use feature ':5.10';
my $container = qr/(?:QMap)/;
sub process {
return unless (-f and -r and /(\.c|\.cpp|\.h|\.txt)$/);
open my $fh, "<", $_ or die "Cannot open $_: $!";
while (my $line = <$fh>) {
chomp $line;
while ($line =~ /($container\s*$RE{balanced}{-parens=>"<>"})/g) {
my $tmp = $1;
$tmp =~ s/\s+//g;
say "$_:$.: $line" if $tmp =~ /^$container\s*<[^,]+\*,/;
}
}
close $fh;
}
find( { no_chdir => 1, wanted => \&process }, @ARGV );
Change-Id: Idd9819c3f4c48f98ef92831d5e8e5ac0fa42283c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
class QGraphicsItemCustomDataStore
{
public:
- QMap<const QGraphicsItem *, QMap<int, QVariant> > data;
+ QHash<const QGraphicsItem *, QMap<int, QVariant> > data;
};
Q_GLOBAL_STATIC(QGraphicsItemCustomDataStore, qt_dataStore)
{
QPixmapCache::remove(key);
key = QPixmapCache::Key();
- QMutableMapIterator<QPaintDevice *, DeviceData> it(deviceData);
+ QMutableHashIterator<QPaintDevice *, DeviceData> it(deviceData);
while (it.hasNext()) {
DeviceData &data = it.next().value();
QPixmapCache::remove(data.key);
if ((event->buttons() & Qt::LeftButton) && (flags() & ItemIsMovable)) {
// Determine the list of items that need to be moved.
QList<QGraphicsItem *> selectedItems;
- QMap<QGraphicsItem *, QPointF> initialPositions;
+ QHash<QGraphicsItem *, QPointF> initialPositions;
if (d_ptr->scene) {
selectedItems = d_ptr->scene->selectedItems();
initialPositions = d_ptr->scene->d_func()->movingItemsInitialPositions;
QPoint cacheIndent;
QPixmapCache::Key key;
};
- QMap<QPaintDevice *, DeviceData> deviceData;
+ QHash<QPaintDevice *, DeviceData> deviceData;
// List of logical exposed rects
QVector<QRectF> exposed;
QRectF childrenBoundingRect;
QRectF needsRepaint;
- QMap<QWidget *, QRect> paintedViewBoundingRects;
+ QHash<QWidget *, QRect> paintedViewBoundingRects;
QPointF pos;
qreal z;
qreal opacity;
QVector<QGraphicsItem *> unpolishedItems;
QList<QGraphicsItem *> topLevelItems;
- QMap<QGraphicsItem *, QPointF> movingItemsInitialPositions;
+ QHash<QGraphicsItem *, QPointF> movingItemsInitialPositions;
void registerTopLevelItem(QGraphicsItem *item);
void unregisterTopLevelItem(QGraphicsItem *item);
void _q_updateLater();
}
private:
- QMap<const QGraphicsWidget *, QStyle *> styles;
+ QHash<const QGraphicsWidget *, QStyle *> styles;
mutable QMutex mutex;
};
Q_GLOBAL_STATIC(QGraphicsWidgetStyles, widgetStyles)
QPointer<QWSManager> last_manager;
QWSServerCleaner qwsServerCleaner;
# ifndef QT_NO_DIRECTPAINTER
- QMap<WId, QDirectPainter *> *directPainters;
+ QHash<WId, QDirectPainter *> *directPainters;
# endif
QRect maxWindowRect(const QScreen *screen) const { return maxWindowRects[screen]; }
void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect);
private:
#ifdef Q_WS_QWS
- QMap<const QScreen*, QRect> maxWindowRects;
+ QHash<const QScreen*, QRect> maxWindowRects;
#endif
static QApplicationPrivate *self;
}
void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
- QMap<QWidget *, QList<QGesture *> > *conflicts,
- QMap<QWidget *, QList<QGesture *> > *normal)
+ QHash<QWidget *, QList<QGesture *> > *conflicts,
+ QHash<QWidget *, QList<QGesture *> > *normal)
{
typedef QHash<Qt::GestureType, QHash<QWidget *, QGesture *> > GestureByTypes;
GestureByTypes gestureByTypes;
if (gestures.isEmpty())
return;
- typedef QMap<QWidget *, QList<QGesture *> > GesturesPerWidget;
+ typedef QHash<QWidget *, QList<QGesture *> > GesturesPerWidget;
GesturesPerWidget conflictedGestures;
GesturesPerWidget normalStartedGestures;
void deliverEvents(const QSet<QGesture *> &gestures,
QSet<QGesture *> *undeliveredGestures);
void getGestureTargets(const QSet<QGesture*> &gestures,
- QMap<QWidget *, QList<QGesture *> > *conflicts,
- QMap<QWidget *, QList<QGesture *> > *normal);
+ QHash<QWidget *, QList<QGesture *> > *conflicts,
+ QHash<QWidget *, QList<QGesture *> > *normal);
void cancelGesturesForChildren(QGesture *originatingGesture);
};
void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
const QString &dir, const QString &filter, QString *selectedFilter,
QFileDialog::Options options, bool isSaveDialog,
- QMap<GtkFileFilter *, QString> *filterMap)
+ QHash<GtkFileFilter *, QString> *filterMap)
{
g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL);
g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL);
QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
- QMap<GtkFileFilter *, QString> filterMap;
+ QHash<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
{
- QMap<GtkFileFilter *, QString> filterMap;
+ QHash<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
QString *selectedFilter, QFileDialog::Options options)
{
QStringList filenames;
- QMap<GtkFileFilter *, QString> filterMap;
+ QHash<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
- QMap<GtkFileFilter *, QString> filterMap;
+ QHash<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
const QString &dir, const QString &filter, QString *selectedFilter,
QFileDialog::Options options, bool isSaveDialog = false,
- QMap<GtkFileFilter *, QString> *filterMap = 0);
+ QHash<GtkFileFilter *, QString> *filterMap = 0);
static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options);
void detectCheckedButton();
void notifyChecked(QAbstractButton *button);
bool exclusive;
- QMap<QAbstractButton*, int> mapping;
+ QHash<QAbstractButton*, int> mapping;
};
QButtonGroup::QButtonGroup(QObject *parent)
//
#include <qobject.h>
-#include <qmap.h>
+#include <qhash.h>
QT_BEGIN_NAMESPACE
#endif
private:
- typedef QMap<QWidget*, QPropertyAnimation*> AnimationMap;
+ typedef QHash<QWidget*, QPropertyAnimation*> AnimationMap;
AnimationMap m_animation_map;
QMainWindowLayout *m_mainWindowLayout;
};