X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fwidgets%2Fpopuptoolbutton.cpp;h=a5886aafed4a86b0c64891a5386ca71a934fba2d;hp=4ea6f3eda5c415da26f784830437f0ff364d6342;hb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;hpb=4b53a1edfa2309a5b1f40f4adc78eff814fb0d15 diff --git a/pv/widgets/popuptoolbutton.cpp b/pv/widgets/popuptoolbutton.cpp index 4ea6f3ed..a5886aaf 100644 --- a/pv/widgets/popuptoolbutton.cpp +++ b/pv/widgets/popuptoolbutton.cpp @@ -18,37 +18,40 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "popuptoolbutton.h" namespace pv { namespace widgets { PopupToolButton::PopupToolButton(QWidget *parent) : - QToolButton(parent) + QToolButton(parent), + popup_(NULL) { connect(this, SIGNAL(clicked(bool)), this, SLOT(on_clicked(bool))); } Popup* PopupToolButton::popup() const { - return _popup; + return popup_; } void PopupToolButton::set_popup(Popup *popup) { assert(popup); - _popup = popup; + popup_ = popup; } void PopupToolButton::on_clicked(bool) { - if(!_popup) + if(!popup_) return; const QRect r = rect(); - _popup->set_position(mapToGlobal(QPoint((r.left() + r.right()) / 2, + popup_->set_position(mapToGlobal(QPoint((r.left() + r.right()) / 2, ((r.top() + r.bottom() * 3) / 4))), Popup::Bottom); - _popup->show(); + popup_->show(); } } // widgets