first commit
This commit is contained in:
30
project/fm_viewer/ui/fm_label_click.cpp
Normal file
30
project/fm_viewer/ui/fm_label_click.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
#include "fm_label_click.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
FMClickLabel::FMClickLabel(QWidget* parent, Qt::WindowFlags f)
|
||||
: QLabel(parent)
|
||||
{
|
||||
Q_UNUSED(f)
|
||||
|
||||
}
|
||||
FMClickLabel::~FMClickLabel() {}
|
||||
|
||||
void FMClickLabel::mouseReleaseEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event)
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
FMClickURLLabel::FMClickURLLabel(QString url, QWidget* parent, Qt::WindowFlags f)
|
||||
: FMClickLabel(parent,f){
|
||||
setMouseTracking(true);
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
_url = url;
|
||||
}
|
||||
FMClickURLLabel::~FMClickURLLabel() {}
|
||||
|
||||
void FMClickURLLabel::mouseReleaseEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event)
|
||||
QDesktopServices::openUrl(QUrl(_url));
|
||||
}
|
||||
Reference in New Issue
Block a user