diff options
author | Giuseppe D'Angelo <dangelog@gmail.com> | 2012-03-01 23:47:36 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-02 23:16:25 +0100 |
commit | 7ae38c49b78515e1e49f8a8858ce9c581e534284 (patch) | |
tree | 33815a82d11975f9fee1853ff68e95bfe4678beb /src/widgets/styles/qgtkstyle_p.h | |
parent | 95d83cb1b68cc4a415d5d80859b4e74472ad7112 (diff) |
Use QHash<K,V> instead of QMap<K,V> 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<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>
Diffstat (limited to 'src/widgets/styles/qgtkstyle_p.h')
-rw-r--r-- | src/widgets/styles/qgtkstyle_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h index 95988fa8b1..02d659c1e4 100644 --- a/src/widgets/styles/qgtkstyle_p.h +++ b/src/widgets/styles/qgtkstyle_p.h @@ -344,7 +344,7 @@ public: 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); |