From 84c156d3e2fcceeab608f401fbc638f2d01219b3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 29 Oct 2013 14:01:42 +0200 Subject: Selection overhaul MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selection modes are now proper flags, so you can easily mix and match item, row, and column modes as you wish. Slice flag means automatic slicing control - if user wishes to control slicing himself, he should not set this mode flag. Clicking an item on graph now emits clicked signal from renderer to controller on all graphs instead of setting the selected item. Controller will set the selected item based on this information. Task-number: QTRD-2366 Task-number: QTRD-2491 Change-Id: I6251c42e22ea676613fbd36685e33574e6eb9a1a Reviewed-by: Tomi Korpipää --- examples/itemmodel/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index fac6b442..5964992d 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -90,7 +90,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid m_tableWidget->setColumnCount(m_columnCount); // Set selection mode to full - m_graph->setSelectionMode(QDataVis::SelectionModeItemRowAndColumn); + m_graph->setSelectionMode(QDataVis::SelectionItemRowAndColumn); // Hide axis labels by explicitly setting one empty string as label list m_graph->rowAxis()->setCategoryLabels(QStringList(QString())); @@ -101,7 +101,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid //! [6] // Set selection mode to slice row - m_graph->setSelectionMode(QDataVis::SelectionModeSliceRow); + m_graph->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice); // Set font m_graph->setFont(QFont("Impact", 20)); @@ -222,7 +222,7 @@ void GraphDataGenerator::selectedFromTable(int currentRow, int currentColumn, { Q_UNUSED(previousRow) Q_UNUSED(previousColumn) - m_graph->setSelectedBarPos(QPoint(currentRow, currentColumn)); + m_graph->setSelectedBar(QPoint(currentRow, currentColumn)); } //! [14] @@ -273,7 +273,7 @@ int main(int argc, char **argv) //! [3] GraphDataGenerator generator(graph, tableWidget); - QObject::connect(graph, &Q3DBars::selectedBarPosChanged, &generator, + QObject::connect(graph, &Q3DBars::selectedBarChanged, &generator, &GraphDataGenerator::selectFromTable); QObject::connect(tableWidget, &QTableWidget::currentCellChanged, &generator, &GraphDataGenerator::selectedFromTable); -- cgit v1.2.3 From 999ffa01d20f75a457da62d41c0fabfc32e5e1bb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 11 Nov 2013 13:22:54 +0200 Subject: Basic multiseries support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2548 Change-Id: Iba324c0e8be56f2b3f8f6c6a992883c134a51a9d Reviewed-by: Tomi Korpipää Reviewed-by: Mika Salmela --- examples/itemmodel/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 5964992d..90bac03b 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -268,7 +269,8 @@ int main(int argc, char **argv) QItemModelBarDataMapping *mapping = new QItemModelBarDataMapping; mapping->setUseModelCategories(true); QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model(), mapping); - graph->setActiveDataProxy(proxy); + QBar3DSeries *series = new QBar3DSeries(proxy); + graph->addSeries(series); //! [2] //! [3] -- cgit v1.2.3 From 51d4a9fcba6089ba433ae126f554b50979220d07 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 15 Nov 2013 12:48:13 +0200 Subject: Multi series selection part 1: bars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2556 Change-Id: I1f537f0b4c299028d4415f074d5eac6552bb3b9b Reviewed-by: Pasi Keränen --- examples/itemmodel/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 90bac03b..3325d6a2 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -223,7 +223,7 @@ void GraphDataGenerator::selectedFromTable(int currentRow, int currentColumn, { Q_UNUSED(previousRow) Q_UNUSED(previousColumn) - m_graph->setSelectedBar(QPoint(currentRow, currentColumn)); + m_graph->seriesList().at(0)->setSelectedBar(QPoint(currentRow, currentColumn)); } //! [14] @@ -275,7 +275,7 @@ int main(int argc, char **argv) //! [3] GraphDataGenerator generator(graph, tableWidget); - QObject::connect(graph, &Q3DBars::selectedBarChanged, &generator, + QObject::connect(series, &QBar3DSeries::selectedBarChanged, &generator, &GraphDataGenerator::selectFromTable); QObject::connect(tableWidget, &QTableWidget::currentCellChanged, &generator, &GraphDataGenerator::selectedFromTable); -- cgit v1.2.3 From 3ce4ae10e54e9c5d73826f4d6f8c5e442ac2d525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Fri, 22 Nov 2013 07:56:04 +0200 Subject: User-modifiable themes, part 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2120 + old functionality remade - new functionality to be added + fixed a compilation error in qbarseries for mingw Change-Id: I710c97b5d4023861be8e8cc5cc61c05bb4644964 Signed-off-by: Tomi Korpipää --- examples/itemmodel/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 3325d6a2..0c9ee0cb 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -113,7 +114,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid //! [7] // Set theme - m_graph->setTheme(QDataVis::ThemeDigia); + m_graph->setTheme(new Q3DTheme(QDataVis::ThemeDigia)); // Set preset camera position m_graph->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetFront); -- cgit v1.2.3 From e029d0ea1d486dd3dbbfa4519a2125da202f22e4 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 25 Nov 2013 12:19:18 +0200 Subject: Change qreals to floats + Fix default axes to sensible + Fix some rounding errors in surface creation Task-number: QTRD-2622 Change-Id: I44450efc1e77ac8d8dbefc75814345949b8fb1f1 Reviewed-by: Mika Salmela --- examples/itemmodel/main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 0c9ee0cb..789ff0ff 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -78,7 +78,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid //! [5] // Set up bar specifications; make the bars as wide as they are deep, // and add a small space between them - m_graph->setBarThickness(1.0); + m_graph->setBarThickness(1.0f); m_graph->setBarSpacing(QSizeF(0.2, 0.2)); // Set bar type to flat pyramids @@ -161,11 +161,11 @@ void GraphDataGenerator::setupModel() weeks << "week 1" << "week 2" << "week 3" << "week 4" << "week 5"; // Set up data Mon Tue Wed Thu Fri Sat Sun - qreal hours[5][7] = {{2.0, 1.0, 3.0, 0.2, 1.0, 5.0, 10.0}, // week 1 - {0.5, 1.0, 3.0, 1.0, 2.0, 2.0, 3.0}, // week 2 - {1.0, 1.0, 2.0, 1.0, 4.0, 4.0, 4.0}, // week 3 - {0.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.3}, // week 4 - {3.0, 3.0, 6.0, 2.0, 2.0, 1.0, 1.0}}; // week 5 + float hours[5][7] = {{2.0f, 1.0f, 3.0f, 0.2f, 1.0f, 5.0f, 10.0f}, // week 1 + {0.5f, 1.0f, 3.0f, 1.0f, 2.0f, 2.0f, 3.0f}, // week 2 + {1.0f, 1.0f, 2.0f, 1.0f, 4.0f, 4.0f, 4.0f}, // week 3 + {0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.3f}, // week 4 + {3.0f, 3.0f, 6.0f, 2.0f, 2.0f, 1.0f, 1.0f}}; // week 5 //! [9] // Add labels @@ -205,7 +205,7 @@ void GraphDataGenerator::addRow() for (int i = 0; i < m_columnCount; i++) { QModelIndex index = m_tableWidget->model()->index(0, i); m_tableWidget->model()->setData(index, - ((qreal)i / (qreal)m_columnCount) / 2.0 + (qreal)(rand() % 30) / 100.0); + ((float)i / (float)m_columnCount) / 2.0f + (float)(rand() % 30) / 100.0f); } m_tableWidget->resizeColumnsToContents(); } -- cgit v1.2.3 From 7c942cc0f497fe7e61ce6a10fce45771c0858e09 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 26 Nov 2013 14:53:50 +0200 Subject: Integrated item model mappings to item model proxies Separate mapping object was redundant. Task-number: QTRD-2564 Change-Id: I6b1a23ba52dbb184f46df0fdd64184eeb145c0c3 Reviewed-by: Mika Salmela --- examples/itemmodel/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 789ff0ff..d6263c7c 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -266,10 +266,9 @@ int main(int argc, char **argv) //! [2] // Since we are dealing with QTableWidget, the model will already have data sorted properly - // in rows and columns, so create a mapping to utilize this. - QItemModelBarDataMapping *mapping = new QItemModelBarDataMapping; - mapping->setUseModelCategories(true); - QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model(), mapping); + // in rows and columns, so we simply set useModelCategories property to true to utilize this. + QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model()); + proxy->setUseModelCategories(true); QBar3DSeries *series = new QBar3DSeries(proxy); graph->addSeries(series); //! [2] -- cgit v1.2.3 From 5fde532408da5b6b3ddef13aff5e07f32015e7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 28 Nov 2013 06:40:59 +0200 Subject: Visual properties moved to theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2632 Change-Id: I91eaa8fa26e232de24fe89ef0c8a2fc53f31fb8c Reviewed-by: Tomi Korpipää --- examples/itemmodel/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index d6263c7c..1ee6ca25 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -105,9 +105,6 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid // Set selection mode to slice row m_graph->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice); - // Set font - m_graph->setFont(QFont("Impact", 20)); - //! [6] #endif @@ -116,6 +113,9 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid // Set theme m_graph->setTheme(new Q3DTheme(QDataVis::ThemeDigia)); + // Set font + m_graph->theme()->setFont(QFont("Impact", 20)); + // Set preset camera position m_graph->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetFront); //! [7] -- cgit v1.2.3 From 527113321ff103835b89543c5d6f670f55b5b0d5 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 28 Nov 2013 08:19:37 +0200 Subject: Move series specific visual elements to series, part 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Meshes moved to series. Task-number: QTRD-2557 Change-Id: I80050e413faf3bc942eb5a5627a66747de5805d8 Reviewed-by: Tomi Korpipää --- examples/itemmodel/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 1ee6ca25..708fd723 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -80,10 +80,6 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid // and add a small space between them m_graph->setBarThickness(1.0f); m_graph->setBarSpacing(QSizeF(0.2, 0.2)); - - // Set bar type to flat pyramids - m_graph->setBarType(QDataVis::MeshStylePyramids, false); - //! [5] #ifndef USE_STATIC_DATA @@ -270,6 +266,7 @@ int main(int argc, char **argv) QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model()); proxy->setUseModelCategories(true); QBar3DSeries *series = new QBar3DSeries(proxy); + series->setMesh(QAbstract3DSeries::MeshPyramid); graph->addSeries(series); //! [2] -- cgit v1.2.3 From 94235c2e633845951ce6c947965789bb3f8ee7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Mon, 2 Dec 2013 08:43:02 +0200 Subject: Theme documented Task-number: QTRD-2633 Change-Id: Ib274ec236f50145df8fd4c2d83f62d4a9154687a Reviewed-by: Miikka Heikkinen --- examples/itemmodel/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 708fd723..3d06f5c1 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -107,7 +107,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid //! [7] // Set theme - m_graph->setTheme(new Q3DTheme(QDataVis::ThemeDigia)); + m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeDigia)); // Set font m_graph->theme()->setFont(QFont("Impact", 20)); -- cgit v1.2.3 From a665bdb2010c3833f47d364945007cccc00aed2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 5 Dec 2013 11:26:25 +0200 Subject: QML docs + enum moving Task-number: QTRD-2670 Task-number: QTRD-2505 Change-Id: I51a870f9a57b093e8216759a5577e161ff3afd60 Reviewed-by: Miikka Heikkinen --- examples/itemmodel/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 3d06f5c1..533264d8 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -113,7 +113,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid m_graph->theme()->setFont(QFont("Impact", 20)); // Set preset camera position - m_graph->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetFront); + m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront); //! [7] } -- cgit v1.2.3 From fd5507d50bff7e139865e4d6478910ba8ce36d20 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 12 Dec 2013 12:43:04 +0200 Subject: Fix customproxy and itemmodel examples docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2635 Change-Id: Ibb187e5cf05efc6d7afa6ec03372346d08addc82 Reviewed-by: Tomi Korpipää --- examples/itemmodel/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/itemmodel/main.cpp') diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp index 533264d8..46aa8bb8 100644 --- a/examples/itemmodel/main.cpp +++ b/examples/itemmodel/main.cpp @@ -169,7 +169,6 @@ void GraphDataGenerator::setupModel() m_graph->rowAxis()->setTitle("Week of year"); m_graph->columnAxis()->setTitle("Day of week"); m_graph->valueAxis()->setTitle("Hours spent on the Internet"); - m_graph->valueAxis()->setSegmentCount(5); m_graph->valueAxis()->setLabelFormat("%.1f h"); //! [10] @@ -262,7 +261,7 @@ int main(int argc, char **argv) //! [2] // Since we are dealing with QTableWidget, the model will already have data sorted properly - // in rows and columns, so we simply set useModelCategories property to true to utilize this. + // into rows and columns, so we simply set useModelCategories property to true to utilize this. QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model()); proxy->setUseModelCategories(true); QBar3DSeries *series = new QBar3DSeries(proxy); -- cgit v1.2.3