1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-11 15:40:39 +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.

65 lines
1.5 KiB
C++
Raw Normal View History

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