Exemple #1
0
func main() {
	widgets.NewQApplication(len(os.Args), os.Args)

	NewCanvas().Show()

	widgets.QApplication_Exec()
}
Exemple #2
0
func main() {
	widgets.NewQApplication(len(os.Args), os.Args)

	NewCalculatorForm().Show()

	widgets.QApplication_Exec()
}
Exemple #3
0
func main() {
	widgets.NewQApplication(len(os.Args), os.Args)

	var player = newVideoPlayer()
	player.Resize2(320, 240)
	player.Show()

	widgets.QApplication_Exec()
}
Exemple #4
0
func main() {
	widgets.NewQApplication(len(os.Args), os.Args)

	var (
		echoGroup    = widgets.NewQGroupBox2("Echo", nil)
		echoLabel    = widgets.NewQLabel2("Mode", nil, 0)
		echoComboBox = widgets.NewQComboBox(nil)
		echoLineEdit = widgets.NewQLineEdit(nil)
	)
	echoComboBox.AddItems([]string{"Normal", "Password", "PasswordEchoOnEdit", "No Echo"})
	echoLineEdit.SetPlaceholderText("Placeholder Text")

	var (
		validatorGroup    = widgets.NewQGroupBox2("Validator", nil)
		validatorLabel    = widgets.NewQLabel2("Type:", nil, 0)
		validatorComboBox = widgets.NewQComboBox(nil)
		validatorLineEdit = widgets.NewQLineEdit(nil)
	)
	validatorComboBox.AddItems([]string{"No validator", "Integer validator", "Double validator"})
	validatorLineEdit.SetPlaceholderText("Placeholder Text")

	var (
		alignmentGroup    = widgets.NewQGroupBox2("Alignment", nil)
		alignmentLabel    = widgets.NewQLabel2("Type:", nil, 0)
		alignmentComboBox = widgets.NewQComboBox(nil)
		alignmentLineEdit = widgets.NewQLineEdit(nil)
	)
	alignmentComboBox.AddItems([]string{"Left", "Centered", "Right"})
	alignmentLineEdit.SetPlaceholderText("Placeholder Text")

	var (
		inputMaskGroup    = widgets.NewQGroupBox2("Input mask", nil)
		inputMaskLabel    = widgets.NewQLabel2("Type:", nil, 0)
		inputMaskComboBox = widgets.NewQComboBox(nil)
		inputMaskLineEdit = widgets.NewQLineEdit(nil)
	)
	inputMaskComboBox.AddItems([]string{"No mask", "Phone number", "ISO date", "License key"})
	inputMaskLineEdit.SetPlaceholderText("Placeholder Text")

	var (
		accessGroup    = widgets.NewQGroupBox2("Access", nil)
		accessLabel    = widgets.NewQLabel2("Read-only:", nil, 0)
		accessComboBox = widgets.NewQComboBox(nil)
		accessLineEdit = widgets.NewQLineEdit(nil)
	)
	accessComboBox.AddItems([]string{"False", "True"})
	accessLineEdit.SetPlaceholderText("Placeholder Text")

	echoComboBox.ConnectCurrentIndexChanged(func(index int) { echoChanged(echoLineEdit, index) })
	validatorComboBox.ConnectCurrentIndexChanged(func(index int) { validatorChanged(validatorLineEdit, index) })
	alignmentComboBox.ConnectCurrentIndexChanged(func(index int) { alignmentChanged(alignmentLineEdit, index) })
	inputMaskComboBox.ConnectCurrentIndexChanged(func(index int) { inputMaskChanged(inputMaskLineEdit, index) })
	accessComboBox.ConnectCurrentIndexChanged(func(index int) { accessChanged(accessLineEdit, index) })

	var echoLayout = widgets.NewQGridLayout2()
	echoLayout.AddWidget(echoLabel, 0, 0, 0)
	echoLayout.AddWidget(echoComboBox, 0, 1, 0)
	echoLayout.AddWidget2(echoLineEdit, 1, 0, 1, 2, 0)
	echoGroup.SetLayout(echoLayout)

	var validatorLayout = widgets.NewQGridLayout2()
	validatorLayout.AddWidget(validatorLabel, 0, 0, 0)
	validatorLayout.AddWidget(validatorComboBox, 0, 1, 0)
	validatorLayout.AddWidget2(validatorLineEdit, 1, 0, 1, 2, 0)
	validatorGroup.SetLayout(validatorLayout)

	var alignmentLayout = widgets.NewQGridLayout2()
	alignmentLayout.AddWidget(alignmentLabel, 0, 0, 0)
	alignmentLayout.AddWidget(alignmentComboBox, 0, 1, 0)
	alignmentLayout.AddWidget2(alignmentLineEdit, 1, 0, 1, 2, 0)
	alignmentGroup.SetLayout(alignmentLayout)

	var inputMaskLayout = widgets.NewQGridLayout2()
	inputMaskLayout.AddWidget(inputMaskLabel, 0, 0, 0)
	inputMaskLayout.AddWidget(inputMaskComboBox, 0, 1, 0)
	inputMaskLayout.AddWidget2(inputMaskLineEdit, 1, 0, 1, 2, 0)
	inputMaskGroup.SetLayout(inputMaskLayout)

	var accessLayout = widgets.NewQGridLayout2()
	accessLayout.AddWidget(accessLabel, 0, 0, 0)
	accessLayout.AddWidget(accessComboBox, 0, 1, 0)
	accessLayout.AddWidget2(accessLineEdit, 1, 0, 1, 2, 0)
	accessGroup.SetLayout(accessLayout)

	var layout = widgets.NewQGridLayout2()
	layout.AddWidget(echoGroup, 0, 0, 0)
	layout.AddWidget(validatorGroup, 1, 0, 0)
	layout.AddWidget(alignmentGroup, 2, 0, 0)
	layout.AddWidget(inputMaskGroup, 0, 1, 0)
	layout.AddWidget(accessGroup, 1, 1, 0)

	var window = widgets.NewQMainWindow(nil, 0)
	window.Layout().DestroyQObject()
	window.SetLayout(layout)

	window.SetWindowTitle("Line Edits")

	window.Show()

	widgets.QApplication_Exec()
}