예제 #1
0
파일: main.go 프로젝트: richardfontana/lime
func new_window(w *backend.Window) {
	log4go.Debug("new_window entered")
	defer log4go.Debug("new_window exited")
	qw := qt5.NewWidget()
	qw.Show()
	qw.SetSizev(600, 400)
	tw := qt5.NewTabWidget()
	lbox := qt5.NewVBoxLayout()
	lbox.AddWidget(tw)
	c := newQLimeView(backend.GetEditor().Console())
	sa := qt5.NewScrollArea()
	sa.SetWidget(c)
	lbox.AddWidget(sa)
	qw.SetLayout(lbox)
	wnds[w] = QLimeWindow{tw, w}
}
예제 #2
0
파일: widgets.go 프로젝트: Kelimion/go-qt5
func (p *MainWindow) Init() *MainWindow {
	if p.Widget.Init() == nil {
		return nil
	}
	p.SetWindowTitle("MainWindow")

	p.tab = qt5.NewTabWidget()

	p.tab.AddTab(p.createStdTab(), "Standard", nil)
	p.tab.AddTab(p.createMyTab(), "Custom", nil)
	p.tab.AddTab(p.createToolBox(), "ToolBox", nil)

	p.sbar = qt5.NewStatusBar()

	menubar := qt5.NewMenuBar()
	menu := qt5.NewMenuWithTitle("&File")
	//menu.SetTitle("&File")
	menubar.AddMenu(menu)

	act := qt5.NewAction()
	act.SetText("&Quit")
	act.OnTriggered(func(bool) {
		p.Close()
	})
	ic := qt5.NewIconWithFile("images/close.png")
	//defer ic.Close()
	act.SetIcon(ic)
	menu.AddAction(act)

	toolBar := qt5.NewToolBar()
	toolBar.AddAction(act)
	toolBar.AddSeparator()
	cmb := qt5.NewComboBox()
	cmb.AddItem("test1")
	cmb.AddItem("test2")
	cmb.SetToolTip("ComboBox")
	cmbAct := toolBar.AddWidget(cmb)
	fmt.Println(cmbAct)

	vbox := qt5.NewVBoxLayout()
	vbox.SetMargin(0)
	vbox.SetSpacing(0)
	vbox.SetMenuBar(menubar)
	vbox.AddWidget(toolBar)
	vbox.AddWidget(p.tab)
	vbox.AddWidget(p.sbar)

	p.SetLayout(vbox)

	p.tab.OnCurrentChanged(func(index int) {
		p.sbar.ShowMessage("current: "+p.tab.TabText(index), 0)
	})

	systray := qt5.NewSystemTray()
	systray.SetContextMenu(menu)
	systray.SetIcon(ic)
	systray.SetVisible(true)
	systray.ShowMessage("hello", "this is a test", qt5.Information, 1000)
	ic2 := systray.Icon()
	fmt.Println(ic2)

	p.SetWindowIcon(ic2)

	return p
}