本文整理汇总了C++中QAbstractItemView::setModel方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemView::setModel方法的具体用法?C++ QAbstractItemView::setModel怎么用?C++ QAbstractItemView::setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemView
的用法示例。
在下文中一共展示了QAbstractItemView::setModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pixmap
//.........这里部分代码省略.........
m_pointView, SLOT(toggleDrawCursor()));
connect(drawAxes, SIGNAL(triggered()),
m_pointView, SLOT(toggleDrawAxes()));
connect(drawGrid, SIGNAL(triggered()),
m_pointView, SLOT(toggleDrawGrid()));
connect(drawAnnotations, SIGNAL(triggered()),
m_pointView, SLOT(toggleDrawAnnotations()));
connect(trackballMode, SIGNAL(triggered()),
m_pointView, SLOT(toggleCameraMode()));
connect(m_geometries, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(geometryRowsInserted(QModelIndex,int,int)));
//--------------------------------------------------
// Docked widgets
// Shader parameters UI
QDockWidget* shaderParamsDock = new QDockWidget(tr("Shader Parameters"), this);
shaderParamsDock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable);
QWidget* shaderParamsUI = new QWidget(shaderParamsDock);
shaderParamsDock->setWidget(shaderParamsUI);
m_pointView->setShaderParamsUIWidget(shaderParamsUI);
// Shader editor UI
QDockWidget* shaderEditorDock = new QDockWidget(tr("Shader Editor"), this);
shaderEditorDock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetFloatable);
QWidget* shaderEditorUI = new QWidget(shaderEditorDock);
m_shaderEditor = new ShaderEditor(shaderEditorUI);
QGridLayout* shaderEditorLayout = new QGridLayout(shaderEditorUI);
shaderEditorLayout->setContentsMargins(2,2,2,2);
shaderEditorLayout->addWidget(m_shaderEditor, 0, 0, 1, 1);
connect(editShaderAct, SIGNAL(triggered()), shaderEditorDock, SLOT(show()));
shaderEditorDock->setWidget(shaderEditorUI);
shaderMenu->addAction(m_shaderEditor->compileAction());
connect(m_shaderEditor->compileAction(), SIGNAL(triggered()),
this, SLOT(compileShaderFile()));
// TODO: check if this is needed - test shader update functionality
//connect(m_shaderEditor, SIGNAL(sendShader(QString)),
// &m_pointView->shaderProgram(), SLOT(setShader(QString)));
// Log viewer UI
QDockWidget* logDock = new QDockWidget(tr("Log"), this);
logDock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable);
QWidget* logUI = new QWidget(logDock);
m_logTextView = new LogViewer(logUI);
m_logTextView->setReadOnly(true);
m_logTextView->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_logTextView->connectLogger(&g_logger); // connect to global logger
m_progressBar = new QProgressBar(logUI);
m_progressBar->setRange(0,100);
m_progressBar->setValue(0);
m_progressBar->hide();
connect(m_fileLoader, SIGNAL(loadStepStarted(QString)),
this, SLOT(setProgressBarText(QString)));
connect(m_fileLoader, SIGNAL(loadProgress(int)),
m_progressBar, SLOT(setValue(int)));
connect(m_fileLoader, SIGNAL(resetProgress()),
m_progressBar, SLOT(hide()));
QVBoxLayout* logUILayout = new QVBoxLayout(logUI);
//logUILayout->setContentsMargins(2,2,2,2);
logUILayout->addWidget(m_logTextView);
logUILayout->addWidget(m_progressBar);
//m_logTextView->setLineWrapMode(QPlainTextEdit::NoWrap);
logDock->setWidget(logUI);
// Data set list UI
QDockWidget* dataSetDock = new QDockWidget(tr("Data Sets"), this);
dataSetDock->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetFloatable);
DataSetUI* dataSetUI = new DataSetUI(this);
dataSetDock->setWidget(dataSetUI);
QAbstractItemView* dataSetOverview = dataSetUI->view();
dataSetOverview->setModel(m_geometries);
connect(dataSetOverview, SIGNAL(doubleClicked(const QModelIndex&)),
m_pointView, SLOT(centerOnGeometry(const QModelIndex&)));
m_pointView->setSelectionModel(dataSetOverview->selectionModel());
// Set up docked widgets
addDockWidget(Qt::RightDockWidgetArea, shaderParamsDock);
addDockWidget(Qt::LeftDockWidgetArea, shaderEditorDock);
addDockWidget(Qt::RightDockWidgetArea, logDock);
addDockWidget(Qt::RightDockWidgetArea, dataSetDock);
tabifyDockWidget(logDock, dataSetDock);
logDock->raise();
shaderEditorDock->setVisible(false);
// Add dock widget toggles to view menu
viewMenu->addSeparator();
viewMenu->addAction(shaderParamsDock->toggleViewAction());
viewMenu->addAction(logDock->toggleViewAction());
viewMenu->addAction(dataSetDock->toggleViewAction());
// Create custom hook events from CLI at runtime
m_hookManager = new HookManager(this);
}