SimCenterCommon
Common functionality used within different SimCenter projects
sectiontitle.h
Go to the documentation of this file.
1 /*********************************************************************************
2 **
3 ** Copyright (c) 2017 The Regents of the University of California
4 **
5 ** Redistribution and use in source and binary forms, with or without modification,
6 ** are permitted provided that the following conditions are met:
7 **
8 ** 1. Redistributions of source code must retain the above copyright notice, this
9 ** list of conditions and the following disclaimer.
10 **
11 ** 2. Redistributions in binary form must reproduce the above copyright notice, this
12 ** list of conditions and the following disclaimer in the documentation and/or other
13 ** materials provided with the distribution.
14 **
15 ** 3. Neither the name of the copyright holder nor the names of its contributors may
16 ** be used to endorse or promote products derived from this software without specific
17 ** prior written permission.
18 **
19 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 ** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
22 ** SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25 ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 ** SUCH DAMAGE.
29 **
30 ***********************************************************************************/
31 
32 // Contributors:
33 // Written by:
34 // Maxwell Rutmann, University of California at Berkeley, CA, United States
35 // Peter Mackenzie-Helnwein, University of Washington, Seattle, WA, United States
36 
37 /***********************************************************
38  * HOW TO USE SectionTitle in Qt Creator/Designer *
39  * *
40  * 1) create your section title as QLabel *
41  * 2) promote this QLabel to SectionTitle *
42  * *
43  * You me need to create an entry for the promoted widget *
44  * the first time you want to use this technique in your *
45  * Qt Creator/Designer installation. *
46  * *
47  * Common issues: *
48  * make sure the path to the header file is given properly *
49  * relative to the main folder. When using the *
50  * NHERI-SimCenter widgets respository, the proper path is *
51  * ../widgets/Common/sectiontitle.h *
52  * *
53  ***********************************************************/
54 
55 #ifndef SECTIONTITLE_H
56 #define SECTIONTITLE_H
57 
58 #include <QWidget>
59 #include <QString>
60 #include <QFrame>
61 #include <QLabel>
62 #include <QVBoxLayout>
63 #include <QGridLayout>
64 class QComboBox;
65 
66 class SectionTitle : public QFrame
67 {
68  Q_OBJECT
69 
70 public:
71 
72  explicit SectionTitle(QWidget *parent = 0);
73  void setTitle(QString);
74  void setText(QString s) {this->setTitle(s);};
75  void addWidget(QWidget *theWidget);
76 
77 signals:
78 
79 public slots:
80 
81 private:
82  QGridLayout *sectionLayout;
83  QLabel *sectionLabel;
84  QFrame *line;
85 };
86 
87 #endif // SECTIONTITLE_H
void setText(QString s)
Definition: sectiontitle.h:74
void setTitle(QString)
SectionTitle(QWidget *parent=0)
void addWidget(QWidget *theWidget)