func (p *MainWindow) createStdTab() *qt5.Widget { w := qt5.NewWidget() vbox := qt5.NewVBoxLayout() w.SetLayout(vbox) ed := qt5.NewLineEdit() ed.SetInputMask("0000-00-00") ed.SetText("2012-01-12") lbl := qt5.NewLabel() lbl.SetText("Label") btn := qt5.NewButton() btn.SetText("Button") chk := qt5.NewCheckBox() chk.SetText("CheckBox") radio := qt5.NewRadio() radio.SetText("Radio") cmb := qt5.NewComboBox() cmb.AddItem("001") cmb.AddItem("002") cmb.AddItem("003") cmb.SetCurrentIndex(2) fmt.Println(cmb.CurrentIndex()) cmb.OnCurrentIndexChanged(func(v int) { fmt.Println(cmb.ItemText(v)) }) slider := qt5.NewSlider() slider.SetTickInterval(50) slider.SetTickPosition(qt5.TicksBothSides) slider.SetSingleStep(1) scl := qt5.NewScrollBar() fmt.Println(slider.Range()) dial := qt5.NewDial() dial.SetNotchesVisible(true) dial.SetNotchTarget(10) fmt.Println(dial.NotchSize()) vbox.AddWidget(ed) vbox.AddWidget(lbl) vbox.AddWidget(btn) vbox.AddWidget(chk) vbox.AddWidget(radio) vbox.AddWidget(cmb) vbox.AddWidget(slider) vbox.AddWidget(scl) vbox.AddWidget(dial) vbox.AddStretch(0) return w }
func (p *MainWindow) createMyTab() *qt5.Widget { w := qt5.NewWidget() vbox := qt5.NewVBoxLayout() hbox := qt5.NewHBoxLayout() my := new(MyWidget).Init() lbl := qt5.NewLabel() lbl.SetText("this is custome widget - draw lines") btn := qt5.NewButton() btn.SetText("Clear") btn.OnClicked(func() { my.Clear() }) hbox.AddWidget(lbl) hbox.AddWidgetWith(btn, 0, qt5.AlignRight) vbox.AddLayout(hbox) vbox.AddWidgetWith(my, 1, 0) w.SetLayout(vbox) return w }