comparison widgets/SelectableLabel.h @ 424:374b72f5b4bb

* More SelectableLabel and TransformFinder tweaking
author Chris Cannam
date Mon, 29 Sep 2008 15:06:43 +0000
parents
children f8fcfbe13c8f
comparison
equal deleted inserted replaced
423:5a55d0683ee5 424:374b72f5b4bb
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2008 QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _SELECTABLE_LABEL_H_
17 #define _SELECTABLE_LABEL_H_
18
19 #include <QLabel>
20
21 class SelectableLabel : public QLabel
22 {
23 Q_OBJECT
24
25 public:
26 SelectableLabel(QWidget *parent = 0);
27 virtual ~SelectableLabel();
28
29 void setSelectedText(QString);
30 void setUnselectedText(QString);
31
32 bool isSelected() const { return m_selected; }
33
34 signals:
35 void selectionChanged();
36 void doubleClicked();
37
38 public slots:
39 void setSelected(bool);
40 void toggle();
41
42 protected:
43 virtual void mousePressEvent(QMouseEvent *e);
44 virtual void mouseDoubleClickEvent(QMouseEvent *e);
45 virtual void enterEvent(QEvent *);
46 virtual void leaveEvent(QEvent *);
47 void setupStyle();
48 QString m_selectedText;
49 QString m_unselectedText;
50 bool m_selected;
51 };
52
53 #endif