Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Promoting to custom widget in QtDesigner '*.hpp' no such file or directory [cmake]
QtWS25 Last Chance

Promoting to custom widget in QtDesigner '*.hpp' no such file or directory [cmake]

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtdesignercmakelists.txtcmakec++custom widget
4 Posts 2 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Valveware
    wrote on last edited by
    #1

    Hello, I am having trouble promoting a widget in the qt designer to a widget I made. The widget I made is derived from a QFrame so I am promoting a regular QFrame in the designer. But when I try to build ui_main_window.h complains it can't find the specified header.
    For the promotion I tried the following settings and their combinations:
    Base class name:
    QFrame
    Promoted class name
    CameraFrame
    dashboard::CameraFrame
    Header file
    include/dashboard/cameraframe.hpp
    dashboard/cameraframe.hpp
    cameraframe.hpp

    So I think I should be adding something else to my CMakeLists.txt perhaps? I don't how I can fix this. My project's layout is :

    /dashboard
    ----/include
    --------/dashboard
    ------------...
    ------------cameraframe.hpp
    ------------...
    ----/src
    --------cpp files
    ----/resources
    --------/images
    ----/test
    --------tests
    ----/ui
    --------mainwindow.ui
    ----CMakeLists.txt
    ----mainpage.dox
    ----packages.xml
    

    Thanks in advance!

    A 1 Reply Last reply
    0
    • V Valveware

      Hello, I am having trouble promoting a widget in the qt designer to a widget I made. The widget I made is derived from a QFrame so I am promoting a regular QFrame in the designer. But when I try to build ui_main_window.h complains it can't find the specified header.
      For the promotion I tried the following settings and their combinations:
      Base class name:
      QFrame
      Promoted class name
      CameraFrame
      dashboard::CameraFrame
      Header file
      include/dashboard/cameraframe.hpp
      dashboard/cameraframe.hpp
      cameraframe.hpp

      So I think I should be adding something else to my CMakeLists.txt perhaps? I don't how I can fix this. My project's layout is :

      /dashboard
      ----/include
      --------/dashboard
      ------------...
      ------------cameraframe.hpp
      ------------...
      ----/src
      --------cpp files
      ----/resources
      --------/images
      ----/test
      --------tests
      ----/ui
      --------mainwindow.ui
      ----CMakeLists.txt
      ----mainpage.dox
      ----packages.xml
      

      Thanks in advance!

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @Valveware You probably don't have the custom widget mocced in your cmake. Can you share your cmakelists.txt?

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Valveware
        wrote on last edited by
        #3

        This is my project's cmakelists.txt

        ##############################################################################
        # CMake
        ##############################################################################
        
        cmake_minimum_required(VERSION 2.8.0)
        project(dashboard)
        
        ##############################################################################
        # Catkin
        ##############################################################################
        
        # qt_build provides the qt cmake glue, roscpp the comms for a default talker
        find_package(catkin REQUIRED COMPONENTS qt_build roscpp)
        include_directories(${catkin_INCLUDE_DIRS})
        # Use this to define what the package will export (e.g. libs, headers).
        # Since the default here is to produce only a binary, we don't worry about
        # exporting anything. 
        catkin_package()
        
        ##############################################################################
        # Qt Environment
        ##############################################################################
        
        # this comes from qt_build's qt-ros.cmake which is automatically 
        # included via the dependency call in package.xml
        rosbuild_prepare_qt4(QtCore QtGui) # 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/dashboard/*.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
        ##############################################################################
        
        add_executable(dashboard ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
        target_link_libraries(dashboard ${QT_LIBRARIES} ${catkin_LIBRARIES})
        install(TARGETS dashboard RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
        
        ##############################################################################
        # Tests
        ##############################################################################
        catkin_add_gtest(cameranodetests test/cameranodetests.cpp)
        
        
        
        A 1 Reply Last reply
        0
        • V Valveware

          This is my project's cmakelists.txt

          ##############################################################################
          # CMake
          ##############################################################################
          
          cmake_minimum_required(VERSION 2.8.0)
          project(dashboard)
          
          ##############################################################################
          # Catkin
          ##############################################################################
          
          # qt_build provides the qt cmake glue, roscpp the comms for a default talker
          find_package(catkin REQUIRED COMPONENTS qt_build roscpp)
          include_directories(${catkin_INCLUDE_DIRS})
          # Use this to define what the package will export (e.g. libs, headers).
          # Since the default here is to produce only a binary, we don't worry about
          # exporting anything. 
          catkin_package()
          
          ##############################################################################
          # Qt Environment
          ##############################################################################
          
          # this comes from qt_build's qt-ros.cmake which is automatically 
          # included via the dependency call in package.xml
          rosbuild_prepare_qt4(QtCore QtGui) # 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/dashboard/*.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
          ##############################################################################
          
          add_executable(dashboard ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
          target_link_libraries(dashboard ${QT_LIBRARIES} ${catkin_LIBRARIES})
          install(TARGETS dashboard RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
          
          ##############################################################################
          # Tests
          ##############################################################################
          catkin_add_gtest(cameranodetests test/cameranodetests.cpp)
          
          
          
          A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          @Valveware said in Promoting to custom widget in QtDesigner '*.hpp' no such file or directory [cmake]:

          file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/dashboard/*.hpp)

          Ok that looks like it would indeed moc your cameraframe.hpp.. So that's probably not the issue.

          Can you share the build log from gcc? And also the ui_main_window.h file as well as ui_cameraframe.h?

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved