~kubuntu-members/perlkde/4.11

« back to all changes in this revision

Viewing changes to qtgui/examples/widgets/icons/IconSizeSpinbox.pm

  • Committer: Arno Rehn
  • Date: 2011-01-06 17:49:41 UTC
  • Revision ID: git-v1:ada9e4b459cf6fabd0f3b9b164387469cb19d9bc
A patch by Ian Monroe and myself to modularize the repository.
See README.MODULARIZATION for details.

svn path=/trunk/KDE/kdebindings/perl/; revision=1212365

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package IconSizeSpinbox;
2
 
 
3
 
use strict;
4
 
use warnings;
5
 
 
6
 
use QtCore4;
7
 
use QtGui4;
8
 
 
9
 
# [0]
10
 
use QtCore4::isa qw( Qt::SpinBox );
11
 
# [0]
12
 
 
13
 
# [0]
14
 
sub NEW {
15
 
    my ( $class, $parent ) = @_;
16
 
    $class->SUPER::NEW( $parent );
17
 
}
18
 
# [0]
19
 
 
20
 
# [1]
21
 
sub valueFromText {
22
 
    my ($text) = @_;
23
 
 
24
 
    my $regExp = Qt::RegExp(this->tr('(\\d+)(\\s*[xx]\\s*\\d+)?'));
25
 
 
26
 
    if ($regExp->exactMatch($text)) {
27
 
        return $regExp->cap(1).toInt();
28
 
    } else {
29
 
        return 0;
30
 
    }
31
 
}
32
 
# [1]
33
 
 
34
 
# [2]
35
 
sub textFromValue {
36
 
    my ( $value ) = @_;
37
 
    return sprintf this->tr('%d x %d'), $value;
38
 
}
39
 
# [2]
40
 
 
41
 
1;