Class: ComplexWizard
- Inherits:
-
Qt::Dialog
show all
- Defined in:
- ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb
Instance Method Summary
collapse
Methods inherited from Qt::Dialog
#exec
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(parent = nil) ⇒ ComplexWizard
Returns a new instance of ComplexWizard.
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/dialogs/complexwizard/complexwizard.rb', line 33
def initialize(parent = nil)
super(parent)
@history = []
@cancelButton = Qt::PushButton.new(tr("Cancel"))
@backButton = Qt::PushButton.new(tr("< &Back"))
@nextButton = Qt::PushButton.new(tr("Next >"))
@finishButton = Qt::PushButton.new(tr("&Finish"))
connect(@cancelButton, SIGNAL('clicked()'), self, SLOT('reject()'))
connect(@backButton, SIGNAL('clicked()'), self, SLOT('backButtonClicked()'))
connect(@nextButton, SIGNAL('clicked()'), self, SLOT('nextButtonClicked()'))
connect(@finishButton, SIGNAL('clicked()'), self, SLOT('accept()'))
@buttonLayout = Qt::HBoxLayout.new
@buttonLayout.addStretch(1)
@buttonLayout.addWidget(@cancelButton)
@buttonLayout.addWidget(@backButton)
@buttonLayout.addWidget(@nextButton)
@buttonLayout.addWidget(@finishButton)
@mainLayout = Qt::VBoxLayout.new
@mainLayout.addLayout(@buttonLayout)
setLayout(@mainLayout)
end
|
Instance Method Details
67
68
69
70
71
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 67
def backButtonClicked()
oldPage = @history.pop()
oldPage.resetPage()
switchPage(oldPage)
end
|
#completeStateChanged ⇒ Object
81
82
83
84
85
86
87
88
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 81
def completeStateChanged()
currentPage = @history.last()
if currentPage.isLastPage()
@finishButton.enabled = currentPage.isComplete()
else
@nextButton.enabled = currentPage.isComplete()
end
end
|
#historyPages ⇒ Object
59
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 59
def historyPages() return @history end
|
73
74
75
76
77
78
79
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 73
def nextButtonClicked()
oldPage = @history.last()
newPage = oldPage.nextPage()
newPage.resetPage()
@history.push(newPage)
switchPage(oldPage)
end
|
#setFirstPage(page) ⇒ Object
61
62
63
64
65
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 61
def setFirstPage(page)
page.resetPage()
@history.push(page)
switchPage(nil)
end
|
#switchPage(oldPage) ⇒ Object
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
|
# File 'ext/ruby/qtruby/examples/dialogs/complexwizard/complexwizard.rb', line 90
def switchPage(oldPage)
if !oldPage.nil?
oldPage.hide()
@mainLayout.removeWidget(oldPage)
disconnect(oldPage, SIGNAL('completeStateChanged()'),
self, SLOT('completeStateChanged()'))
end
newPage = @history.last()
@mainLayout.insertWidget(0, newPage)
newPage.show()
newPage.setFocus()
connect(newPage, SIGNAL('completeStateChanged()'),
self, SLOT('completeStateChanged()'))
@backButton.enabled = @history.size != 1
if newPage.isLastPage()
@nextButton.enabled = false
@finishButton.default = true
else
@nextButton.default = true
@finishButton.enabled = false
end
completeStateChanged()
end
|