程序示例精选
VS+QT+PCL点云窗体程序显示编辑保存
如需安装运行环境或远程调试,可点击 博主头像进入个人主页查看博主联系方式,由专业技术人员远程协助!
前言
这篇博客针对《VS+QT+PCL点云窗体程序显示编辑保存》编写代码,代码整洁,规则,易读。 学习与应用推荐首选。
运行结果
文章目录
一、所需工具软件二、使用步骤
3. 主要代码
4. 运行结果
三、在线协助
一、所需工具软件
1. VS2019, C++2. Yolov8, OpenCV
二、使用步骤
代码如下(示例):
/******************************************************************************** ** Form generated from reading UI file 'QtGuiApplication1vznqOM.ui' ** ** Created by: Qt User Interface Compiler version 5.13.2 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTGUIAPPLICATION1VZNQOM_H #define QTGUIAPPLICATION1VZNQOM_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "QVTKWidget.h" QT_BEGIN_NAMESPACE class Ui_QtGuiApplication1Class { public: QAction *actionOpen; QAction *actionClose; QWidget *centralWidget; QGridLayout *gridLayout; QFrame *frame; QHBoxLayout *horizontalLayout; QPushButton *pushButton_5; QPushButton *pushButton_6; QSpacerItem *horizontalSpacer_3; QFrame *frame_3; QVBoxLayout *verticalLayout; QPushButton *pushButton; QPushButton *pushButton_2; QPushButton *pushButton_3; QPushButton *pushButton_4; QSpacerItem *verticalSpacer_3; QFrame *frame_2; QGridLayout *gridLayout_2; QSpacerItem *verticalSpacer; QSpacerItem *horizontalSpacer_2; QVTKWidget *qvtkWidget; QSpacerItem *horizontalSpacer; QSpacerItem *verticalSpacer_2; QMenuBar *menuBar; QMenu *menuopen; QToolBar *mainToolBar; QStatusBar *statusBar; void setupUi(QMainWindow *QtGuiApplication1Class) { if (QtGuiApplication1Class->objectName().isEmpty()) QtGuiApplication1Class->setObjectName(QString::fromUtf8("QtGuiApplication1Class")); QtGuiApplication1Class->resize(598, 452); actionOpen = new QAction(QtGuiApplication1Class); actionOpen->setObjectName(QString::fromUtf8("actionOpen")); QFont font; font.setFamily(QString::fromUtf8("Calibri")); font.setPointSize(16); font.setBold(false); font.setWeight(50); actionOpen->setFont(font); actionClose = new QAction(QtGuiApplication1Class); actionClose->setObjectName(QString::fromUtf8("actionClose")); QFont font1; font1.setFamily(QString::fromUtf8("Calibri")); font1.setPointSize(16); actionClose->setFont(font1); centralWidget = new QWidget(QtGuiApplication1Class); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); gridLayout = new QGridLayout(centralWidget); gridLayout->setSpacing(6); gridLayout->setContentsMargins(11, 11, 11, 11); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); frame = new QFrame(centralWidget); frame->setObjectName(QString::fromUtf8("frame")); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(frame->sizePolicy().hasHeightForWidth()); frame->setSizePolicy(sizePolicy); frame->setStyleSheet(QString::fromUtf8("\n" "background-color: rgb(232, 232, 232);")); frame->setFrameShape(QFrame::StyledPanel); frame->setFrameShadow(QFrame::Raised); horizontalLayout = new QHBoxLayout(frame); horizontalLayout->setSpacing(6); horizontalLayout->setContentsMargins(11, 11, 11, 11); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); pushButton_5 = new QPushButton(frame); pushButton_5->setObjectName(QString::fromUtf8("pushButton_5")); pushButton_5->setLayoutDirection(Qt::LeftToRight); pushButton_5->setAutoFillBackground(false); pushButton_5->setStyleSheet(QString::fromUtf8("")); QIcon icon; icon.addFile(QString::fromUtf8(":/QtGuiApplication1/Resources/\346\211\223\345\274\200\346\226\207\344\273\266\345\244\271-\347\273\277\350\211\262.png"), QSize(), QIcon::Normal, QIcon::Off); pushButton_5->setIcon(icon); pushButton_5->setIconSize(QSize(33, 33)); pushButton_5->setAutoDefault(false); pushButton_5->setFlat(true); horizontalLayout->addWidget(pushButton_5); pushButton_6 = new QPushButton(frame); pushButton_6->setObjectName(QString::fromUtf8("pushButton_6")); pushButton_6->setLayoutDirection(Qt::LeftToRight); pushButton_6->setAutoFillBackground(false); pushButton_6->setStyleSheet(QString::fromUtf8("")); QIcon icon1; icon1.addFile(QString::fromUtf8(":/QtGuiApplication1/Resources/save.png"), QSize(), QIcon::Normal, QIcon::Off); pushButton_6->setIcon(icon1); pushButton_6->setIconSize(QSize(33, 33)); pushButton_6->setAutoDefault(false); pushButton_6->setFlat(true); horizontalLayout->addWidget(pushButton_6); horizontalSpacer_3 = new QSpacerItem(467, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer_3); gridLayout->addWidget(frame, 0, 0, 1, 2); frame_3 = new QFrame(centralWidget); frame_3->setObjectName(QString::fromUtf8("frame_3")); frame_3->setEnabled(true); QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(frame_3->sizePolicy().hasHeightForWidth()); frame_3->setSizePolicy(sizePolicy1); frame_3->setStyleSheet(QString::fromUtf8("")); frame_3->setFrameShape(QFrame::Box); frame_3->setFrameShadow(QFrame::Raised); verticalLayout = new QVBoxLayout(frame_3); verticalLayout->setSpacing(6); verticalLayout->setContentsMargins(11, 11, 11, 11); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); pushButton = new QPushButton(frame_3); pushButton->setObjectName(QString::fromUtf8("pushButton")); QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(pushButton->sizePolicy().hasHeightForWidth()); pushButton->setSizePolicy(sizePolicy2); pushButton->setMaximumSize(QSize(16777215, 16777215)); pushButton->setFont(font1); verticalLayout->addWidget(pushButton); pushButton_2 = new QPushButton(frame_3); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); sizePolicy2.setHeightForWidth(pushButton_2->sizePolicy().hasHeightForWidth()); pushButton_2->setSizePolicy(sizePolicy2); pushButton_2->setFont(font1); verticalLayout->addWidget(pushButton_2); pushButton_3 = new QPushButton(frame_3); pushButton_3->setObjectName(QString::fromUtf8("pushButton_3")); sizePolicy2.setHeightForWidth(pushButton_3->sizePolicy().hasHeightForWidth()); pushButton_3->setSizePolicy(sizePolicy2); pushButton_3->setFont(font1); verticalLayout->addWidget(pushButton_3); pushButton_4 = new QPushButton(frame_3); pushButton_4->setObjectName(QString::fromUtf8("pushButton_4")); pushButton_4->setFont(font1); verticalLayout->addWidget(pushButton_4); verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout->addItem(verticalSpacer_3); gridLayout->addWidget(frame_3, 1, 0, 1, 1); frame_2 = new QFrame(centralWidget); frame_2->setObjectName(QString::fromUtf8("frame_2")); QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); sizePolicy3.setHeightForWidth(frame_2->sizePolicy().hasHeightForWidth()); frame_2->setSizePolicy(sizePolicy3); frame_2->setFrameShape(QFrame::Box); frame_2->setFrameShadow(QFrame::Raised); gridLayout_2 = new QGridLayout(frame_2); gridLayout_2->setSpacing(6); gridLayout_2->setContentsMargins(11, 11, 11, 11); gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); verticalSpacer = new QSpacerItem(20, 142, QSizePolicy::Minimum, QSizePolicy::Fixed); gridLayout_2->addItem(verticalSpacer, 0, 1, 1, 1); horizontalSpacer_2 = new QSpacerItem(150, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); gridLayout_2->addItem(horizontalSpacer_2, 1, 0, 1, 1); qvtkWidget = new QVTKWidget(frame_2); qvtkWidget->setObjectName(QString::fromUtf8("qvtkWidget")); sizePolicy3.setHeightForWidth(qvtkWidget->sizePolicy().hasHeightForWidth()); qvtkWidget->setSizePolicy(sizePolicy3); gridLayout_2->addWidget(qvtkWidget, 1, 1, 1, 1); horizontalSpacer = new QSpacerItem(150, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); gridLayout_2->addItem(horizontalSpacer, 1, 2, 1, 1); verticalSpacer_2 = new QSpacerItem(20, 142, QSizePolicy::Minimum, QSizePolicy::Fixed); gridLayout_2->addItem(verticalSpacer_2, 2, 1, 1, 1); gridLayout->addWidget(frame_2, 1, 1, 1, 1); QtGuiApplication1Class->setCentralWidget(centralWidget); menuBar = new QMenuBar(QtGuiApplication1Class); menuBar->setObjectName(QString::fromUtf8("menuBar")); menuBar->setGeometry(QRect(0, 0, 598, 19)); menuopen = new QMenu(menuBar); menuopen->setObjectName(QString::fromUtf8("menuopen")); QtGuiApplication1Class->setMenuBar(menuBar); mainToolBar = new QToolBar(QtGuiApplication1Class); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); QtGuiApplication1Class->addToolBar(Qt::TopToolBarArea, mainToolBar); statusBar = new QStatusBar(QtGuiApplication1Class); statusBar->setObjectName(QString::fromUtf8("statusBar")); QtGuiApplication1Class->setStatusBar(statusBar); menuBar->addAction(menuopen->menuAction()); menuopen->addAction(actionOpen); menuopen->addAction(actionClose); retranslateUi(QtGuiApplication1Class); QObject::connect(pushButton, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(onClick())); QObject::connect(pushButton_2, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(onColor())); QObject::connect(pushButton_3, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(onColor2())); QObject::connect(menuBar, SIGNAL(triggered(QAction*)), QtGuiApplication1Class, SLOT(onOpen())); QObject::connect(pushButton_4, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(saveFileButtonPressed())); QObject::connect(pushButton_5, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(onOpen())); QObject::connect(pushButton_6, SIGNAL(clicked()), QtGuiApplication1Class, SLOT(saveFileButtonPressed())); QMetaObject::connectSlotsByName(QtGuiApplication1Class); } // setupUi void retranslateUi(QMainWindow *QtGuiApplication1Class) { QtGuiApplication1Class->setWindowTitle(QCoreApplication::translate("QtGuiApplication1Class", "QtGuiApplication1", nullptr)); actionOpen->setText(QCoreApplication::translate("QtGuiApplication1Class", "Open File", nullptr)); actionOpen->setIconText(QCoreApplication::translate("QtGuiApplication1Class", "open", nullptr)); #if QT_CONFIG(tooltip) actionOpen->setToolTip(QCoreApplication::translate("QtGuiApplication1Class", "open", nullptr)); #endif // QT_CONFIG(tooltip) actionClose->setText(QCoreApplication::translate("QtGuiApplication1Class", "Close", nullptr)); pushButton_5->setText(QString()); pushButton_6->setText(QString()); pushButton->setText(QCoreApplication::translate("QtGuiApplication1Class", " Open File ", nullptr)); pushButton_2->setText(QCoreApplication::translate("QtGuiApplication1Class", "JiangCai", nullptr)); pushButton_3->setText(QCoreApplication::translate("QtGuiApplication1Class", "Color-red", nullptr)); pushButton_4->setText(QCoreApplication::translate("QtGuiApplication1Class", "Save as", nullptr)); menuopen->setTitle(QCoreApplication::translate("QtGuiApplication1Class", "File", nullptr)); } // retranslateUi }; namespace Ui { class QtGuiApplication1Class: public Ui_QtGuiApplication1Class {}; } // namespace Ui QT_END_NAMESPACE #endif // QTGUIAPPLICATION1VZNQOM_H
运行结果
三、在线协助:
如需安装运行环境或远程调试,可点击博主头像,进入个人主页查看博主联系方式,由专业技术人员远程协助!
1)远程安装运行环境,代码调试
2)Visual Studio, Qt, C++, Python编程语言入门指导
3)界面美化
4)软件制作
博主个人主页:https://developer.aliyun.com/profile/expert/rfnzgp3sk3ahc
博主所有文章点这里:https://developer.aliyun.com/profile/expert/rfnzgp3sk3ahc
博主联系方式点这里:https://developer.aliyun.com/profile/expert/rfnzgp3sk3ahc