File: PreviewWindow.pm

package info (click to toggle)
qt4-perl 4.8.4-1.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,636 kB
  • ctags: 8,100
  • sloc: perl: 42,963; cpp: 28,039; makefile: 160; xml: 98; sh: 4
file content (118 lines) | stat: -rw-r--r-- 3,030 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package PreviewWindow;

use strict;
use warnings;
use QtCore4;
use QtGui4;

# FIXME
use constant {
    Window=>0x00000001
};

use constant {
    Dialog=>0x00000002 | Window,
    SplashScreen=>0x0000000e | Window,
    ToolTip=>0x0000000c | Window
};


# [0]
use QtCore4::isa qw( Qt::Widget );
sub textEdit() {
    return this->{textEdit};
}

sub closeButton() {
    return this->{closeButton};
}
# [0]

# [0]
sub NEW {
    my ( $class, $parent ) = @_;
    $class->SUPER::NEW( $parent );
    my $textEdit = this->{textEdit} = Qt::TextEdit();
    $textEdit->setReadOnly(1);
    $textEdit->setLineWrapMode(Qt::TextEdit::NoWrap());

    my $closeButton = this->{closeButton} = Qt::PushButton(this->tr('&Close'));
    this->connect($closeButton, SIGNAL 'clicked()', this, SLOT 'close()');

    my $layout = Qt::VBoxLayout();
    $layout->addWidget($textEdit);
    $layout->addWidget($closeButton);
    this->setLayout($layout);

    this->setWindowTitle(this->tr('Preview'));
}
# [0]

# [1]
sub setWindowFlags {
    my ($flags) = @_;
    this->SUPER::setWindowFlags($flags);

    my $text;

    my $type = ($flags & Qt::WindowType_Mask());
    if ($type == Qt::Window()) {
        $text = 'Qt::Window';
    } elsif ($type == Dialog) {
        $text = 'Qt::Dialog';
    } elsif ($type == Qt::Sheet()) {
        $text = 'Qt::Sheet';
    } elsif ($type == Qt::Drawer()) {
        $text = 'Qt::Drawer';
    } elsif ($type == Qt::Popup()) {
        $text = 'Qt::Popup';
    } elsif ($type == Qt::Tool()) {
        $text = 'Qt::Tool';
    } elsif ($type == ToolTip) {
        $text = 'Qt::ToolTip';
    } elsif ($type == SplashScreen) {
        $text = 'Qt::SplashScreen';
    }

    if (${$flags & Qt::MSWindowsFixedSizeDialogHint()}) {
        $text .= "\n| Qt::MSWindowsFixedSizeDialogHint";
    }
    if (${$flags & Qt::X11BypassWindowManagerHint()}) {
        $text .= "\n| Qt::X11BypassWindowManagerHint";
    }
    if (${$flags & Qt::FramelessWindowHint()}) {
        $text .= "\n| Qt::FramelessWindowHint";
    }
    if (${$flags & Qt::WindowTitleHint()}) {
        $text .= "\n| Qt::WindowTitleHint";
    }
    if (${$flags & Qt::WindowSystemMenuHint()}) {
        $text .= "\n| Qt::WindowSystemMenuHint";
    }
    if (${$flags & Qt::WindowMinimizeButtonHint()}) {
        $text .= "\n| Qt::WindowMinimizeButtonHint";
    }
    if (${$flags & Qt::WindowMaximizeButtonHint()}) {
        $text .= "\n| Qt::WindowMaximizeButtonHint";
    }
    if (${$flags & Qt::WindowCloseButtonHint()}) {
        $text .= "\n| Qt::WindowCloseButtonHint";
    }
    if (${$flags & Qt::WindowContextHelpButtonHint()}) {
        $text .= "\n| Qt::WindowContextHelpButtonHint";
    }
    if (${$flags & Qt::WindowShadeButtonHint()}) {
        $text .= "\n| Qt::WindowShadeButtonHint";
    }
    if (${$flags & Qt::WindowStaysOnTopHint()}) {
        $text .= "\n| Qt::WindowStaysOnTopHint";
    }
    if (${$flags & Qt::CustomizeWindowHint()}) {
        $text .= "\n| Qt::CustomizeWindowHint";
    }

    this->textEdit->setPlainText($text);
}
# [1]

1;