widget.cpp
61 lines
| 2.4 KiB
| text/x-c
|
CppLexer
Marek Rosa
|
r2229 | #include "widget.h" | ||
#include <QDir> | ||||
#include <QGridLayout> | ||||
#include <QApplication> | ||||
Marek Rosa
|
r2252 | #include "graphicsbutton.h" | ||
Marek Rosa
|
r2229 | |||
Widget::Widget(QWidget *parent) | ||||
Marek Rosa
|
r2254 | : QWidget(parent) | ||
Marek Rosa
|
r2229 | { | ||
Marek Rosa
|
r2252 | setMinimumSize(200, 200); | ||
Marek Rosa
|
r2254 | m_appFolder = QDir(QApplication::applicationDirPath()); | ||
Tero Ahola
|
r2239 | #ifdef Q_OS_MAC | ||
Tero Ahola
|
r2237 | // The executable is inside an application bundle (a folder) on OSX | ||
m_appFolder.cdUp(); | ||||
m_appFolder.cdUp(); | ||||
m_appFolder.cdUp(); | ||||
#endif | ||||
Marek Rosa
|
r2252 | |||
QDir imageFolder = m_appFolder; | ||||
imageFolder.cdUp(); | ||||
imageFolder.cdUp(); | ||||
Marek Rosa
|
r2254 | imageFolder.cd("doc"); | ||
imageFolder.cd("images"); | ||||
Marek Rosa
|
r2232 | |||
Tero Ahola
|
r2237 | // Create push buttons for starting the executables | ||
Marek Rosa
|
r2229 | QGridLayout* demosLayout = new QGridLayout; | ||
Marek Rosa
|
r2252 | |||
Marek Rosa
|
r2254 | GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "demos_audio.png", m_appFolder, "audio", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 0, 0); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_callout.png", m_appFolder, "callout", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 0, 1); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demo_chartthemes_blue_cerulean.png", m_appFolder, "chartthemes", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 0, 2); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demos_nesteddonuts.png", m_appFolder, "nesteddonuts", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 1, 0); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_zoomlinechart1.png", m_appFolder, "zoomlinechart", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 1, 1); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_stackedbarchartdrilldown1.png", m_appFolder, "stackedbarchartdrilldown", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 1, 2); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"piechart_customization.png", m_appFolder, "piechartcustomization", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 2, 0); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_datetimeaxis.png", m_appFolder, "datetimeaxis", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 2, 1); | ||
Marek Rosa
|
r2254 | button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_donutbreakdown.png", m_appFolder, "donutbreakdown", this); | ||
Marek Rosa
|
r2252 | demosLayout->addWidget(button, 2, 2); | ||
Marek Rosa
|
r2229 | setLayout(demosLayout); | ||
} | ||||
Widget::~Widget() | ||||
Marek Rosa
|
r2254 | { | ||
Marek Rosa
|
r2252 | } | ||