yolobs-studio/UI/url-push-button.cpp
2020-03-25 09:07:22 +01:00

26 lines
433 B
C++

#include "url-push-button.hpp"
#include <QUrl>
#include <QMouseEvent>
#include <QDesktopServices>
void UrlPushButton::setTargetUrl(QUrl url)
{
setToolTip(url.toString());
m_targetUrl = url;
}
QUrl UrlPushButton::targetUrl()
{
return m_targetUrl;
}
void UrlPushButton::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event)
QUrl openUrl = m_targetUrl;
if (openUrl.isEmpty())
return;
QDesktopServices::openUrl(openUrl);
}