SpinSlider and ScrollSpinBox read-only support

PIVariantEdit - support for read-only for all types
PIValueTreeEdit - drop Parent grouping, default now Groups, full grouping control, global read-only support, fix new label error
This commit is contained in:
2023-04-28 19:51:22 +03:00
parent e7ef97dc6a
commit 46fd68a0fd
13 changed files with 102 additions and 27 deletions

View File

@@ -54,6 +54,12 @@ double ScrollSpinBox::value() const {
}
void ScrollSpinBox::setReadOnly(bool r) {
m_read_only = r;
ui->spin->setReadOnly(r);
}
void ScrollSpinBox::changeEvent(QEvent * e) {
QWidget::changeEvent(e);
switch (e->type()) {
@@ -84,7 +90,7 @@ bool ScrollSpinBox::eventFilter(QObject * o, QEvent * e) {
void ScrollSpinBox::mousePress(QMouseEvent * e) {
if (canceled || !isEnabled()) return;
if (canceled || !isEnabled() || m_read_only) return;
if (e->button() == Qt::RightButton) {
canceled = true;
ui->spin->setExpression(last_text);
@@ -99,13 +105,13 @@ void ScrollSpinBox::mousePress(QMouseEvent * e) {
void ScrollSpinBox::mouseRelease(QMouseEvent * e) {
if (!isEnabled()) return;
if (!isEnabled() || m_read_only) return;
if (e->buttons() == Qt::NoButton) canceled = false;
}
void ScrollSpinBox::mouseMove(QMouseEvent * e) {
if (canceled || !isEnabled()) return;
if (canceled || !isEnabled() || m_read_only) return;
if (e->buttons().testFlag(Qt::LeftButton)) {
double dv = (down_pos.y() - e->pos().y()) * scroll_scale;
if (dv != 0.) {