CMake findQAD miss map
MapItemBase::offset feature PIValueTreeEdit add custom button to show/hide groups
This commit is contained in:
@@ -19,6 +19,35 @@ using Attribute = PIValueTree::Attribute;
|
||||
const char property_name[] = "__name__";
|
||||
|
||||
|
||||
class GroupBox: public QGroupBox {
|
||||
public:
|
||||
GroupBox(QWidget * content = nullptr): QGroupBox() {
|
||||
icon_show = QIcon(":/icons/layer-visible-on.png");
|
||||
icon_hide = QIcon(":/icons/layer-visible-off.png");
|
||||
setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
|
||||
layout()->addWidget(content);
|
||||
setAlignment(Qt::AlignCenter);
|
||||
btn = new QToolButton(this);
|
||||
btn->setCheckable(true);
|
||||
btn->show();
|
||||
connect(btn, &QToolButton::toggled, this, [this, content](bool on) {
|
||||
btn->setIcon(on ? icon_show : icon_hide);
|
||||
content->setVisible(on);
|
||||
});
|
||||
btn->setChecked(true);
|
||||
}
|
||||
|
||||
private:
|
||||
void resizeEvent(QResizeEvent * e) {
|
||||
QGroupBox::resizeEvent(e);
|
||||
btn->resize(btn->height(), btn->height());
|
||||
btn->move(btn->height() / 2, 0);
|
||||
}
|
||||
QToolButton * btn = nullptr;
|
||||
QIcon icon_show, icon_hide;
|
||||
};
|
||||
|
||||
|
||||
PIValueTreeEdit::PIValueTreeEdit(QWidget * parent): QWidget(parent) {
|
||||
widget_params = new PIValueTreeEditParameters();
|
||||
widget_reorder = new PIValueTreeEditReorder();
|
||||
@@ -356,16 +385,10 @@ PIValueTreeEdit * PIValueTreeEdit::addTreeEdit(const PIValueTree & vt) {
|
||||
switch (real_grouping) {
|
||||
case Indent: grid->add(vt, vt.name(), ve, vt.comment(), true); break;
|
||||
case Groups: {
|
||||
auto * gb = new QGroupBox();
|
||||
gb->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
|
||||
gb->layout()->addWidget(ve);
|
||||
auto * gb = new GroupBox(ve);
|
||||
gb->setTitle(PI2QString(vt.name()));
|
||||
gb->setToolTip(PI2QString(vt.comment()));
|
||||
gb->setCheckable(true);
|
||||
gb->setChecked(true);
|
||||
gb->setAlignment(Qt::AlignCenter);
|
||||
gb->setProperty(property_name, PI2QString(vt.name()));
|
||||
connect(gb, &QGroupBox::toggled, ve, &QWidget::setVisible);
|
||||
grid->add(vt, gb, true);
|
||||
} break;
|
||||
case Tabs: {
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
<file>../../icons/legend.png</file>
|
||||
<file>../../icons/document-open.png</file>
|
||||
<file>../../icons/document-edit.png</file>
|
||||
<file>../../icons/layer-visible-off.png</file>
|
||||
<file>../../icons/layer-visible-on.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user