1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 23:53:57 +00:00
openmw/apps/opencs/view/widget/pushbutton.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.6 KiB
C++
Raw Normal View History

2014-07-10 09:03:55 +00:00
#ifndef CSV_WIDGET_PUSHBUTTON_H
#define CSV_WIDGET_PUSHBUTTON_H
#include <QPushButton>
2022-10-19 17:02:00 +00:00
class QKeyEvent;
class QMouseEvent;
class QObject;
class QWidget;
namespace CSMPrefs
{
class Setting;
}
2014-07-10 09:03:55 +00:00
namespace CSVWidget
{
class PushButton : public QPushButton
{
Q_OBJECT
public:
enum Type
2022-09-22 18:26:05 +00:00
{
Type_TopMode, // top level button for mode selector panel
Type_TopAction, // top level button that triggers an action
2014-07-31 11:05:08 +00:00
Type_Mode, // mode button
Type_Toggle
2022-09-22 18:26:05 +00:00
};
private:
bool mKeepOpen;
2014-07-31 11:05:08 +00:00
Type mType;
QString mToolTip;
QString mProcessedToolTip;
private:
void processShortcuts();
void setExtendedToolTip();
protected:
void keyPressEvent(QKeyEvent* event) override;
2014-07-10 10:53:57 +00:00
void keyReleaseEvent(QKeyEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
2014-07-10 09:03:55 +00:00
public:
/// \param push Do not maintain a toggle state
PushButton(const QIcon& icon, Type type, const QString& tooltip = "", QWidget* parent = nullptr);
2014-07-10 09:03:55 +00:00
/// \param push Do not maintain a toggle state
PushButton(Type type, const QString& tooltip = "", QWidget* parent = nullptr);
2014-07-10 09:03:55 +00:00
bool hasKeepOpen() const;
/// Return tooltip used at construction (without any button-specific modifications)
QString getBaseToolTip() const;
2014-07-10 09:03:55 +00:00
Type getType() const;
2014-07-10 09:03:55 +00:00
private slots:
void checkedStateChanged(bool checked);
void settingChanged(const CSMPrefs::Setting* setting);
2014-07-10 09:03:55 +00:00
};
}
#endif