ui 0.8 增大软件大小,界面优化,实现部分三维重建界面“导入点云”
This commit is contained in:
@@ -3,31 +3,19 @@
|
||||
Loading::Loading(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
// qss
|
||||
ui.setupUi(this);
|
||||
QFile file(":/qss/qss/aqua.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream filetext(&file);
|
||||
QString stylesheet = filetext.readAll();
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
|
||||
setStyle();
|
||||
|
||||
ui.label_2->hide();
|
||||
ui.progressBar->setValue(0);
|
||||
QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
|
||||
ui.progressBar->setGraphicsEffect(opacityEffect);
|
||||
opacityEffect->setOpacity(0.9);
|
||||
|
||||
// ±³¾°
|
||||
QPixmap *pixmap = new QPixmap("Resources/image/loading.png");
|
||||
pixmap->scaled(ui.label_4->size(), Qt::KeepAspectRatio);
|
||||
ui.label_4->setScaledContents(true);
|
||||
ui.label_4->setPixmap(*pixmap);
|
||||
// ui.progressBar->setValue(0);
|
||||
// QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
|
||||
// ui.progressBar->setGraphicsEffect(opacityEffect);
|
||||
// opacityEffect->setOpacity(0.9);
|
||||
|
||||
// todo ¼ÓÔØ
|
||||
// ui.progressBar->setValue(100);
|
||||
|
||||
ui.label->hide();
|
||||
ui.progressBar->setValue(100);
|
||||
ui.label_2->show();
|
||||
ready2Enter = true;
|
||||
}
|
||||
@@ -36,9 +24,40 @@ Loading::~Loading()
|
||||
{
|
||||
}
|
||||
|
||||
void Loading::setStyle()
|
||||
{
|
||||
// qss
|
||||
ui.setupUi(this);
|
||||
QFile file(":/qss/qss/aqua.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream filetext(&file);
|
||||
QString stylesheet = filetext.readAll();
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
// Press any key to continue
|
||||
QPixmap *pixmap_press = new QPixmap(":/icon/image/loading/press.png");
|
||||
pixmap_press->scaled(ui.label_2->size(), Qt::KeepAspectRatio);
|
||||
ui.label_2->setScaledContents(true);
|
||||
ui.label_2->setPixmap(*pixmap_press);
|
||||
|
||||
//3D reconstruction
|
||||
QPixmap *pixmap_label = new QPixmap(":/icon/image/loading/label.png");
|
||||
pixmap_label->scaled(ui.label_3->size(), Qt::KeepAspectRatio);
|
||||
ui.label_3->setScaledContents(true);
|
||||
ui.label_3->setPixmap(*pixmap_label);
|
||||
|
||||
// ±³¾°
|
||||
QPixmap *pixmap = new QPixmap(":/Reconstruction/image/loading/loading.png");
|
||||
pixmap->scaled(ui.label_4->size(), Qt::KeepAspectRatio);
|
||||
ui.label_4->setScaledContents(true);
|
||||
ui.label_4->setPixmap(*pixmap);
|
||||
}
|
||||
|
||||
|
||||
void Loading::updateSlot()
|
||||
{
|
||||
ui.progressBar->setValue(currentValue);
|
||||
// ui.progressBar->setValue(currentValue);
|
||||
}
|
||||
|
||||
void Loading::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
@@ -19,6 +19,7 @@ private:
|
||||
bool ready2Enter = false;
|
||||
int currentValue = 0;
|
||||
void updateSlot();
|
||||
void setStyle();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
@@ -10,8 +10,8 @@ Reconstruction::Reconstruction(QWidget *parent)
|
||||
void Reconstruction::setStyle()
|
||||
{
|
||||
this->setContentsMargins(0, 0, 0, 0);
|
||||
this->setFixedSize(1110, 580);
|
||||
ui.centralWidget->setGeometry(0, 40, 1110, 400);
|
||||
// this->setFixedSize(1240, 680);
|
||||
// ui.centralWidget->setGeometry(0, 40, 1240, 680);
|
||||
ui.centralWidget->show();
|
||||
|
||||
// qss
|
||||
@@ -25,9 +25,6 @@ void Reconstruction::setStyle()
|
||||
QPalette palette1;
|
||||
palette1.setColor(QPalette::Background, qRgba(44, 46, 70, 100));
|
||||
ui.widget->setPalette(palette1);
|
||||
// QPa/*lette palette2;
|
||||
// palette2.setColor(QPalette::Background, Qt::white);
|
||||
// ui.stackedWidget->setPalette(palette2);
|
||||
ui.stackedWidget->setCurrentIndex(0);
|
||||
setPicStyle();
|
||||
setButtonStyle();
|
||||
@@ -81,6 +78,7 @@ void Reconstruction::on_pushButton_2_clicked()
|
||||
void Reconstruction::on_pushButton_3_clicked()
|
||||
{
|
||||
ui.stackedWidget->setCurrentIndex(2);
|
||||
ui.label_9->setVisible(FALSE);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@@ -133,8 +131,6 @@ void Reconstruction::on_pushButton_7_clicked()
|
||||
ui.textBrowser_2->append("");
|
||||
ui.textBrowser_3->append("");
|
||||
ui.textBrowser_4->append("");
|
||||
ui.textBrowser_5->append("");
|
||||
ui.textBrowser_6->append("");
|
||||
}
|
||||
|
||||
// 保存结果
|
||||
@@ -257,7 +253,7 @@ void Reconstruction::on_pushButton_13_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this, tr("open multiple image file"),
|
||||
"./", tr("Image files(*.bmp *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;All files (*.*)")); // todo 文件类型待确认
|
||||
"./", tr("PCD files(*.pcd);;All files (*.*)")); // todo 文件类型待确认
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
@@ -266,6 +262,19 @@ void Reconstruction::on_pushButton_13_clicked()
|
||||
return;
|
||||
}
|
||||
|
||||
ui.label_9->setVisible(TRUE);
|
||||
string pcd = fileName.toStdString();
|
||||
|
||||
PointCloud<PointXYZRGB>::Ptr cloud(new PointCloud<PointXYZRGB>);
|
||||
io::loadPCDFile(pcd, *cloud);
|
||||
boost::shared_ptr<visualization::PCLVisualizer> viewer(new visualization::PCLVisualizer("3D Viewer"));
|
||||
viewer->setBackgroundColor(0, 0, 0);
|
||||
viewer->addPointCloud(cloud, "cloud");
|
||||
viewer->setPointCloudRenderingProperties(visualization::PCL_VISUALIZER_POINT_SIZE, 1, "cloud");
|
||||
ui.qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
|
||||
ui.label_9->setVisible(FALSE);
|
||||
ui.qvtkWidget->update();
|
||||
|
||||
// todo 存储文件或文件路径
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
#include <QStyleFactory>
|
||||
#include "DisplayPic.h"
|
||||
#include "ui_Reconstruction.h"
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <pcl/io/vtk_lib_io.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
using namespace pcl;
|
||||
using namespace std;
|
||||
|
||||
class Reconstruction : public QMainWindow
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user