From 7ae38c49b78515e1e49f8a8858ce9c581e534284 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 1 Mar 2012 23:47:36 +0000 Subject: Use QHash instead of QMap when K is a pointer type 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 (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 --- src/widgets/styles/qgtkstyle_p.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/styles/qgtkstyle_p.cpp') diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 18e120a4eb..0402859e31 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -897,7 +897,7 @@ extern QStringList qt_make_filter_list(const QString &filter); void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, bool isSaveDialog, - QMap *filterMap) + QHash *filterMap) { g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL); g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL); @@ -969,7 +969,7 @@ void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *p QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) { - QMap filterMap; + QHash filterMap; GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, @@ -1003,7 +1003,7 @@ QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options) { - QMap filterMap; + QHash filterMap; GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, @@ -1033,7 +1033,7 @@ QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &capt QString *selectedFilter, QFileDialog::Options options) { QStringList filenames; - QMap filterMap; + QHash filterMap; GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), NULL, GTK_FILE_CHOOSER_ACTION_OPEN, @@ -1068,7 +1068,7 @@ QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &capt QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) { - QMap filterMap; + QHash filterMap; GtkWidget *gtkFileChooser = QGtkStylePrivate::gtk_file_chooser_dialog_new (qPrintable(caption), NULL, GTK_FILE_CHOOSER_ACTION_SAVE, -- cgit v1.2.3