Bug Summary

File:OMOptim/OMOptimBasis/build/../GUI/Tabs/MO2ColTab.cpp
Warning:line 125, column 10
Value stored to 'ok' during its initialization is never read

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1// $Id$
2/**
3 * This file is part of OpenModelica.
4 *
5 * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
6 * c/o Linköpings universitet, Department of Computer and Information Science,
7 * SE-58183 Linköping, Sweden.
8 *
9 * All rights reserved.
10 *
11 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
12 * THIS OSMC PUBLIC LICENSE (OSMC-PL).
13 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
14 * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the Open Source Modelica
17 * Consortium (OSMC) Public License (OSMC-PL) are obtained
18 * from OSMC, either from the above address,
19 * from the URLs: http://www.ida.liu.se/projects/OpenModelica or
20 * http://www.openmodelica.org, and in the OpenModelica distribution.
21 * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
22 *
23 * This program is distributed WITHOUT ANY WARRANTY; without
24 * even the implied warranty of MERCHANTABILITY or FITNESS
25 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
26 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
27 *
28 * See the full OSMC Public License conditions for more details.
29 *
30 * Main contributor 2010, Hubert Thierot, CEP - ARMINES (France)
31 * Main contributor 2010, Hubert Thierot, CEP - ARMINES (France)
32
33 @file MO2ColTab.cpp
34 @brief Comments for file documentation.
35 @author Hubert Thieriot, hubert.thieriot@mines-paristech.fr
36 Company : CEP - ARMINES (France)
37 http://www-cep.ensmp.fr/english/
38 @version
39*/
40
41#include "Tabs/MO2ColTab.h"
42
43MO2ColTab::MO2ColTab(QString _projectName,MOItem* _mainItem,bool _closable,QWidget *parent)
44 :MOTabCplx(_projectName,_mainItem,parent)
45{
46
47 closable = _closable;
48
49 if(closable)
50 {
51 dispTB = new QToolBar();
52 dispTB->setOrientation(Qt::Vertical);
53 addToolBar(Qt::LeftToolBarArea,dispTB);
54 }
55
56
57}
58
59MO2ColTab::~MO2ColTab(void)
60{
61
62}
63
64void MO2ColTab::addDockWidget(QString title,QWidget* widget,QWidget *tabifiedOn,Qt::DockWidgetArea dockWidgetArea)
65{
66
67 // Widget
68 QDockWidget* dockWidget = new QDockWidget(title,this);
69 dockWidget->setObjectName(title);
70 dockWidget->setSizePolicy(widget->sizePolicy());
71 dockWidget->setTitleBarWidget(new QWidget(this));
72
73 if(closable)
74 dockWidget->setFeatures(QDockWidget::DockWidgetClosable /*| QDockWidget::DockWidgetMovable*/ | QDockWidget::DockWidgetFloatable);
75 else
76 dockWidget->setFeatures(/*QDockWidget::DockWidgetMovable |*/ QDockWidget::DockWidgetFloatable);
77
78 //dockWidget->setLayout(new QGridLayout());
79 dockWidget->setWidget(widget);
80 dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
81
82 //dockWidget->setStyleSheet("border-width: 1px;\n border-style: solid;\n border-color: gray;");
83 QMainWindow::addDockWidget(dockWidgetArea,dockWidget);
84
85
86 // Tabify
87 if(tabifiedOn && mapDockWidgets.key(tabifiedOn,NULL__null))
88 tabifyDockWidget(mapDockWidgets.key(tabifiedOn),dockWidget);
89
90
91 dockWidget->show();
92
93 // QAction
94 if(closable)
95 {
96 QAction* action = dockWidget->toggleViewAction();
97 dispTB->addAction(action);
98 }
99
100 mapDockWidgets.insert(dockWidget,widget);
101 bool ok = restoreDockWidget(dockWidget);
102}
103void MO2ColTab::addFixedWidget(QString title,QWidget* widget,Qt::DockWidgetArea dockArea,Qt::Orientation orientation,bool showTitle)
104{
105
106 // Widget
107 QDockWidget* dockWidget = new QDockWidget(title,this);
108 dockWidget->setObjectName(title);
109 dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
110 dockWidget->setLayout(new QGridLayout());
111 dockWidget->setWidget(widget);
112 dockWidget->setSizePolicy(widget->sizePolicy());
113
114 if(!showTitle)
115 {
116 // to hide the title bar completely must replace the default widget with a generic one
117 QWidget* titleWidget = new QWidget(dockWidget);
118 dockWidget->setTitleBarWidget( titleWidget );
119 }
120
121 QMainWindow::addDockWidget(dockArea,dockWidget,orientation);
122 widget->show();
123 dockWidget->show();
124 mapDockWidgets.insert(dockWidget,widget);
125 bool ok = restoreDockWidget(dockWidget);
Value stored to 'ok' during its initialization is never read
126}
127
128void MO2ColTab::setWidgetVisible(QWidget* _widget,bool _visible)
129{
130 QDockWidget* dock = mapDockWidgets.key(_widget,NULL__null);
131 if(dock)
132 dock->setVisible(_visible);
133}