New clickable widget
This commit is contained in:
@@ -130,6 +130,7 @@ add_executable(Bloom
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgWidget.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/ClickableWidget.cpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/ExpandingWidget.hpp
|
||||
src/Insight/UserInterfaces/InsightWindow/Widgets/ExpandingHeightScrollAreaWidget.hpp
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "ClickableWidget.hpp"
|
||||
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
void ClickableWidget::mouseReleaseEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
emit this->clicked();
|
||||
}
|
||||
|
||||
QWidget::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void ClickableWidget::mouseDoubleClickEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
emit this->doubleClicked();
|
||||
}
|
||||
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
class Q_WIDGETS_EXPORT ClickableWidget: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
public:
|
||||
explicit ClickableWidget(QWidget* parent): QFrame(parent) {};
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
void doubleClicked();
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user