Add a new preference for the visibility icons
Add a preference to Display->UI that allows the user to choose if the visibility icons are shown in the tree view.
This commit is contained in:
@@ -92,50 +92,57 @@ DlgSettingsUI::DlgSettingsUI(QWidget* parent)
|
||||
ResizableColumn->setEntryName("ResizableColumn");
|
||||
ResizableColumn->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
VisibilityIcon = new Gui::PrefCheckBox(this);
|
||||
layoutTreeview->addWidget(VisibilityIcon, 3, 0);
|
||||
VisibilityIcon->setChecked(Gui::TreeParams::defaultVisibilityIcon());
|
||||
VisibilityIcon->setEntryName("VisibilityIcon");
|
||||
VisibilityIcon->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
HideColumn = new Gui::PrefCheckBox(this);
|
||||
layoutTreeview->addWidget(HideColumn, 3, 0);
|
||||
layoutTreeview->addWidget(HideColumn, 4, 0);
|
||||
HideColumn->setChecked(Gui::TreeParams::defaultHideColumn());
|
||||
HideColumn->setEntryName("HideColumn");
|
||||
HideColumn->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
HideScrollBar = new Gui::PrefCheckBox(this);
|
||||
layoutTreeview->addWidget(HideScrollBar, 4, 0);
|
||||
layoutTreeview->addWidget(HideScrollBar, 5, 0);
|
||||
HideScrollBar->setChecked(Gui::TreeParams::defaultHideScrollBar());
|
||||
HideScrollBar->setEntryName("HideScrollBar");
|
||||
HideScrollBar->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
HideHeaderView = new Gui::PrefCheckBox(this);
|
||||
layoutTreeview->addWidget(HideHeaderView, 5, 0);
|
||||
layoutTreeview->addWidget(HideHeaderView, 6, 0);
|
||||
HideHeaderView->setChecked(Gui::TreeParams::defaultHideHeaderView());
|
||||
HideHeaderView->setEntryName("HideHeaderView");
|
||||
HideHeaderView->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
labelIconSize = new QLabel(this);
|
||||
layoutTreeview->addWidget(labelIconSize, 6, 0);
|
||||
layoutTreeview->addWidget(labelIconSize, 7, 0);
|
||||
IconSize = new Gui::PrefSpinBox(this);
|
||||
layoutTreeview->addWidget(IconSize, 6, 1);
|
||||
layoutTreeview->addWidget(IconSize, 7, 1);
|
||||
IconSize->setValue(Gui::TreeParams::defaultIconSize());
|
||||
IconSize->setEntryName("IconSize");
|
||||
IconSize->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
labelFontSize = new QLabel(this);
|
||||
layoutTreeview->addWidget(labelFontSize, 7, 0);
|
||||
layoutTreeview->addWidget(labelFontSize, 8, 0);
|
||||
FontSize = new Gui::PrefSpinBox(this);
|
||||
layoutTreeview->addWidget(FontSize, 7, 1);
|
||||
layoutTreeview->addWidget(FontSize, 8, 1);
|
||||
FontSize->setValue(Gui::TreeParams::defaultFontSize());
|
||||
FontSize->setEntryName("FontSize");
|
||||
FontSize->setParamGrpPath("TreeView");
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:433)
|
||||
labelItemSpacing = new QLabel(this);
|
||||
layoutTreeview->addWidget(labelItemSpacing, 8, 0);
|
||||
layoutTreeview->addWidget(labelItemSpacing, 9, 0);
|
||||
ItemSpacing = new Gui::PrefSpinBox(this);
|
||||
layoutTreeview->addWidget(ItemSpacing, 8, 1);
|
||||
layoutTreeview->addWidget(ItemSpacing, 9, 1);
|
||||
ItemSpacing->setValue(Gui::TreeParams::defaultItemSpacing());
|
||||
ItemSpacing->setEntryName("ItemSpacing");
|
||||
ItemSpacing->setParamGrpPath("TreeView");
|
||||
@@ -442,6 +449,7 @@ void DlgSettingsUI::saveSettings()
|
||||
ItemBackground->onSave();
|
||||
ItemBackgroundPadding->onSave();
|
||||
ResizableColumn->onSave();
|
||||
VisibilityIcon->onSave();
|
||||
HideColumn->onSave();
|
||||
HideScrollBar->onSave();
|
||||
HideHeaderView->onSave();
|
||||
@@ -482,6 +490,7 @@ void DlgSettingsUI::loadSettings()
|
||||
ItemBackground->onRestore();
|
||||
ItemBackgroundPadding->onRestore();
|
||||
ResizableColumn->onRestore();
|
||||
VisibilityIcon->onRestore();
|
||||
HideColumn->onRestore();
|
||||
HideScrollBar->onRestore();
|
||||
HideHeaderView->onRestore();
|
||||
@@ -528,6 +537,8 @@ void DlgSettingsUI::retranslateUi()
|
||||
labelItemBackgroundPadding->setToolTip(ItemBackgroundPadding->toolTip());
|
||||
ResizableColumn->setToolTip(QApplication::translate("TreeParams", Gui::TreeParams::docResizableColumn()));
|
||||
ResizableColumn->setText(QObject::tr("Resizable columns"));
|
||||
VisibilityIcon->setToolTip(QApplication::translate("TreeParams", Gui::TreeParams::docVisibilityIcon()));
|
||||
VisibilityIcon->setText(QObject::tr("Show visibility icon"));
|
||||
HideColumn->setToolTip(QApplication::translate("TreeParams", Gui::TreeParams::docHideColumn()));
|
||||
HideColumn->setText(QObject::tr("Hide extra column"));
|
||||
HideScrollBar->setToolTip(QApplication::translate("TreeParams", Gui::TreeParams::docHideScrollBar()));
|
||||
|
||||
@@ -78,6 +78,7 @@ private:
|
||||
QLabel *labelItemBackgroundPadding = nullptr;
|
||||
Gui::PrefSpinBox *ItemBackgroundPadding = nullptr;
|
||||
Gui::PrefCheckBox *ResizableColumn = nullptr;
|
||||
Gui::PrefCheckBox *VisibilityIcon = nullptr;
|
||||
Gui::PrefCheckBox *HideColumn = nullptr;
|
||||
Gui::PrefCheckBox *HideScrollBar = nullptr;
|
||||
Gui::PrefCheckBox *HideHeaderView = nullptr;
|
||||
|
||||
@@ -48,6 +48,7 @@ ParamGroup = (
|
||||
'ItemBackground',
|
||||
'ItemBackgroundPadding',
|
||||
'ResizableColumn',
|
||||
'VisibilityIcon',
|
||||
'HideColumn',
|
||||
'HideScrollBar',
|
||||
'HideHeaderView',
|
||||
|
||||
@@ -94,7 +94,7 @@ static bool _DraggingActive;
|
||||
static bool _DragEventFilter;
|
||||
|
||||
static bool isVisibilityIconEnabled() {
|
||||
return true;
|
||||
return TreeParams::getVisibilityIcon();
|
||||
}
|
||||
|
||||
static bool isSelectionCheckBoxesEnabled() {
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
long ColumnSize1;
|
||||
long ColumnSize2;
|
||||
bool TreeToolTipIcon;
|
||||
bool VisibilityIcon;
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:203)
|
||||
TreeParamsP() {
|
||||
@@ -156,6 +157,8 @@ public:
|
||||
funcs["ColumnSize2"] = &TreeParamsP::updateColumnSize2;
|
||||
TreeToolTipIcon = handle->GetBool("TreeToolTipIcon", false);
|
||||
funcs["TreeToolTipIcon"] = &TreeParamsP::updateTreeToolTipIcon;
|
||||
VisibilityIcon = handle->GetBool("VisibilityIcon", false);
|
||||
funcs["VisibilityIcon"] = &TreeParamsP::updateVisibilityIcon;
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:217)
|
||||
@@ -389,6 +392,14 @@ public:
|
||||
static void updateTreeToolTipIcon(TreeParamsP *self) {
|
||||
self->TreeToolTipIcon = self->handle->GetBool("TreeToolTipIcon", false);
|
||||
}
|
||||
// Auto generated code (Tools/params_utils.py:296)
|
||||
static void updateVisibilityIcon(TreeParamsP *self) {
|
||||
auto v = self->handle->GetBool("VisibilityIcon", false);
|
||||
if (self->VisibilityIcon != v) {
|
||||
self->VisibilityIcon = v;
|
||||
TreeParams::onVisibilityIconChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:256)
|
||||
@@ -1381,6 +1392,34 @@ void TreeParams::setTreeToolTipIcon(const bool &v) {
|
||||
void TreeParams::removeTreeToolTipIcon() {
|
||||
instance()->handle->RemoveBool("TreeToolTipIcon");
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:350)
|
||||
const char *TreeParams::docVisibilityIcon() {
|
||||
return QT_TRANSLATE_NOOP("TreeParams",
|
||||
"If enabled, show an eye icon before the tree view items, showing the items visibility status. When clicked the visibility is toggled");
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:358)
|
||||
const bool & TreeParams::getVisibilityIcon() {
|
||||
return instance()->VisibilityIcon;
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:366)
|
||||
const bool & TreeParams::defaultVisibilityIcon() {
|
||||
const static bool def = false;
|
||||
return def;
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:375)
|
||||
void TreeParams::setVisibilityIcon(const bool &v) {
|
||||
instance()->handle->SetBool("VisibilityIcon",v);
|
||||
instance()->VisibilityIcon = v;
|
||||
}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:384)
|
||||
void TreeParams::removeVisibilityIcon() {
|
||||
instance()->handle->RemoveBool("VisibilityIcon");
|
||||
}
|
||||
//[[[end]]]
|
||||
|
||||
void TreeParams::onSyncSelectionChanged() {
|
||||
@@ -1482,3 +1521,8 @@ void TreeParams::onHideColumnChanged()
|
||||
for(auto tree : TreeWidget::Instances)
|
||||
tree->setColumnHidden(1, TreeParams::getHideColumn());
|
||||
}
|
||||
|
||||
void TreeParams::onVisibilityIconChanged()
|
||||
{
|
||||
TreeWidget::updateVisibilityIcons();
|
||||
}
|
||||
|
||||
@@ -457,6 +457,19 @@ public:
|
||||
static void setTreeToolTipIcon(const bool &v);
|
||||
static const char *docTreeToolTipIcon();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:138)
|
||||
//@{
|
||||
/// Accessor for parameter VisibilityIcon
|
||||
///
|
||||
/// If enabled, show an eye icon before the tree view items, showing the items visibility status. When clicked the visibility is toggled
|
||||
static const bool & getVisibilityIcon();
|
||||
static const bool & defaultVisibilityIcon();
|
||||
static void removeVisibilityIcon();
|
||||
static void setVisibilityIcon(const bool &v);
|
||||
static const char *docVisibilityIcon();
|
||||
static void onVisibilityIconChanged();
|
||||
//@}
|
||||
//[[[end]]]
|
||||
|
||||
static void refreshTreeViews();
|
||||
|
||||
@@ -80,6 +80,8 @@ Params = [
|
||||
ParamInt('ColumnSize1', 0),
|
||||
ParamInt('ColumnSize2', 0),
|
||||
ParamBool('TreeToolTipIcon', False, title='Show icon in tool tip'),
|
||||
ParamBool('VisibilityIcon', False, on_change=True, title='Show visibility icon',
|
||||
doc = "If enabled, show an eye icon before the tree view items, showing the items visibility status. When clicked the visibility is toggled"),
|
||||
]
|
||||
|
||||
def declare_begin():
|
||||
|
||||
Reference in New Issue
Block a user