Qt&Vtk-030-Theme

简介: Qt&Vtk-030-Theme

image.png摘要

1 官方示例展示


接着搬运,搬运到后面真的不是不想在手撸了,开启Ctrl+C Ctrl+V的节奏,官方示例演示如下image.png

#ifndef THEME_H
#define THEME_H
#include <QWidget>
#include "vtkGraphLayoutView.h"
#include "vtkRandomGraphSource.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkViewTheme.h"
namespace Ui {
class Theme;
}
class Theme : public QWidget
{
    Q_OBJECT
public:
    explicit Theme(QWidget *parent = 0);
    ~Theme();
private:
    Ui::Theme *ui;
    vtkRandomGraphSource* source = nullptr;
    vtkGraphLayoutView* view = nullptr;
    vtkViewTheme* theme = nullptr;
};
#endif // THEME_H

2.2 theme.cpp


#include "theme.h"
#include "ui_theme.h"
Theme::Theme(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Theme)
{
    ui->setupUi(this);
    source = vtkRandomGraphSource::New();
    view = vtkGraphLayoutView::New();
    view->SetRepresentationFromInputConnection(source->GetOutputPort());
    theme = vtkViewTheme::CreateMellowTheme();
    view->ApplyViewTheme(theme);
    theme->Delete();
    view->SetRenderWindow(ui->widget->GetRenderWindow());
    view->SetVertexColorArrayName("VertexDegree");
    view->SetColorVertices(true);
    view->SetVertexLabelArrayName("VertexDegree");
    view->SetVertexLabelVisibility(true);
    view->ResetCamera();
    view->Render();
}
Theme::~Theme()
{
    delete ui;
}

image.pngimage.png

目录
相关文章
|
前端开发 JavaScript C++
打造卓越 QML 层级设计:从入门到精通(一)
打造卓越 QML 层级设计:从入门到精通
3496 1
|
运维 监控 网络协议
QT实现TCP通信:从基础到高级的全面解析
QT实现TCP通信:从基础到高级的全面解析
1792 0
|
网络协议
Qt中的网络编程(Tcp和Udp)运用详解以及简单示范案例
Tcp和Udp是我们学习网络编程中经常接触到的两个通讯协议,在Qt也被Qt封装成了自己的库供我们调用,对于需要进行网络交互的项目中无疑是很重要的,希望这篇文章可以帮助到大家。 是关于Qt中TCP和UDP的基本使用和特点:
1849 7
|
算法 API 图形学
【Qt 学习笔记】QWidget的geometry属性及window frame的影响
【Qt 学习笔记】QWidget的geometry属性及window frame的影响
971 2
|
C++ 容器
[Qt5] QT+VS读取dwg文件
[Qt5] QT+VS读取dwg文件
395 0
|
监控 算法 安全
【Qt 应用开发】Qt 中的信息输出机制:QDebug、QInfo、QWarning、QCritical 的简单介绍和用法
【Qt 应用开发】Qt 中的信息输出机制:QDebug、QInfo、QWarning、QCritical 的简单介绍和用法
1719 1
|
XML 数据格式 C++
Visual Studio 2019 设置 doxygen 注释颜色
VS 中如何修改 doxygen 格式注释的颜色
472 0
Visual Studio 2019 设置 doxygen 注释颜色
|
数据处理 调度 开发者
QML多线程魔法:探索不同方法,提升性能
QML多线程魔法:探索不同方法,提升性能
1594 0
QT隐藏窗口标题栏、最大化、最小化、关闭按钮
QT隐藏窗口标题栏、最大化、最小化、关闭按钮
1833 0