gui/log: better-looking new dock feature

This commit is contained in:
Sebastien Bourdeauducq 2015-12-01 22:51:15 +08:00
parent 08abc2e00a
commit b6260615a6
1 changed files with 9 additions and 6 deletions

View File

@ -161,6 +161,15 @@ class _LogDock(dockarea.Dock):
self.filter_freetext_changed) self.filter_freetext_changed)
grid.addWidget(self.filter_freetext, 0, 2) grid.addWidget(self.filter_freetext, 0, 2)
newdock = QtGui.QToolButton()
newdock.setToolTip("Create new log dock")
newdock.setIcon(QtGui.QApplication.style().standardIcon(
QtGui.QStyle.SP_FileDialogNewFolder))
# note the lambda, the default parameter is overriden otherwise
newdock.clicked.connect(lambda: manager.create_new_dock())
grid.addWidget(newdock, 0, 3)
grid.layout.setColumnStretch(2, 1)
self.log = QtGui.QTableView() self.log = QtGui.QTableView()
self.log.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.log.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
self.log.horizontalHeader().setResizeMode( self.log.horizontalHeader().setResizeMode(
@ -179,12 +188,6 @@ class _LogDock(dockarea.Dock):
self.scroll_at_bottom = False self.scroll_at_bottom = False
self.scroll_value = 0 self.scroll_value = 0
self.log.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
newlog_action = QtGui.QAction("Create new log dock", self.log)
# note the lambda, the default parameter is overriden otherwise
newlog_action.triggered.connect(lambda: manager.create_new_dock())
self.log.addAction(newlog_action)
log_sub.add_setmodel_callback(self.set_model) log_sub.add_setmodel_callback(self.set_model)
def filter_level_changed(self): def filter_level_changed(self):