Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/groups/mainwindow_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MainWindow::MainWindow() : QMainWindow()
[a, b, c](const auto x) { return 5.0 + a * sin(x) + b * sin(2.0 * x) - c * sin(3.0 * x); });

// Create a renderable and add it to the group
auto *renderable = ui_.TestingWidget->addData1D(std::string("Sines") + std::to_string(n));
auto *renderable = ui_.TestingWidget->addData1D(QString("Sines%1").arg(n));
renderable->setData(xValues, y);

renderable->colour().set({int(255 * dist(gen)), int(255 * dist(gen)), int(255 * dist(gen)), 255});
Expand Down
4 changes: 2 additions & 2 deletions src/entities/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DataEntity : public Qt3DCore::QEntity
*/
protected:
// Display name for entity
std::string displayName_;
QString displayName_;
// Extrema of data points in three-dimensional space
Cuboid extrema_;
// Extrema of data points in three-dimensional logarithmic space
Expand Down Expand Up @@ -112,4 +112,4 @@ class DataEntity : public Qt3DCore::QEntity
// Recreate renderables following metric / axis change
void updateRenderables();
};
} // namespace Mildred
} // namespace Mildred
6 changes: 3 additions & 3 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ namespace Mildred
namespace Version
{
// Return version
std::string_view version() { return MILDREDVERSION; }
QString version() { return MILDREDVERSION; }
// Return short hash
std::string_view shortHash() { return MILDREDSHORTHASH; }
QString shortHash() { return MILDREDSHORTHASH; }
// Return repo url
std::string_view repoUrl() { return MILDREDREPO; }
QString repoUrl() { return MILDREDREPO; }
}; // namespace Version
}; // namespace Mildred
6 changes: 3 additions & 3 deletions src/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ RenderableMaterial *MildredWidget::createMaterial(Qt3DCore::QEntity *parent, Ren
}

// Add new 1-dimensional data entity for supplied data
Data1DEntity *MildredWidget::addData1D(std::string_view tag)
Data1DEntity *MildredWidget::addData1D(const QString &tag)
{
// Check for existing tag
auto it = std::find_if(dataEntities_.begin(), dataEntities_.end(), [tag](const auto &d) { return tag == d.first; });
if (it != dataEntities_.end())
{
printf("Data with tag '%s' already exists, so can't add it again.\n", it->first.c_str());
qDebug() << QString("Data with tag '%1' already exists, so can't add it again.\n").arg(it->first);
throw(std::runtime_error("Duplicate DataEntity tag created.\n"));
}

Expand Down Expand Up @@ -214,4 +214,4 @@ DisplayGroup *MildredWidget::addDisplayGroup()
auto newGroup = displayGroups_.emplace_back(std::make_shared<DisplayGroup>());

return newGroup.get();
}
}
6 changes: 3 additions & 3 deletions src/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class MildredWidget : public QWidget
*/
private:
// Associated data entities (with identifying tag)
std::vector<std::pair<std::string, DataEntity *>> dataEntities_;
std::vector<std::pair<QString, DataEntity *>> dataEntities_;

private:
// Create material for specified entity
Expand All @@ -205,7 +205,7 @@ class MildredWidget : public QWidget

public:
// Add new data entity for supplied data
Data1DEntity *addData1D(std::string_view tag);
Data1DEntity *addData1D(const QString &tag);

/*
* Grouping
Expand All @@ -218,4 +218,4 @@ class MildredWidget : public QWidget
// Create new display group
DisplayGroup *addDisplayGroup();
};
} // namespace Mildred
} // namespace Mildred
Loading