![]() ![]() chart () -> setAnimationOptions ( QChart. misTouching true // Turn off animations when handling gestures they // will only slow us down. So we need this safeguard // to block mouse events that are actually generated from touch. ![]() You just need to replace the final part for your special case. So // after this event we will get a mouse event also but we want // to handle touch events as gestures only. QChartView *chartView = new QChartView(chart) ĬhartView->setRenderHint(QPainter::Antialiasing) For instance, to display a line chart, you can do something like this: #include Ĭhart->setTitle("Simple line chart example") In your main file, you should always add QT_CHARTS_USE_NAMESPACE on top. Now, open your mainwindow.ui file or the file in which you want to insert the chart-view and follow the steps of the post you linked. Basically, open your project and add the Qt dependency: QT += charts Regarding your second problem, you don't edit your pro file in QtDesigner, you do it in QtCreator. You will find a combo-box where you can select the proper one. If you are compiling a desktop app, check that your default Kit or the one you are using is using the proper Qt Version. Check that you can see a modern version of Qt, QtCharts 2.0 was released with Qt 5.6.0, so that's your minimum version. ![]() Normally you should see the different versions of Qt that are installed. ![]() Note: Changing the theme will overwrite all customizations previously applied to the series. The Qml Oscilloscope example illustrates how to set a theme. If you are using QtCreator those are the steps to update your build system: A theme is a built-in collection of UI style related settings applied to all the visual elements of a chart, such as colors, pens, brushes, and fonts of series, as well as axes, title, and legend. QtChart is available only in modern versions of Qt. Here's a simple example of a chart in a popup which causes a crash on quit on my system (MacOS, running Qt 5.11)Īnd the stack trace from the crash: Thread 0 Crashed:: Dispatch queue: -threadĠ 0x0000000104be9ccb QQmlContextData::ContextGuard::objectDestroyed(QObject*) + 43ġ 0x0000000104bcc1c9 QQmlData::destroyed(QObject*) + 489Ģ 0x000000010512324f QObject::~QObject() + 319ģ libqtchartsqml2.dylib 0x000000010bae06f0 QQmlPrivate::QQmlElement::~QQmlElement() + 32Ĥ 0x0000000104a5ebf8 QV4::MemoryManager::sweep(bool, void (*)(char const*)) + 296ĥ 0x0000000104a5fb62 QV4::MemoryManager::~MemoryManager() + 66Ħ 0x0000000104ae4b57 QV4::ExecutionEngine::~ExecutionEngine() + 87ħ 0x0000000104adb057 QJSEngine::~QJSEngine() + 103Ĩ 0x0000000104bcd572 QQmlEngine::~QQmlEngine() + 370ĩ 0x000000010466aca3 main + 339 (main.cpp:17)ġ0 libdyld.That problems usually comes because you are configuring your project with a older version of qmake, frequenctly for Qt4. I don't think the crash actually requires a series of any sort. Here's a simplified version of the popup and chart: Popup The display of the data works as expected, but the app is crashing on quit. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |