mirror of
https://github.com/muesli/telephant
synced 2024-11-22 19:33:06 +00:00
Added clear method to PaneModel
This commit is contained in:
parent
e81b8db602
commit
f0f3f491c8
1 changed files with 8 additions and 0 deletions
|
@ -22,6 +22,7 @@ type PaneModel struct {
|
|||
|
||||
_ func(*Pane) `slot:"addPane"`
|
||||
_ func(row int) `slot:"removePane"`
|
||||
_ func() `slot:"clear"`
|
||||
}
|
||||
|
||||
// Pane represents a single pane
|
||||
|
@ -48,6 +49,7 @@ func (m *PaneModel) init() {
|
|||
|
||||
m.ConnectAddPane(m.addPane)
|
||||
m.ConnectRemovePane(m.removePane)
|
||||
m.ConnectClear(m.clear)
|
||||
}
|
||||
|
||||
func (m *PaneModel) setData(index *core.QModelIndex, value *core.QVariant, role int) bool {
|
||||
|
@ -103,6 +105,12 @@ func (m *PaneModel) roleNames() map[int]*core.QByteArray {
|
|||
return m.Roles()
|
||||
}
|
||||
|
||||
func (m *PaneModel) clear() {
|
||||
m.BeginResetModel()
|
||||
m.SetPanes([]*Pane{})
|
||||
m.EndResetModel()
|
||||
}
|
||||
|
||||
func (m *PaneModel) addPane(p *Pane) {
|
||||
// add pane before the last pane, which is always the notifications pane
|
||||
if len(m.Panes()) == 0 {
|
||||
|
|
Loading…
Reference in a new issue