projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert threshold display setting to a multi-value choice
[pulseview.git]
/
pv
/
widgets
/
popuptoolbutton.cpp
diff --git
a/pv/widgets/popuptoolbutton.cpp
b/pv/widgets/popuptoolbutton.cpp
index ea3515c4981130696dc135b61748b510bbd90182..3fc2eb20aa9be8e15c6f267a5aed8ebb6769c0bb 100644
(file)
--- a/
pv/widgets/popuptoolbutton.cpp
+++ b/
pv/widgets/popuptoolbutton.cpp
@@
-14,40
+14,44
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
*/
-#include "popuptoolbutton.h"
+#include <cassert>
+
+#include "popuptoolbutton.hpp"
namespace pv {
namespace widgets {
PopupToolButton::PopupToolButton(QWidget *parent) :
namespace pv {
namespace widgets {
PopupToolButton::PopupToolButton(QWidget *parent) :
- QToolButton(parent)
+ QToolButton(parent),
+ popup_(nullptr)
{
connect(this, SIGNAL(clicked(bool)), this, SLOT(on_clicked(bool)));
}
Popup* PopupToolButton::popup() const
{
{
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);
}
void PopupToolButton::set_popup(Popup *popup)
{
assert(popup);
-
_popup
= popup;
+
popup_
= popup;
}
void PopupToolButton::on_clicked(bool)
{
}
void PopupToolButton::on_clicked(bool)
{
- if
(!_popup
)
+ if
(!popup_
)
return;
return;
- _popup->set_position(mapToGlobal(rect().center()), Popup::Bottom);
- _popup->show();
+ const QRect r = rect();
+ popup_->set_position(mapToGlobal(QPoint((r.left() + r.right()) / 2,
+ ((r.top() + r.bottom() * 3) / 4))), Popup::Bottom);
+ popup_->show();
}
}
-}
//
widgets
-}
//
pv
+}
// namespace
widgets
+}
// namespace
pv