Ask Your Question
0

UI Headers Not Updating qt_ros

asked 2013-02-25 17:39:33 -0600

newToRos gravatar image

updated 2014-01-28 17:15:24 -0600

ngrennan gravatar image

I created a qt_ros package and integrated my QT application files into it. Everything has worked perfectly so far, but today when I added a new button to the .ui file the associated ui header file was not updated. Is this normal, or is there something wrong with my CMakeLists?

Note: This project started as a .pro project and uic ran fine on the .ui files then.

CMakeLists.txt ############################################################################## # Rosbuild2 ##############################################################################

if(ROSBUILD)
  include(rosbuild.cmake OPTIONAL)
  return()
endif()

##############################################################################
# CMake
##############################################################################

cmake_minimum_required(VERSION 2.4.6)

##############################################################################
# Ros Initialisation
##############################################################################

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

rosbuild_genmsg()

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE Debug)

##############################################################################
# Qt Environment
##############################################################################

rosbuild_include(qt_build qt-ros)
rosbuild_prepare_qt4(QtCore QtGui QtWebkit QtNetwork) # Add the appropriate components to the component list here

##############################################################################
# Sections
##############################################################################

file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/Google_Maps_CMAKE/*.hpp)

QT4_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC})

##############################################################################
# Sources
##############################################################################

file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)

##############################################################################
# Binaries
##############################################################################

rosbuild_add_executable(Google_Maps_CMAKE ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(Google_Maps_CMAKE ${QT_LIBRARIES})
edit retag flag offensive close merge delete

Comments

Can you update your question to add; CMakeLists.txt, .ui files and the command line you used? At least without those info it's hard to tell what's going on.

130s gravatar image130s ( 2013-02-26 05:05:02 -0600 )edit

Sure. I will add them later tonight.

newToRos gravatar imagenewToRos ( 2013-02-27 10:00:17 -0600 )edit

I just added the CMakeLists.txt

newToRos gravatar imagenewToRos ( 2013-02-28 13:29:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-02-28 15:00:20 -0600

newToRos gravatar image

Alright, I figured out what was going on. When I started the project everything was in the same directory and I was using a .pro file. I needed to include the ui_form.h file in my form.cpp file to be able to access my buttons. When I would build the project this way, the ui_form.h file would be generated and stayed in the same directory as all of the other files.

I then decided to organize my project into include, src, ui, and resources folders. Since the ui_form.h file was a header file, I moved it to the include folder and updated my include statement to look in the include directory. Around this time, I switched to using CMake and discovered that the files were not updating when I changed the interface. I thought I would just delete the ui_form.h, since it was auto-generated. I did and a got a compiler error because my include statement pointed to the include directory.

I just realized that CMake puts the ui_form.h file in the build directory. I deleted the one I had in the include directory and changed my include statements in form.cpp to

#include "../build/ui_form.h"

instead of

#include ../include/ui_form.h

I am still not sure if this is the best way to do it since the build directory could be changed, but at least everything is working now.

edit flag offensive delete link more

Comments

I am not yet able to accept my own answer. Feel free to accept it for me.

newToRos gravatar imagenewToRos ( 2013-03-01 04:25:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-25 17:39:33 -0600

Seen: 600 times

Last updated: Feb 28 '13