File: FindDialog.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 (79 lines) | stat: -rw-r--r-- 2,284 bytes parent folder | download
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
75
76
77
78
79
package FindDialog;

use strict;
use warnings;
use blib;

use QtCore4;
use QtGui4;
use QtCore4::isa qw( Qt::Dialog );

# [0]
sub NEW {
    shift->SUPER::NEW(@_);
    my $label = Qt::Label(this->tr("Find &what:"));
    my $lineEdit = Qt::LineEdit();
    $label->setBuddy($lineEdit);

    my $caseCheckBox = Qt::CheckBox(this->tr("Match &case"));
    my $fromStartCheckBox = Qt::CheckBox(this->tr("Search from &start"));
    $fromStartCheckBox->setChecked(1);

# [1]
    my $findButton = Qt::PushButton(this->tr("&Find"));
    $findButton->setDefault(1);

    my $moreButton = Qt::PushButton(this->tr("&More"));
    $moreButton->setCheckable(1);
# [0]
    $moreButton->setAutoDefault(0);

    my $buttonBox = Qt::DialogButtonBox(Qt::Vertical());
    $buttonBox->addButton($findButton, Qt::DialogButtonBox::ActionRole());
    $buttonBox->addButton($moreButton, Qt::DialogButtonBox::ActionRole());
# [1]

# [2]
    my $extension = Qt::Widget();

    my $wholeWordsCheckBox = Qt::CheckBox(this->tr("&Whole words"));
    my $backwardCheckBox = Qt::CheckBox(this->tr("Search &backward"));
    my $searchSelectionCheckBox = Qt::CheckBox(this->tr("Search se&lection"));
# [2]

# [3]
    this->connect($moreButton, SIGNAL 'toggled(bool)', $extension, SLOT 'setVisible(bool)');

    my $extensionLayout = Qt::VBoxLayout();
    $extensionLayout->setMargin(0);
    $extensionLayout->addWidget($wholeWordsCheckBox);
    $extensionLayout->addWidget($backwardCheckBox);
    $extensionLayout->addWidget($searchSelectionCheckBox);
    $extension->setLayout($extensionLayout);
# [3]

# [4]
    my $topLeftLayout = Qt::HBoxLayout();
    $topLeftLayout->addWidget($label);
    $topLeftLayout->addWidget($lineEdit);

    my $leftLayout = Qt::VBoxLayout();
    $leftLayout->addLayout($topLeftLayout);
    $leftLayout->addWidget($caseCheckBox);
    $leftLayout->addWidget($fromStartCheckBox);
    $leftLayout->addStretch(1);

    my $mainLayout = Qt::GridLayout();
    $mainLayout->setSizeConstraint(Qt::Layout::SetFixedSize());
    $mainLayout->addLayout($leftLayout, 0, 0);
    $mainLayout->addWidget($buttonBox, 0, 1);
    $mainLayout->addWidget($extension, 1, 0, 1, 2);
    this->setLayout($mainLayout);

    this->setWindowTitle(this->tr("Extension"));
# [4] //! [5]
    $extension->hide();
}
# [5]

1;