diff --git a/demos/chartviewer/main.cpp b/demos/chartviewer/main.cpp index 0443e22..a68c2d8 100644 --- a/demos/chartviewer/main.cpp +++ b/demos/chartviewer/main.cpp @@ -21,6 +21,7 @@ #include "window.h" #include #include +#include QVariantHash parseArgs(QStringList args) { @@ -54,10 +55,29 @@ QVariantHash parseArgs(QStringList args) return parameters; } +void printHelp() +{ + std::cout << "chartviewer "<< std::endl; + std::cout << " --view <1/2/3/4> - set size of charts' grid" << std::endl; + std::cout << " --chart - set template to be show " << std::endl; + std::cout << " --opengl - set opengl mode" << std::endl; + std::cout << " --theme - set theme" << std::endl; + std::cout << " --legend - set legend alignment" << std::endl; + std::cout << " --help - prints this help" << std::endl; + std::cout << "Examples: " << std::endl; + std::cout << " chartviewer --view 4 --chart Axis" << std::endl; + std::cout << " chartviewer --view 1 --chart Axis::BarCategoryAxis::Axis " << std::endl; +} + int main(int argc, char *argv[]) { QApplication a(argc, argv); QVariantHash parameters = parseArgs(QApplication::arguments()); + if(parameters.contains("help")) + { + printHelp(); + return 0; + } Window window(parameters); window.show(); return a.exec(); diff --git a/demos/chartviewer/window.cpp b/demos/chartviewer/window.cpp index 4d2d678..876ab7a 100644 --- a/demos/chartviewer/window.cpp +++ b/demos/chartviewer/window.cpp @@ -214,8 +214,8 @@ QComboBox *Window::createTempleteBox() void Window::initializeFromParamaters(const QVariantHash ¶meters) { - if (parameters.contains("template")) { - QString t = parameters["template"].toString(); + if (parameters.contains("chart")) { + QString t = parameters["chart"].toString(); for (int i = 0; i < m_templateComboBox->count(); ++i) { if (m_templateComboBox->itemText(i) == t) { m_templateComboBox->setCurrentIndex(i);