Class: ControllerWindow
- Inherits:
-
Qt::Widget
show all
- Defined in:
- ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.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
Returns a new instance of ControllerWindow.
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
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 32
def initialize(parent = nil)
super(parent)
@previewWindow = PreviewWindow.new(self)
createTypeGroupBox()
createHintsGroupBox()
@quitButton = Qt::PushButton.new(tr("&Quit"))
connect(@quitButton, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
bottomLayout = Qt::HBoxLayout.new do |b|
b.addStretch()
b.addWidget(@quitButton)
end
mainLayout = Qt::VBoxLayout.new do |m|
m.addWidget(@typeGroupBox)
m.addWidget(@hintsGroupBox)
m.addLayout(bottomLayout)
end
setLayout(mainLayout)
setWindowTitle(tr("Window Flags"))
updatePreview()
end
|
Instance Method Details
#createCheckBox(text) ⇒ Object
184
185
186
187
188
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 184
def createCheckBox(text)
checkBox = Qt::CheckBox.new(text)
connect(checkBox, SIGNAL('clicked()'), self, SLOT('updatePreview()'))
return checkBox
end
|
#createHintsGroupBox ⇒ Object
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 151
def createHintsGroupBox()
@hintsGroupBox = Qt::GroupBox.new(tr("Hints"))
@msWindowsFixedSizeDialogCheckBox =
createCheckBox(tr("MS Windows fixed size dialog"))
@x11BypassWindowManagerCheckBox =
createCheckBox(tr("X11 bypass window manager"))
@framelessWindowCheckBox = createCheckBox(tr("Frameless window"))
@windowTitleCheckBox = createCheckBox(tr("Window title"))
@windowSystemMenuCheckBox = createCheckBox(tr("Window system menu"))
@windowMinimizeButtonCheckBox = createCheckBox(tr("Window minimize button"))
@windowMaximizeButtonCheckBox = createCheckBox(tr("Window maximize button"))
@windowContextHelpButtonCheckBox =
createCheckBox(tr("Window context help button"))
@windowShadeButtonCheckBox = createCheckBox(tr("Window shade button"))
@windowStaysOnTopCheckBox = createCheckBox(tr("Window stays on top"))
layout = Qt::GridLayout.new do |l|
l.addWidget(@msWindowsFixedSizeDialogCheckBox, 0, 0)
l.addWidget(@x11BypassWindowManagerCheckBox, 1, 0)
l.addWidget(@framelessWindowCheckBox, 2, 0)
l.addWidget(@windowTitleCheckBox, 3, 0)
l.addWidget(@windowSystemMenuCheckBox, 4, 0)
l.addWidget(@windowMinimizeButtonCheckBox, 0, 1)
l.addWidget(@windowMaximizeButtonCheckBox, 1, 1)
l.addWidget(@windowContextHelpButtonCheckBox, 2, 1)
l.addWidget(@windowShadeButtonCheckBox, 3, 1)
l.addWidget(@windowStaysOnTopCheckBox, 4, 1)
end
@hintsGroupBox.layout = layout
end
|
190
191
192
193
194
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 190
def createRadioButton(text)
button = Qt::RadioButton.new(text)
connect(button, SIGNAL('clicked()'), self, SLOT('updatePreview()'))
return button
end
|
#createTypeGroupBox ⇒ Object
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
149
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 124
def createTypeGroupBox()
@typeGroupBox = Qt::GroupBox.new(tr("Type"))
@windowRadioButton = createRadioButton(tr("Window"))
@dialogRadioButton = createRadioButton(tr("Dialog"))
@sheetRadioButton = createRadioButton(tr("Sheet"))
@drawerRadioButton = createRadioButton(tr("Drawer"))
@popupRadioButton = createRadioButton(tr("Popup"))
@toolRadioButton = createRadioButton(tr("Tool"))
@toolTipRadioButton = createRadioButton(tr("Tooltip"))
@splashScreenRadioButton = createRadioButton(tr("Splash screen"))
@windowRadioButton.checked = true
layout = Qt::GridLayout.new do |l|
l.addWidget(@windowRadioButton, 0, 0)
l.addWidget(@dialogRadioButton, 1, 0)
l.addWidget(@sheetRadioButton, 2, 0)
l.addWidget(@drawerRadioButton, 3, 0)
l.addWidget(@popupRadioButton, 0, 1)
l.addWidget(@toolRadioButton, 1, 1)
l.addWidget(@toolTipRadioButton, 2, 1)
l.addWidget(@splashScreenRadioButton, 3, 1)
end
@typeGroupBox.layout = layout
end
|
#updatePreview ⇒ Object
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
119
120
121
122
|
# File 'ext/ruby/qtruby/examples/widgets/windowflags/controllerwindow.rb', line 59
def updatePreview()
flags = Qt::Enum.new(0, "Qt::WindowFlags")
if @windowRadioButton.checked?
flags = Qt::WindowType
elsif @dialogRadioButton.checked?
flags = Qt::DialogType
elsif @sheetRadioButton.checked?
flags = Qt::SheetType
elsif @drawerRadioButton.checked?
flags = Qt::DrawerType
elsif @popupRadioButton.checked?
flags = Qt::PopupType
elsif @toolRadioButton.checked?
flags = Qt::ToolType
elsif @toolTipRadioButton.checked?
flags = Qt::ToolTipType
elsif @splashScreenRadioButton.checked?
flags = Qt::SplashScreenType
end
if @msWindowsFixedSizeDialogCheckBox.checked?
flags |= Qt::MSWindowsFixedSizeDialogHint.to_i
end
if @x11BypassWindowManagerCheckBox.checked?
flags |= Qt::X11BypassWindowManagerHint.to_i
end
if @framelessWindowCheckBox.checked?
flags |= Qt::FramelessWindowHint.to_i
end
if @windowTitleCheckBox.checked?
flags |= Qt::WindowTitleHint.to_i
end
if @windowSystemMenuCheckBox.checked?
flags |= Qt::WindowSystemMenuHint.to_i
end
if @windowMinimizeButtonCheckBox.checked?
flags |= Qt::WindowMinimizeButtonHint.to_i
end
if @windowMaximizeButtonCheckBox.checked?
flags |= Qt::WindowMaximizeButtonHint.to_i
end
if @windowContextHelpButtonCheckBox.checked?
flags |= Qt::WindowContextHelpButtonHint.to_i
end
if @windowShadeButtonCheckBox.checked?
flags |= Qt::WindowShadeButtonHint.to_i
end
if @windowStaysOnTopCheckBox.checked?
flags |= Qt::WindowStaysOnTopHint.to_i
end
@previewWindow.setWindowFlags(flags)
@previewWindow.show()
pos = @previewWindow.pos()
if pos.x < 0
pos.x = 0
end
if pos.y < 0
pos.y = 0
end
@previewWindow.move(pos)
end
|