mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
Add trivialwizard6
This uses Qt6 QWizardPage instances to create a sample introductory wizard for an application. This is ported from: https://github.com/jimmykuu/therecipe-qt-examples/blob/master/widgets/dialogs/trivialwizard/trivialwizard.go
This commit is contained in:
parent
3a1437263f
commit
060838bee1
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ examples/helloworld6/helloworld6
|
|||||||
examples/mdoutliner/mdoutliner
|
examples/mdoutliner/mdoutliner
|
||||||
examples/windowsmanifest/windowsmanifest
|
examples/windowsmanifest/windowsmanifest
|
||||||
examples/uidesigner/uidesigner
|
examples/uidesigner/uidesigner
|
||||||
|
examples/trivialwizard6/trivialwizard6
|
||||||
examples/libraries/extras-scintillaedit/extras-scintillaedit
|
examples/libraries/extras-scintillaedit/extras-scintillaedit
|
||||||
examples/libraries/qt-multimedia/qt-multimedia
|
examples/libraries/qt-multimedia/qt-multimedia
|
||||||
examples/libraries/qt-network/qt-network
|
examples/libraries/qt-network/qt-network
|
||||||
|
72
examples/trivialwizard6/main.go
Normal file
72
examples/trivialwizard6/main.go
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
qt "github.com/mappu/miqt/qt6"
|
||||||
|
)
|
||||||
|
|
||||||
|
func createIntroPage() *qt.QWizardPage {
|
||||||
|
var page = qt.NewQWizardPage2()
|
||||||
|
page.SetTitle("Introduction")
|
||||||
|
|
||||||
|
var label = qt.NewQLabel6("This wizard will help you register your copy "+
|
||||||
|
"of Super Product Two.", page.QWidget, 0)
|
||||||
|
label.SetWordWrap(true)
|
||||||
|
|
||||||
|
var layout = qt.NewQVBoxLayout2()
|
||||||
|
layout.AddWidget3(label.QWidget, 0, 0)
|
||||||
|
page.QWidget.SetLayout(layout.QBoxLayout.QLayout)
|
||||||
|
|
||||||
|
return page
|
||||||
|
}
|
||||||
|
|
||||||
|
func createRegistrationPage() *qt.QWizardPage {
|
||||||
|
var page = qt.NewQWizardPage2()
|
||||||
|
page.SetTitle("Registration")
|
||||||
|
page.SetSubTitle("Please fill both fields.")
|
||||||
|
|
||||||
|
var nameLabel = qt.NewQLabel6("Name:", page.QWidget, 0)
|
||||||
|
var nameLineEdit = qt.NewQLineEdit(page.QWidget)
|
||||||
|
|
||||||
|
var emailLabel = qt.NewQLabel6("Email address:", page.QWidget, 0)
|
||||||
|
var emailLineEdit = qt.NewQLineEdit(page.QWidget)
|
||||||
|
|
||||||
|
var layout = qt.NewQGridLayout(page.QWidget)
|
||||||
|
layout.AddWidget2(nameLabel.QFrame.QWidget, 0, 0)
|
||||||
|
layout.AddWidget2(nameLineEdit.QWidget, 0, 1)
|
||||||
|
layout.AddWidget2(emailLabel.QFrame.QWidget, 1, 0)
|
||||||
|
layout.AddWidget2(emailLineEdit.QWidget, 1, 1)
|
||||||
|
page.SetLayout(layout.QLayout)
|
||||||
|
|
||||||
|
return page
|
||||||
|
}
|
||||||
|
|
||||||
|
func createConclusionPage() *qt.QWizardPage {
|
||||||
|
var page = qt.NewQWizardPage2()
|
||||||
|
page.SetTitle("Conclusion")
|
||||||
|
|
||||||
|
var label = qt.NewQLabel6("You are now successfully registered. Have a "+
|
||||||
|
"nice day!", page.QWidget, 0)
|
||||||
|
label.SetWordWrap(true)
|
||||||
|
|
||||||
|
var layout = qt.NewQVBoxLayout2()
|
||||||
|
layout.AddWidget3(label.QWidget, 0, 0)
|
||||||
|
page.SetLayout(layout.QBoxLayout.QLayout)
|
||||||
|
|
||||||
|
return page
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
qt.NewQApplication(os.Args)
|
||||||
|
|
||||||
|
var wizard = qt.NewQWizard2()
|
||||||
|
wizard.AddPage(createIntroPage())
|
||||||
|
wizard.AddPage(createRegistrationPage())
|
||||||
|
wizard.AddPage(createConclusionPage())
|
||||||
|
|
||||||
|
wizard.QWidget.SetWindowTitle("Trivial Wizard")
|
||||||
|
wizard.QWidget.Show()
|
||||||
|
|
||||||
|
qt.QApplication_Exec()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user