ui: Improved code view UI
* reduced minimized file state to one-colored block * added hover states to file buttons * show hover state when hovering title bar * fixed file button use for overview stats snippet
This commit is contained in:
@@ -3,6 +3,24 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
class QtHoverButton
|
||||
: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtHoverButton(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void hoveredIn(QPushButton*);
|
||||
void hoveredOut(QPushButton*);
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
};
|
||||
|
||||
|
||||
class QtIconButton
|
||||
: public QPushButton
|
||||
{
|
||||
@@ -24,4 +42,46 @@ private:
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
|
||||
class QtIconStateButton
|
||||
: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ButtonState
|
||||
{
|
||||
STATE_DEFAULT,
|
||||
STATE_HOVERED,
|
||||
STATE_DISABLED
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
QString iconPath;
|
||||
QColor color;
|
||||
};
|
||||
|
||||
QtIconStateButton(QWidget* parent = nullptr);
|
||||
|
||||
void addState(ButtonState buttonState, QString iconPath, QColor color = Qt::transparent);
|
||||
|
||||
void hoverIn();
|
||||
void hoverOut();
|
||||
|
||||
signals:
|
||||
void hoveredIn(QPushButton*);
|
||||
void hoveredOut(QPushButton*);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *event);
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
void setState(State state);
|
||||
|
||||
std::map<ButtonState, State> m_states;
|
||||
};
|
||||
|
||||
#endif // QT_ICON_BUTTON_H
|
||||
|
||||
Reference in New Issue
Block a user