1 /*
2  * This file Copyright (C) 2010-2015 Mnemosyne LLC
3  *
4  * It may be used under the GNU GPL versions 2 or 3
5  * or any future license endorsed by Mnemosyne LLC.
6  *
7  */
8 
9 #pragma once
10 
11 #include <QComboBox>
12 
13 class FilterBarComboBox : public QComboBox
14 {
15     Q_OBJECT
16 
17 public:
18     enum
19     {
20         CountRole = Qt::UserRole + 1,
21         CountStringRole,
22         UserRole
23     };
24 
25 public:
26     FilterBarComboBox(QWidget* parent = nullptr);
27 
28     // QWidget
29     QSize minimumSizeHint() const override;
30     QSize sizeHint() const override;
31 
32 protected:
33     // QWidget
34     void paintEvent(QPaintEvent* e) override;
35 
36 private:
37     QSize calculateSize(QSize const& textSize, QSize const& countSize) const;
38 };
39