Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 05559564 authored by schultezub's avatar schultezub
Browse files

* fixed DataHandle's timestamp

 * fixed crashes in DataContainerInspectorWidget

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@264 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent aa806ada
......@@ -66,7 +66,6 @@ namespace TUMVis {
}
void DataContainerInspectorWidget::onDataContainerChanged() {
}
QSize DataContainerInspectorWidget::sizeHint() const {
......@@ -77,13 +76,20 @@ namespace TUMVis {
if (index.isValid()) {
// Yak, this is so ugly - another reason why GUI programming sucks...
QVariant item = index.data(Qt::UserRole);
DataHandle* ptr = static_cast<DataHandle*>(item.value<void*>());
_lblTimestamp->setText("Timestamp: " + QString::number(ptr->getTimestamp()));
// QModelIndex idxName(index.row(), 0, index.data(), index.model());
// QVariant name = idxName.data(Qt::DisplayRole);
// _lblName->setText("Name: " + name.toString());
delete _selectedDataHandle;
_selectedDataHandle = new DataHandle(*static_cast<DataHandle*>(item.value<void*>()));
QModelIndex idxName = index.sibling(index.row(), 0);
_selectedDataHandleName = idxName.data(Qt::DisplayRole).toString();
}
else {
delete _selectedDataHandle;
_selectedDataHandle = 0;
_selectedDataHandleName = "";
}
updateInfoWidget();
}
void DataContainerInspectorWidget::setupGUI() {
......@@ -106,9 +112,9 @@ namespace TUMVis {
_infoWidgetLayout->addWidget(_lblTimestamp);
_canvas = CtxtMgr.createContext("DataContainerInspector", "", tgt::ivec2(128, 128), tgt::GLCanvas::RGBA, _infoWidget);
_infoWidgetLayout->addWidget(_canvas);
_infoWidgetLayout->addWidget(_canvas, 1);
_mainLayout->addWidget(_infoWidget);
_mainLayout->addWidget(_infoWidget, 1);
connect(
_dctWidget, SIGNAL(clicked(const QModelIndex&)),
......@@ -116,7 +122,14 @@ namespace TUMVis {
}
void DataContainerInspectorWidget::updateInfoWidget() {
if (_selectedDataHandle != 0) {
_lblTimestamp->setText("Timestamp: " + QString::number(_selectedDataHandle->getTimestamp()));
_lblName->setText("Name: " + _selectedDataHandleName);
}
else {
_lblTimestamp->setText("Timestamp: ");
_lblName->setText("Name: ");
}
}
}
\ No newline at end of file
......@@ -40,10 +40,16 @@
#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QString>
class QModelIndex;
namespace tgt {
class Texture;
}
namespace TUMVis {
class AbstractPipeline;
class DataContainer;
class DataContainerTreeWidget;
class DataHandle;
......@@ -98,8 +104,9 @@ namespace TUMVis {
*/
void updateInfoWidget();
DataContainer* _dataContainer; ///< The DataContainer this widget is inspecting
DataContainer* _dataContainer; ///< The DataContainer this widget is inspecting
const DataHandle* _selectedDataHandle; ///< The currently selected DataHandle
QString _selectedDataHandleName; ///< The name of the currently selected DataHandle
DataContainerTreeWidget* _dctWidget; ///< The TreeWidget showing the DataHandles in _dataContainer
tgt::QtThreadedCanvas* _canvas; ///< The OpenGL canvas for rendering the DataContainer's contents
......
......@@ -209,7 +209,13 @@ namespace TUMVis {
}
void DataContainerTreeWidget::update(const DataContainer* dataContainer) {
// clear selection before setting the new data or we will encounter random crashes...
selectionModel()->clear();
// set new data
_treeModel->setData(dataContainer);
// adjust view
expandAll();
resizeColumnToContents(0);
resizeColumnToContents(1);
......
......@@ -269,6 +269,9 @@ namespace TUMVis {
}
void PipelineTreeWidget::update(const std::vector<AbstractPipeline*>& pipelines) {
// clear selection before setting the new data or we will encounter random crashes...
selectionModel()->clear();
_treeModel->setData(pipelines);
expandAll();
resizeColumnToContents(0);
......
......@@ -41,6 +41,7 @@ namespace TUMVis {
DataHandle::DataHandle(const DataHandle& rhs)
: _data(rhs._data)
, _timestamp(rhs._timestamp)
{
init();
}
......@@ -49,6 +50,7 @@ namespace TUMVis {
if (_data != rhs._data) {
AbstractData* oldData = _data;
_data = rhs._data;
_timestamp = rhs._timestamp;
init();
if (oldData) {
oldData->removeReference();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment