annotate widgets/SelectableLabel.h @ 432:8b2b497d302c

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