linklabel.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2021 by Felix Weilbach <felix.weilbach@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #pragma once
  15. #include <QLabel>
  16. #include <QUrl>
  17. namespace OCC {
  18. class LinkLabel : public QLabel
  19. {
  20. Q_OBJECT
  21. public:
  22. explicit LinkLabel(QWidget *parent = nullptr);
  23. void setUrl(const QUrl &url);
  24. signals:
  25. void clicked();
  26. protected:
  27. void enterEvent(QEvent *event) override;
  28. void leaveEvent(QEvent *event) override;
  29. void mouseReleaseEvent(QMouseEvent *event) override;
  30. private:
  31. void setFontUnderline(bool value);
  32. QUrl url;
  33. };
  34. }