forked from simulationcraft/simc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnumeratedTab.hpp
43 lines (35 loc) · 1.06 KB
/
EnumeratedTab.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
// ==========================================================================
// Dedmonwakeen's Raid DPS/TPS Simulator.
// Send questions to [email protected]
// ==========================================================================
#pragma once
#include <QtWidgets/QTabWidget>
class QKeyEvent;
class SC_enumeratedTabBase : public QTabWidget
{
private:
QList<QPair<Qt::Key, QList<Qt::KeyboardModifier> > > ignoreKeys;
public:
SC_enumeratedTabBase( QWidget* parent );
void addIgnoreKeyPressEvent( Qt::Key k, const QList<Qt::KeyboardModifier>& s );
bool removeIgnoreKeyPressEvent( Qt::Key k, const QList<Qt::KeyboardModifier>& s );
void removeAllIgnoreKeyPressEvent();
protected:
void keyPressEvent( QKeyEvent* e ) override;
};
template <typename E>
class SC_enumeratedTab : public SC_enumeratedTabBase
{
public:
SC_enumeratedTab( QWidget* parent = nullptr ) : SC_enumeratedTabBase( parent )
{
}
E currentTab()
{
return static_cast<E>( currentIndex() );
}
void setCurrentTab( E t )
{
return setCurrentIndex( static_cast<int>( t ) );
}
};