Skip to content

Commit 12759c3

Browse files
committed
Added Bar Graph widget
FInally finished bar graph widget, with a lot of customisation. There are 3 main types of bar charts: Normal, Stacked and percentage. Where all thre can be turned horizontal Also you can customise theme, animation, labels and legends.
1 parent 3357dcf commit 12759c3

File tree

11 files changed

+1081
-43
lines changed

11 files changed

+1081
-43
lines changed

icons.qrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
<file>images/view-statistics.png</file>
2323
<file>images/transform-move.png</file>
2424
<file>images/system-lock-screen.png</file>
25+
<file>images/format-text-bold.png</file>
26+
<file>images/format-text-italic.png</file>
27+
<file>images/format-text-underline.png</file>
2528
</qresource>
2629
</RCC>

images/format-text-bold.png

1.69 KB
Loading

images/format-text-italic.png

1.33 KB
Loading

images/format-text-underline.png

1.44 KB
Loading

mainwindow.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ void MainWindow::addLineGraph()
406406

407407
LineGraph* plot = new LineGraph(this);
408408
plot->setId( QString("P%1").arg(widgets.size()) );
409-
ui->mdiArea->addSubWindow(plot);
409+
QMdiSubWindow *subWindow = ui->mdiArea->addSubWindow(plot);
410+
subWindow->setWindowIcon( QIcon("://images/graph.png") );
410411

411412
plot->show();
412413

@@ -423,7 +424,8 @@ void MainWindow::addBarGraph()
423424

424425
BarGraph* barGraph = new BarGraph(this);
425426
barGraph->setId( QString("P%1").arg(widgets.size()) );
426-
ui->mdiArea->addSubWindow(barGraph);
427+
QMdiSubWindow *subWindow = ui->mdiArea->addSubWindow(barGraph);
428+
subWindow->setWindowIcon( QIcon("://images/view-statistics.png") );
427429

428430
barGraph->show();
429431

@@ -555,21 +557,23 @@ void MainWindow::parseData(QByteArray data)
555557

556558
QString tempStr( data.mid(1,data.size()-4) );
557559

560+
// qDebug() << tempStr;
561+
558562
//verify that it is a valid packet!
559563
// QRegExp rx_timeplot("[a-zA-Z0-9]+(\\|[a-zA-Z0-9 ]+\\|\\d{1,3},\\d{1,3},\\d{1,3}\\|\\-*\\d+(\\.{0,1}\\d+)*)+");
560564
// QRegExp rx_xy_plot("[a-zA-Z0-9]+\\|[a-zA-Z0-9 ]+\\|\\d{1,3},\\d{1,3},\\d{1,3}\\|(\\-*\\d+\\s\\-*\\d+\\s*)+");
561565
// if(!LineGraph::validPacket(tempStr))
562566
if(!Helper::validPacket(tempStr))
563567
{
564-
qDebug() << "Packets dropped: " << packetsDropped;
565568
packetsDropped++;
569+
qDebug() << "Packets dropped: " << packetsDropped;
566570
return;
567571
// break;
568572
}
569573

570574
QStringList cmd = tempStr.split("|");
571575

572-
//qDebug() << cmd;
576+
// qDebug() << cmd;
573577

574578
foreach(AbstractWidget* plot, widgets)
575579
{

mainwindow.ui

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
</property>
7070
<addaction name="actionAdd_Graph"/>
7171
<addaction name="actionAdd_Bar_Graph"/>
72-
<addaction name="actionAdd_Map"/>
7372
</widget>
7473
<widget class="QMenu" name="menuHelp">
7574
<property name="title">
@@ -115,7 +114,6 @@
115114
<addaction name="separator"/>
116115
<addaction name="actionAdd_Graph"/>
117116
<addaction name="actionAdd_Bar_Graph"/>
118-
<addaction name="actionAdd_Map"/>
119117
<addaction name="separator"/>
120118
<addaction name="actionLockWidgets"/>
121119
<addaction name="actionSettings"/>

widgets/abstractwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class AbstractWidget : public QWidget
99
{
10-
public:
10+
public:
1111
AbstractWidget(QWidget *parent);
1212
virtual void reset() = 0;
1313
virtual void serialPacket(QStringList packet) = 0;

0 commit comments

Comments
 (0)