2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* 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, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-10-15 10:23:46 +08:00
|
|
|
#ifndef LABELWITHMENU_H
|
|
|
|
#define LABELWITHMENU_H
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
class LabelWithMenu : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit LabelWithMenu(QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
// QWidget interface
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2023-01-04 09:08:58 +08:00
|
|
|
|
|
|
|
// QWidget interface
|
|
|
|
protected:
|
2024-09-29 20:01:14 +08:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
void enterEvent(QEnterEvent *event) override;
|
|
|
|
#else
|
2023-01-04 09:08:58 +08:00
|
|
|
void enterEvent(QEvent *event) override;
|
2024-09-29 20:01:14 +08:00
|
|
|
#endif
|
2023-01-04 09:08:58 +08:00
|
|
|
void leaveEvent(QEvent *event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QCursor mCursor;
|
2021-10-15 10:23:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LABELWITHMENU_H
|