Qt生成一个界面

visualizer.cpp

#include "VisualizerWindow.h"
#include <QApplication>

#include <locale>

int main(int argc, char ** argv)
{
  QApplication app(argc, argv);

  setlocale(LC_NUMERIC,"C");

  VisualizerWindow window(argc, argv);

  window.show();

  return app.exec();
}

VisualizerWindow.h

#ifndef VISUALIZERWINDOW_H
#define VISUALIZERWINDOW_H

#include <QMainWindow>
#include "ui_visualizer.h"

class VisualizerWindow : public QMainWindow
{
  Q_OBJECT

public:
  VisualizerWindow();
  VisualizerWindow(int argc, char** argv);
  ~VisualizerWindow();

protected:
  Ui::MainWindow ui_;
};

#endif // VISUALIZERWINDOW_H

VisualizerWindow.cpp

#include "VisualizerWindow.h"

VisualizerWindow::VisualizerWindow(int argc, char **argv){

  ui_.setupUi(this);
}

VisualizerWindow::~VisualizerWindow()
{
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(semantic_suma)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    std_msgs
)

find_package(Qt5 REQUIRED COMPONENTS Widgets)

set(CMAKE_INCLUDE_CURRENT_DIR ON) # need to be activated for qt generated files in build directory
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES semantic_suma
#  CATKIN_DEPENDS other_catkin_pkg
#  DEPENDS system_lib
)

include_directories(
# include
# ${catkin_INCLUDE_DIRS}
)

# INCLUDE_DIRECTORIES(src/)

QT5_WRAP_UI(UI_HDRS src/visualizer/visualizer.ui)

add_executable(visualizer

    src/visualizer/VisualizerWindow.cpp
    src/visualizer/visualizer.cpp
)

target_link_libraries(visualizer ${catkin_LIBRARIES} Qt5::Widgets)

 

发布了7 篇原创文章 · 获赞 15 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览