-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpwidget.hpp
55 lines (45 loc) · 1.14 KB
/
pwidget.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef PLINEEDIT_H
#define PLINEEDIT_H
#include <QLineEdit.h>
#include <QComboBox.h>
#include <QStylePainter>
#include <QLineEdit>
#include <QMouseEvent>
#include <QPalette>
#include <QDebug.h>
#include <QListView.h>
class PLineEdit : public QLineEdit
{
Q_OBJECT
public:
PLineEdit(QWidget* parent = nullptr);
~PLineEdit();
signals:
void focused();
protected:
virtual void focusInEvent(QFocusEvent* e);
};
class PComboBox : public QComboBox // http://engineer-works.blogspot.com/2010/02/flat-qcombobox.html
{
Q_OBJECT
public:
PComboBox(QWidget* parent = nullptr);
bool flat() const { return flat_; }
void setFlat(bool flat);
Qt::Alignment arrowAlignment() const { return arrowAlignment_; }
void setArrowAlignment(Qt::Alignment a);
void setTextAlignment(Qt::Alignment a);
void setView(QAbstractItemView* itemView);
protected:
virtual void paintEvent(QPaintEvent* e);
signals:
void menuClicked(const QModelIndex& i);
private:
inline void menu_pressed(const QModelIndex& i) { emit menuClicked(i); };
bool connected;
bool flat_;
Qt::Alignment arrowAlignment_;
Qt::Alignment textAlignment_;
QAbstractItemView* actual_itemView;
};
#endif