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. autouic: normal header file name startwith ui_* failed
Forum Updated to NodeBB v4.3 + New Features

autouic: normal header file name startwith ui_* failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 374 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.
  • C Offline
    C Offline
    CraZy
    wrote on last edited by CraZy
    #1

    one of my libraries generates a ui_global.h file which contains global
    settings for the UI, with autouic enabled this would trigger the inference and subsequently fail on global.ui not actually existing.

    the following example, ui_global.h is included in LiveBoard.h (LiveBoard is a class based on QMainWindow and has a .ui file) and the following error occurred

    AutoUic error
    -------------
    "SRC:/monitor/ui/LiveBoard.h"
    includes the uic file "ui_global.h",
    but the user interface file "global.ui"
    could not be found in the following directories
      "SRC:/monitor/ui"
    

    and

    set_property(SOURCE ui_global.h PROPERTY SKIP_AUTOUIC ON)
    

    cannot figure this out.

    part of my CMakeLists.txt

    cmake_minimum_required(VERSION 3.14)
    
    set(PROJ_NAME live_ui)
    project(${PROJ_NAME} LANGUAGES CXX DESCRIPTION "UI")
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets PrintSupport)
    find_package(Qt5 REQUIRED COMPONENTS Widgets PrintSupport)
    
    include_directories(./)
    
    file(GLOB_RECURSE SOURCE_FILES *.cpp *.h *.ui *.qrc)
    
    add_library(${PROJ_NAME} SHARED ${SOURCE_FILES})
    set_property(SOURCE ui_global.h PROPERTY SKIP_AUTOUIC ON)
    

    If I changed the name of ui_global.h to gui_global.h, it works.

    Anyone can help? Thanks.

    jsulmJ 1 Reply Last reply
    0
    • C CraZy

      one of my libraries generates a ui_global.h file which contains global
      settings for the UI, with autouic enabled this would trigger the inference and subsequently fail on global.ui not actually existing.

      the following example, ui_global.h is included in LiveBoard.h (LiveBoard is a class based on QMainWindow and has a .ui file) and the following error occurred

      AutoUic error
      -------------
      "SRC:/monitor/ui/LiveBoard.h"
      includes the uic file "ui_global.h",
      but the user interface file "global.ui"
      could not be found in the following directories
        "SRC:/monitor/ui"
      

      and

      set_property(SOURCE ui_global.h PROPERTY SKIP_AUTOUIC ON)
      

      cannot figure this out.

      part of my CMakeLists.txt

      cmake_minimum_required(VERSION 3.14)
      
      set(PROJ_NAME live_ui)
      project(${PROJ_NAME} LANGUAGES CXX DESCRIPTION "UI")
      
      set(CMAKE_CXX_STANDARD 17)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      
      find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets PrintSupport)
      find_package(Qt5 REQUIRED COMPONENTS Widgets PrintSupport)
      
      include_directories(./)
      
      file(GLOB_RECURSE SOURCE_FILES *.cpp *.h *.ui *.qrc)
      
      add_library(${PROJ_NAME} SHARED ${SOURCE_FILES})
      set_property(SOURCE ui_global.h PROPERTY SKIP_AUTOUIC ON)
      

      If I changed the name of ui_global.h to gui_global.h, it works.

      Anyone can help? Thanks.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @CraZy uic generates ui_FORMNAME.h for every form you define in designer. You should avoid using ui_ prefixes for your own header files.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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