comparison selectablelabel.h @ 69:6d5a5571caec

* Basic working "Open Repository" dialog
author Chris Cannam
date Thu, 18 Nov 2010 15:14:39 +0000
parents
children 8fd71f570884
comparison
equal deleted inserted replaced
68:b918e57c7bea 69:6d5a5571caec
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on HgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2010 Chris Cannam
9 Copyright (c) 2010 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef _SELECTABLE_LABEL_H_
19 #define _SELECTABLE_LABEL_H_
20
21 #include <QLabel>
22
23 class SelectableLabel : public QLabel
24 {
25 Q_OBJECT
26
27 public:
28 SelectableLabel(QWidget *parent = 0);
29 virtual ~SelectableLabel();
30
31 void setSelectedText(QString);
32 void setUnselectedText(QString);
33
34 bool isSelected() const { return m_selected; }
35
36 signals:
37 void selectionChanged();
38 void doubleClicked();
39
40 public slots:
41 void setSelected(bool);
42 void toggle();
43
44 protected:
45 virtual void mousePressEvent(QMouseEvent *e);
46 virtual void mouseReleaseEvent(QMouseEvent *e);
47 virtual void mouseDoubleClickEvent(QMouseEvent *e);
48 virtual void enterEvent(QEvent *);
49 virtual void leaveEvent(QEvent *);
50 void setupStyle();
51 QString m_selectedText;
52 QString m_unselectedText;
53 bool m_selected;
54 bool m_swallowRelease;
55 };
56
57 #endif