2014-07-10 11:03:55 +02:00
|
|
|
#ifndef CSV_WIDGET_PUSHBUTTON_H
|
|
|
|
#define CSV_WIDGET_PUSHBUTTON_H
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
namespace CSVWidget
|
|
|
|
{
|
|
|
|
class PushButton : public QPushButton
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-07-10 13:04:30 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
Type_TopMode, // top level button for mode selector panel
|
2014-09-06 16:11:06 +02:00
|
|
|
Type_TopAction, // top level button that triggers an action
|
2014-07-31 13:05:08 +02:00
|
|
|
Type_Mode, // mode button
|
|
|
|
Type_Toggle
|
2014-07-10 13:04:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-07-10 11:03:55 +02:00
|
|
|
bool mKeepOpen;
|
2014-07-10 13:04:30 +02:00
|
|
|
Type mType;
|
2014-07-13 14:21:50 +02:00
|
|
|
QString mToolTip;
|
2014-07-10 12:53:57 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-08-01 09:50:49 +02:00
|
|
|
void setExtendedToolTip();
|
2014-07-10 11:03:55 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void keyPressEvent (QKeyEvent *event);
|
|
|
|
|
2014-07-10 11:32:20 +02:00
|
|
|
virtual void keyReleaseEvent (QKeyEvent *event);
|
|
|
|
|
2014-07-10 11:03:55 +02:00
|
|
|
virtual void mouseReleaseEvent (QMouseEvent *event);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-07-10 11:44:01 +02:00
|
|
|
/// \param push Do not maintain a toggle state
|
2014-07-13 14:21:50 +02:00
|
|
|
PushButton (const QIcon& icon, Type type, const QString& tooltip = "",
|
2014-07-10 12:53:57 +02:00
|
|
|
QWidget *parent = 0);
|
2014-07-10 11:44:01 +02:00
|
|
|
|
|
|
|
/// \param push Do not maintain a toggle state
|
2014-07-13 14:21:50 +02:00
|
|
|
PushButton (Type type, const QString& tooltip = "",
|
2014-07-10 12:53:57 +02:00
|
|
|
QWidget *parent = 0);
|
2014-07-10 11:03:55 +02:00
|
|
|
|
|
|
|
bool hasKeepOpen() const;
|
2014-07-13 14:21:50 +02:00
|
|
|
|
|
|
|
/// Return tooltip used at construction (without any button-specific modifications)
|
|
|
|
QString getBaseToolTip() const;
|
2014-09-07 13:35:30 +02:00
|
|
|
|
|
|
|
Type getType() const;
|
2014-11-27 08:59:21 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void checkedStateChanged (bool checked);
|
2014-07-10 11:03:55 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|