def createItemSettingsMenu(self): menu = QtWidgets.QMenu('Item View', self) action = QtWidgets.QAction('Show labels', menu) action.setCheckable(True) action.setChecked(self.isItemTextVisible()) action.triggered[bool].connect(self.setItemTextVisible) menu.addAction(action) menu.addSeparator() action = studioqt.SliderAction('Size', menu) action.slider().setMinimum(10) action.slider().setMaximum(200) action.slider().setValue(self.zoomAmount()) action.slider().valueChanged.connect(self.setZoomAmount) menu.addAction(action) action = studioqt.SliderAction('Border', menu) action.slider().setMinimum(0) action.slider().setMaximum(20) action.slider().setValue(self.padding()) action.slider().valueChanged.connect(self.setPadding) menu.addAction(action) action = studioqt.SliderAction('Spacing', menu) action.slider().setMinimum(self.DEFAULT_MIN_SPACING) action.slider().setMaximum(self.DEFAULT_MAX_SPACING) action.slider().setValue(self.spacing()) action.slider().valueChanged.connect(self.setSpacing) menu.addAction(action) return menu
def createSettingsMenu(self): """ Create and return the settings menu for the widget. :rtype: QtWidgets.QMenu """ menu = QtWidgets.QMenu("Item View", self) menu.addSeparator() action = QtWidgets.QAction("Show labels", menu) action.setCheckable(True) action.setChecked(self.isItemTextVisible()) action.triggered[bool].connect(self.setItemTextVisible) menu.addAction(action) menu.addSeparator() sortByMenu = self.treeWidget().createSortByMenu() menu.addMenu(sortByMenu) groupByMenu = self.treeWidget().createGroupByMenu() menu.addMenu(groupByMenu) copyTextMenu = self.treeWidget().createCopyTextMenu() menu.addMenu(copyTextMenu) menu.addSeparator() action = studioqt.SliderAction("Size", menu) action.slider().setMinimum(10) action.slider().setMaximum(200) action.slider().setValue(self.zoomAmount()) action.slider().valueChanged.connect(self.setZoomAmount) menu.addAction(action) action = studioqt.SliderAction("Border", menu) action.slider().setMinimum(0) action.slider().setMaximum(20) action.slider().setValue(self.padding()) action.slider().valueChanged.connect(self.setPadding) menu.addAction(action) # action = studioqt.SliderAction("Spacing", menu) action.slider().setMinimum(self.DEFAULT_MIN_SPACING) action.slider().setMaximum(self.DEFAULT_MAX_SPACING) action.slider().setValue(self.spacing()) action.slider().valueChanged.connect(self.setSpacing) menu.addAction(action) return menu
def settingsMenu(self, parent=None): """ Return the settings menu for changing the list widget. :rtype: QtGui.QMenu """ parent = parent or self menu = QtGui.QMenu('View', parent) action = QtGui.QAction('Show labels', menu) action.setCheckable(True) action.setChecked(self.isItemTextVisible()) action.triggered[bool].connect(self.setItemTextVisible) menu.addAction(action) menu.addSeparator() action = studioqt.SliderAction('Size', menu) action.slider().setMinimum(10) action.slider().setMaximum(200) action.slider().setValue(self.zoomAmount()) action.slider().valueChanged.connect(self.setZoomAmount) menu.addAction(action) action = studioqt.SliderAction('Border', menu) action.slider().setMinimum(0) action.slider().setMaximum(20) action.slider().setValue(self.padding()) action.slider().valueChanged.connect(self.setPadding) menu.addAction(action) action = studioqt.SliderAction('Spacing', menu) action.slider().setMinimum(0) action.slider().setMaximum(25) action.slider().setValue(self.spacing()) action.slider().valueChanged.connect(self.setSpacing) menu.addAction(action) menu.addSeparator() sortByMenu = self.sortByMenu(parent=menu) menu.addMenu(sortByMenu) return menu