SimCenterCommon
Common functionality used within different SimCenter projects
sectiontitle.cpp
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 #include "sectiontitle.h"
38 
39 SectionTitle::SectionTitle(QWidget *parent) : QFrame(parent)
40 {
41  //Create Frame and Section Title
42  sectionLabel = new QLabel(this);
43  sectionLabel->setText(tr("Test Section"));
44  sectionLabel->setObjectName(QString::fromUtf8("sectionTitle")); //styleSheet
45 
46  // Create a section line
47  line = new QFrame();
48  line->setObjectName(QString::fromUtf8("line"));
49  line->setMaximumHeight(3);
50  line->setMinimumHeight(3);
51  line->setFrameShape(QFrame::HLine);
52  line->setFrameShadow(QFrame::Sunken);
53 
54  //add line to Layout
55  sectionLayout = new QGridLayout(); //VBoxLayout();
56  sectionLayout->addWidget(sectionLabel,0,0);
57  sectionLayout->addWidget(line,1,0,1,2);
58  //sectionLayout->setSpacing(0);
59  sectionLayout->setMargin(0);
60 
61  this->setLayout(sectionLayout);
62  this->setContentsMargins(0,0,0,0);
63 }
64 
65 void SectionTitle::setTitle(QString s)
66 {
67  sectionLabel->setText(s);
68 }
69 
70 void SectionTitle::addWidget(QWidget *theWidget) {
71  sectionLayout->addWidget(theWidget, 0, 1);
72 }
void setTitle(QString)
SectionTitle(QWidget *parent=0)
void addWidget(QWidget *theWidget)