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/widgets/qabstractbutton.cpp | |
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/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 2c51e89c43..80e125947e 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -190,7 +190,7 @@ public: void detectCheckedButton(); void notifyChecked(QAbstractButton *button); bool exclusive; - QMap<QAbstractButton*, int> mapping; + QHash<QAbstractButton*, int> mapping; }; QButtonGroup::QButtonGroup(QObject *parent) |