annotate src/selectablelabel.h @ 558:d932ce55c364 find

Remove the single find widget from top, add one to each tab at the bottom instead. (Turns out you don't usually want to search for the same text in both types of widget.) Also provide sensible no-results text.
author Chris Cannam
date Mon, 27 Feb 2012 17:08:26 +0000
parents b9c153e00e84
children 533519ebc0cb
rev   line source
Chris@69 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@69 2
Chris@69 3 /*
Chris@69 4 EasyMercurial
Chris@69 5
Chris@69 6 Based on HgExplorer by Jari Korhonen
Chris@69 7 Copyright (c) 2010 Jari Korhonen
Chris@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 Queen Mary, University of London
Chris@69 10
Chris@69 11 This program is free software; you can redistribute it and/or
Chris@69 12 modify it under the terms of the GNU General Public License as
Chris@69 13 published by the Free Software Foundation; either version 2 of the
Chris@69 14 License, or (at your option) any later version. See the file
Chris@69 15 COPYING included with this distribution for more information.
Chris@69 16 */
Chris@69 17
Chris@69 18 #ifndef _SELECTABLE_LABEL_H_
Chris@69 19 #define _SELECTABLE_LABEL_H_
Chris@69 20
Chris@69 21 #include <QLabel>
Chris@69 22
Chris@69 23 class SelectableLabel : public QLabel
Chris@69 24 {
Chris@69 25 Q_OBJECT
Chris@69 26
Chris@69 27 public:
Chris@69 28 SelectableLabel(QWidget *parent = 0);
Chris@69 29 virtual ~SelectableLabel();
Chris@69 30
Chris@69 31 void setSelectedText(QString);
Chris@69 32 void setUnselectedText(QString);
Chris@69 33
Chris@69 34 bool isSelected() const { return m_selected; }
Chris@69 35
Chris@69 36 signals:
Chris@69 37 void selectionChanged();
Chris@69 38 void doubleClicked();
Chris@69 39
Chris@69 40 public slots:
Chris@69 41 void setSelected(bool);
Chris@69 42 void toggle();
Chris@69 43
Chris@69 44 protected:
Chris@69 45 virtual void mousePressEvent(QMouseEvent *e);
Chris@69 46 virtual void mouseReleaseEvent(QMouseEvent *e);
Chris@69 47 virtual void mouseDoubleClickEvent(QMouseEvent *e);
Chris@69 48 virtual void enterEvent(QEvent *);
Chris@69 49 virtual void leaveEvent(QEvent *);
Chris@69 50 void setupStyle();
Chris@69 51 QString m_selectedText;
Chris@69 52 QString m_unselectedText;
Chris@69 53 bool m_selected;
Chris@69 54 bool m_swallowRelease;
Chris@69 55 };
Chris@69 56
Chris@69 57 #endif