Class: PermissionsTab

Inherits:
Qt::Widget show all
Defined in:
ext/ruby/qtruby/examples/dialogs/tabdialog/tabdialog.rb

Instance Method Summary collapse

Methods inherited from Qt::Widget

#raise

Methods inherited from Qt::Base

#%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #QCOMPARE, #QEXPECT_FAIL, #QFAIL, #QSKIP, #QTEST, #QVERIFY, #QVERIFY2, #QWARN, #^, ancestors, #is_a?, #methods, private_slots, #protected_methods, #public_methods, q_classinfo, q_signal, q_slot, signals, #singleton_methods, slots, #|, #~

Constructor Details

#initialize(fileInfo, parent = nil) ⇒ PermissionsTab

Returns a new instance of PermissionsTab.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'ext/ruby/qtruby/examples/dialogs/tabdialog/tabdialog.rb', line 101

def initialize(fileInfo, parent = nil)
    super(parent)
    permissionsGroup = Qt::GroupBox.new(tr("Permissions"))

    readable = Qt::CheckBox.new(tr("Readable"))
    if fileInfo.readable?
        readable.checked = true
    end

    writable = Qt::CheckBox.new(tr("Writable"))
    if fileInfo.writable?
        writable.checked = true
    end

    executable = Qt::CheckBox.new(tr("Executable"))
    if fileInfo.executable?
        executable.checked = true
    end

    ownerGroup = Qt::GroupBox.new(tr("Ownership"))

    ownerLabel = Qt::Label.new(tr("Owner"))
    ownerValueLabel = Qt::Label.new(fileInfo.owner())
    ownerValueLabel.frameStyle = Qt::Frame::Panel | Qt::Frame::Sunken

    groupLabel = Qt::Label.new(tr("Group"))
    groupValueLabel = Qt::Label.new(fileInfo.group())
    groupValueLabel.frameStyle = Qt::Frame::Panel | Qt::Frame::Sunken

    permissionsGroup.layout = Qt::VBoxLayout.new do |p|
        p.addWidget(readable)
        p.addWidget(writable)
        p.addWidget(executable)
    end

    ownerGroup.layout = Qt::VBoxLayout.new do |o|
        o.addWidget(ownerLabel)
        o.addWidget(ownerValueLabel)
        o.addWidget(groupLabel)
        o.addWidget(groupValueLabel)
    end

    self.layout = Qt::VBoxLayout.new do |m|
        m.addWidget(permissionsGroup)
        m.addWidget(ownerGroup)
        m.addStretch(1)
    end
end