File: Window.pm

package info (click to toggle)
qt4-perl 4.5~~svn1145508-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,144 kB
  • ctags: 5,947
  • sloc: perl: 29,224; cpp: 18,849; xml: 98; makefile: 91; sh: 4
file content (74 lines) | stat: -rw-r--r-- 1,972 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package Window;

use strict;
use warnings;
use QtCore4;
use QtGui4;
use QtCore4::isa qw( Qt::Widget );
use GLWidget;

sub glWidget() {
    return this->{glWidget};
}

sub xSlider() {
    return this->{xSlider};
}

sub ySlider() {
    return this->{ySlider};
}

sub zSlider() {
    return this->{zSlider};
}

# [0]
sub NEW
{
    my ($class, $parent) = @_;
    $class->SUPER::NEW($parent);
    Qt::setSignature( 'QGLWidget::QGLWidget( QWidget* )' );
    this->{glWidget} = GLWidget();

    this->{xSlider} = this->createSlider();
    this->{ySlider} = this->createSlider();
    this->{zSlider} = this->createSlider();

    this->connect(this->xSlider, SIGNAL 'valueChanged(int)', this->glWidget, SLOT 'setXRotation(int)');
    this->connect(this->glWidget, SIGNAL 'xRotationChanged(int)', this->xSlider, SLOT 'setValue(int)');
    this->connect(this->ySlider, SIGNAL 'valueChanged(int)', this->glWidget, SLOT 'setYRotation(int)');
    this->connect(this->glWidget, SIGNAL 'yRotationChanged(int)', this->ySlider, SLOT 'setValue(int)');
    this->connect(this->zSlider, SIGNAL 'valueChanged(int)', this->glWidget, SLOT 'setZRotation(int)');
    this->connect(this->glWidget, SIGNAL 'zRotationChanged(int)', this->zSlider, SLOT 'setValue(int)');
# [0]

# [1]
    my $mainLayout = Qt::HBoxLayout();
    $mainLayout->addWidget(this->glWidget);
    $mainLayout->addWidget(this->xSlider);
    $mainLayout->addWidget(this->ySlider);
    $mainLayout->addWidget(this->zSlider);
    this->setLayout($mainLayout);

    this->xSlider->setValue(15 * 16);
    this->ySlider->setValue(345 * 16);
    this->zSlider->setValue(0 * 16);
    this->setWindowTitle(this->tr('Hello GL'));
}
# [1]

# [2]
sub createSlider
{
    my $slider = Qt::Slider(Qt::Vertical());
    $slider->setRange(0, 360 * 16);
    $slider->setSingleStep(16);
    $slider->setPageStep(15 * 16);
    $slider->setTickInterval(15 * 16);
    $slider->setTickPosition(Qt::Slider::TicksRight());
    return $slider;
}
# [2]

1;