Skip to content

Commit b9aea43

Browse files
author
Haris Kapidzic
committed
change color, remove left mouse click from toolbar
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8279 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 2f673af commit b9aea43

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

OMPlot/OMPlotGUI/Legend.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ void Legend::legendMenu(const QPoint& pos)
5353
{
5454
QwtLegendItem *lgdItem = dynamic_cast<QwtLegendItem*>(childAt(pos));
5555

56+
if(lgdItem)
57+
{
58+
5659
QAction *color = new QAction(QString("Change Color"), this);
5760
color->setCheckable(false);
5861
connect(color, SIGNAL(triggered()), this, SLOT(selectColor()));
@@ -65,11 +68,10 @@ void Legend::legendMenu(const QPoint& pos)
6568
hide->setCheckable(false);
6669
connect(hide, SIGNAL(triggered()), this, SLOT(toggleShow()));
6770

68-
if(lgdItem)
69-
{
71+
7072
legendItem = lgdItem->text().text();
7173

72-
QMenu menu(mpPlot);
74+
QMenu menu(mpPlot);
7375
menu.addAction(color);
7476
menu.addSeparator();
7577
menu.addAction(hide);

OMPlot/OMPlotGUI/PlotWindow.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,51 +51,40 @@ PlotWindow::PlotWindow(QStringList arguments, QWidget *parent)
5151
// open the file
5252
openFile(QString(arguments[1]));
5353

54-
//Set up arguments
55-
// read the title
54+
//Set up arguments
5655
setTitle(QString(arguments[2]));
57-
// read the legend
5856
if(QString(arguments[3]) == "true")
5957
setLegend(true);
6058
else if(QString(arguments[3]) == "false")
6159
setLegend(false);
6260
else
6361
throw PlotException("Invalid input");
64-
// read the grid
6562
if(QString(arguments[4]) == "true")
6663
setGrid(true);
6764
else if(QString(arguments[4]) == "false")
6865
setGrid(false);
6966
else
7067
throw PlotException("Invalid input");
71-
// read the plot type
7268
QString plotType = arguments[5];
73-
// read the logx
7469
if(QString(arguments[6]) == "true")
7570
setLogX(true);
7671
else if(QString(arguments[6]) == "false")
7772
setLogX(false);
7873
else
7974
throw PlotException("Invalid input");
80-
// read the logy
8175
if(QString(arguments[7]) == "true")
8276
setLogY(true);
8377
else if(QString(arguments[7]) == "false")
8478
setLogY(false);
8579
else
8680
throw PlotException("Invalid input");
87-
// read the x label value
8881
setXLabel(QString(arguments[8]));
89-
// read the y label value
9082
setYLabel(QString(arguments[9]));
91-
// read the x range
9283
setXRange(QString(arguments[10]).toDouble(), QString(arguments[11]).toDouble());
93-
// read the y range
9484
setYRange(QString(arguments[12]).toDouble(), QString(arguments[13]).toDouble());
95-
// read the variables name
9685
QStringList variablesToRead;
9786
for(int i = 14; i < arguments.length(); i++)
98-
variablesToRead.append(QString(arguments[i]));
87+
variablesToRead.append(QString(arguments[i]));
9988

10089
//Plot
10190
if(plotType == "plot")
@@ -162,19 +151,18 @@ void PlotWindow::openFile(QString file)
162151
void PlotWindow::setupToolbar()
163152
{
164153
QToolBar *toolBar = new QToolBar(this);
165-
toolBar->setAutoFillBackground(true);
166-
toolBar->setPalette(QPalette(Qt::gray));
154+
setContextMenuPolicy(Qt::NoContextMenu);
167155

168-
//ZOOM
169-
mpZoomButton = new QToolButton(toolBar);
156+
// //ZOOM
157+
mpZoomButton = new QToolButton(toolBar);
170158
mpZoomButton->setText("Zoom");
171-
mpZoomButton->setCheckable(true);
159+
mpZoomButton->setCheckable(true);
172160
connect(mpZoomButton, SIGNAL(toggled(bool)), SLOT(enableZoomMode(bool)));
173161
toolBar->addWidget(mpZoomButton);
174162

175163
toolBar->addSeparator();
176164

177-
//PAN
165+
// //PAN
178166
mpPanButton = new QToolButton(toolBar);
179167
mpPanButton->setText("Pan");
180168
mpPanButton->setCheckable(true);
@@ -392,7 +380,7 @@ void PlotWindow::plot(QStringList variables)
392380
double stopTime = omc_matlab4_stopTime(&reader);
393381
if (reader.nvar < 1)
394382
throw NoVariableException("Variable doesnt exist: time");
395-
double *timeVals = omc_matlab4_read_vals(&reader,0);
383+
double *timeVals = omc_matlab4_read_vals(&reader,0);
396384

397385
if(variables[0] == "")
398386
{

OMPlot/OMPlotGUI/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ int main(int argc, char *argv[])
4242
printf("Usage: %s arg1 ... arg13 variables\n", *argv);
4343
return 1;
4444
}
45-
QApplication a(argc, argv);
46-
a.setWindowIcon(QIcon(":/Resources/plotWindow.bmp"));
45+
QApplication a(argc, argv);
4746

4847
try {
4948
QStringList arguments;

0 commit comments

Comments
 (0)