ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Using qwt with qt_ros

asked 2015-06-22 07:54:03 -0600

aland_t gravatar image

updated 2015-06-24 12:49:35 -0600

I am trying to build a qt_ros package which uses a custom .ui file with a couple of qwt widgets. The standard qt_ros package builds and displays the original main window gui. When I replace the old .ui file with the one I want to use, I get the message qwt_dial.h: No such file or directory. I have confirmed that the files exist in usr/include/qwt-qt4. The only thing I can think of is maybe there should be lines including qwt in package.xml and/or CMakeLists.txt, or qwt should be installed elsewhere. Any help would be appreciated.

edit: I am running Ubuntu 14.04 and ROS Indigo.

edit: Earlier I added the path to the widget library to ui_main_window.h which is generated with catkin_make. This allowed the file to be found. It was then giving me an error with slot and signal; those had to be changed to Q_SLOT and Q_SIGNAL. Currently I am getting a few undefined reference errors involving QwtCompass and QwtDial.

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-25 14:39:08 -0600

aland_t gravatar image

Ok, It started to work magically. Here is what I did: In ui_main_window.h change "#include qwtcompass.h" to "#include qwt-qt4/qwt_compass.h". This change has to be repeated every time the .ui file is altered, for now. In qwt_abstract_scale_draw.h the lines "slots" and "signals" must be changed to "Q_SLOTS" and "Q_SIGNALS" respectively. In CMakeLists.txt, "${Qwt_LIBRARIES}" must be added to the list of "target_link_libraries()".

edit flag offensive delete link more
1

answered 2015-09-08 04:08:15 -0600

ChickenSoup gravatar image
file(GLOB QWT_INCLUDE_DIR "/usr/include/qwt")
include_directories(include ${catkin_INCLUDE_DIRS} ${QWT_INCLUDE_DIR})

and

file(GLOB QWT_LIBRARIES "/usr/lib/libqwt*")
target_link_libraries(<your_program> ${QT_LIBRARIES} ${catkin_LIBRARIES} ${QWT_LIBRARIES})

worked for me.

My qwt stuff were in /usr/include/qwt folder; not in /usr/include/qwt-qt4

cheers!

edit flag offensive delete link more

Comments

This solution worked for me!! thanks

karem gravatar image karem  ( 2021-07-01 16:40:47 -0600 )edit
0

answered 2015-06-23 12:34:27 -0600

tfoote gravatar image

If it's in the subdirectory qwt-qt4 you either need to add that to your include_path via CMake, or you need to use the full path in you #include "qwt-qt4/qwt_dial.h"

I'm not familiar with the qt CMake infrastructure, but i'd recommend looking at other projects to see which approach they use. I suspect that there is a CMake varialble you should be loading and adding to your include path provided by Qt.

edit flag offensive delete link more

Comments

Thus far I am unable to find any projects that use qt_ros and qwt.

aland_t gravatar image aland_t  ( 2015-06-24 10:57:56 -0600 )edit

It does not need to be a ROS package. Any CMake based project using qwt should provide you with correct examples.

tfoote gravatar image tfoote  ( 2015-06-24 12:16:09 -0600 )edit

Okay, I am searching for stuff now.

aland_t gravatar image aland_t  ( 2015-06-24 12:48:24 -0600 )edit

Not fully related, as your project seems to be C++, but rqt_plot has a Qwt backend.

Adolfo Rodriguez T gravatar image Adolfo Rodriguez T  ( 2015-06-25 03:13:18 -0600 )edit

Looking at rqt_plot the only reference to Qwt I see is the python bindings.

aland_t gravatar image aland_t  ( 2015-06-25 08:32:42 -0600 )edit
0

answered 2015-06-24 13:46:03 -0600

updated 2015-06-24 14:00:14 -0600

First you need it qwt as dependency in your package.xml(this is only needed if you want to "release" them)

<run_depend> and <build_depend>

You can find the packages available for that here: https://github.com/ros/rosdistro/blob...

Example:

libqwt5-qt4-dev: <--- that you need to enter inside the tags if you want this library
  arch: [qwt5]
  debian:
    apt:
      packages: [libqwt5-qt4-dev]
  fedora: [qwt-devel]
  gentoo:
portage:

If it is not there and you want to release, you have to add it by forking and sending a pull request to the repository (still only if you want to release it as package)

In your CMakeLists.txt:

find_library(LIBQWT libqwt-xxx.so <searchpath list(optional)>) #LIBQWT is a string you define as macro for that library

target_link_libraries(your_exe_name
   ${LIBQWT}
   ${catkin_LIBRARIES}
)

That should be it, I guess ...

edit flag offensive delete link more

Comments

I tried all of this, no change...

aland_t gravatar image aland_t  ( 2015-06-25 08:29:50 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2015-06-22 07:54:03 -0600

Seen: 1,893 times

Last updated: Sep 08 '15