Simplify the "responsive layout" implementation. Just use a QBoxLayout with changing direction instead of repopulating a QGridLayout, and change the orientation of one set of sliders instead of creating two sets in a stacked layout. Simplify the resizeEvent() implementation accordingly. Update the documentation snippet text to match the code, and document the resizeEvent() override. Fixes: QTBUG-119977 Change-Id: I73a1bb215c956fa283291ebf0ea45ff9a975c727 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit f3fb89ba298e1741320d8bfac9cbd0d503373bff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 2d3ee8ac34bdf30ffc14054a8aeb64ba292bb96e)
44 lines
832 B
C++
44 lines
832 B
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef SLIDERSGROUP_H
|
|
#define SLIDERSGROUP_H
|
|
|
|
#include <QGroupBox>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QDial;
|
|
class QScrollBar;
|
|
class QSlider;
|
|
class QBoxLayout;
|
|
QT_END_NAMESPACE
|
|
|
|
//! [0]
|
|
class SlidersGroup : public QGroupBox
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
SlidersGroup(const QString &title, QWidget *parent = nullptr);
|
|
|
|
signals:
|
|
void valueChanged(int value);
|
|
|
|
public slots:
|
|
void setValue(int value);
|
|
void setMinimum(int value);
|
|
void setMaximum(int value);
|
|
void invertAppearance(bool invert);
|
|
void invertKeyBindings(bool invert);
|
|
void setOrientation(Qt::Orientation orientation);
|
|
|
|
private:
|
|
QSlider *slider;
|
|
QScrollBar *scrollBar;
|
|
QDial *dial;
|
|
QBoxLayout *slidersLayout;
|
|
};
|
|
//! [0]
|
|
|
|
#endif
|