X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fwidgets%2Fpopup.hpp;fp=pv%2Fwidgets%2Fpopup.hpp;h=736313c79d9615ae890a7c585027483b3761f87d;hp=66f7f06f5d87192a2ea77cbafee44af21cec294c;hb=f52ffd9d82b45313836c5e612c7cc48982ced529;hpb=368130c06af6a0cbcf8026cb61fce6d6e2304544 diff --git a/pv/widgets/popup.hpp b/pv/widgets/popup.hpp index 66f7f06f..736313c7 100644 --- a/pv/widgets/popup.hpp +++ b/pv/widgets/popup.hpp @@ -20,11 +20,29 @@ #ifndef PULSEVIEW_PV_WIDGETS_POPUP_HPP #define PULSEVIEW_PV_WIDGETS_POPUP_HPP +#include #include namespace pv { namespace widgets { + +// A regular QScrollArea has a fixed size and provides scroll bars when the +// content can't be shown in its entirety. However, we want no horizontal +// scroll bar and want the scroll area to adjust its width to fit the content +// instead. +// Inspired by https://stackoverflow.com/questions/21253755/qscrollarea-with-dynamically-changing-contents?answertab=votes#tab-top +class QWidthAdjustingScrollArea : public QScrollArea +{ + Q_OBJECT + +public: + QWidthAdjustingScrollArea(QWidget* parent = 0); + void setWidget(QWidget* w); + bool eventFilter(QObject* obj, QEvent* ev); +}; + + class Popup : public QWidget { Q_OBJECT