Receptacle
 All Classes Files Functions Variables Pages
label_for.h
1 /*
2 
3 Copyright 2014 William Wedler
4 
5 This file is part of Receptacle
6 
7 Receptacle is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Receptacle is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Receptacle. If not, see <http://www.gnu.org/licenses/>.
19 
20 */
21 
22 
23 #ifndef LABEL_FOR_H
24 #define LABEL_FOR_H
25 
26 #include <QWidget>
27 #include <QLabel>
28 // based on http://qt-project.org/wiki/Make-a-QLabel-Clicka
29 class LabelFor : public QLabel{
30 
31 Q_OBJECT
32 
33 public:
34  explicit LabelFor( const QString& text ="", QWidget* on_click_buddy=NULL , QWidget * parent = 0);
35  ~LabelFor();
36 
37 signals:
38  void clicked();
39 
40 protected:
41  void mousePressEvent ( QMouseEvent * event ) ;
42 
47  QWidget* click_buddy;
48 };
49 
50 #endif // LABEL_FOR_H
Definition: label_for.h:29
QWidget * click_buddy
click_buddy QWidget that gets focus when the label is clicked
Definition: label_for.h:47