Skip to content

Commit

Permalink
qt: Add UIC test
Browse files Browse the repository at this point in the history
  • Loading branch information
DoomHammer committed Sep 7, 2024
1 parent 9c735da commit 79ed1eb
Show file tree
Hide file tree
Showing 5 changed files with 381 additions and 4 deletions.
4 changes: 2 additions & 2 deletions recipes/qt/6.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ def _create_plugin(pluginname, libname, plugintype, requires):
self.cpp_info.components["qtGui"].frameworks.append("AGL")
if self.settings.os == "Macos":
# https://github.com/qt/qtbase/blob/v6.6.1/src/gui/CMakeLists.txt#L362-L370
self.cpp_info.components["qtGui"].frameworks += ["AppKit", "Carbon"]
self.cpp_info.components["qtGui"].frameworks += ["AppKit", "Carbon", "Metal"]
_create_plugin("QCocoaIntegrationPlugin", "qcocoa", "platforms", ["Core", "Gui"])
# https://github.com/qt/qtbase/blob/v6.6.1/src/plugins/platforms/cocoa/CMakeLists.txt#L51-L58
self.cpp_info.components["QCocoaIntegrationPlugin"].frameworks = [
Expand Down Expand Up @@ -1292,7 +1292,7 @@ def _create_plugin(pluginname, libname, plugintype, requires):
_create_module("UiPlugin", ["Gui", "Widgets"])
self.cpp_info.components["qtUiPlugin"].libs = [] # this is a collection of abstract classes, so this is header-only
self.cpp_info.components["qtUiPlugin"].libdirs = []
_create_module("UiTools", ["UiPlugin", "Gui", "Widgets"])
_create_module("UiTools", ["UiPlugin", "Gui", "Widgets", "OpenGLWidgets"])
_create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"])
_create_module("Help", ["Gui", "Sql", "Widgets"])

Expand Down
9 changes: 8 additions & 1 deletion recipes/qt/6.x.x/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)

find_package(Qt6 COMPONENTS Core Network Sql Concurrent Xml REQUIRED CONFIG)
find_package(Qt6 COMPONENTS Core Network Sql Concurrent UiTools Xml REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp greeter.h example.qrc)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Network Qt6::Sql Qt6::Concurrent Qt6::Xml Qt6::Widgets)
Expand All @@ -16,3 +16,10 @@ if (APPLE)
target_link_libraries(test_macos_bundle PRIVATE Qt6::Core)
target_compile_features(test_macos_bundle PRIVATE cxx_std_17)
endif()

set(UI_TEST ui_test)

add_executable(${UI_TEST} test_ui.cpp test.ui)
target_link_libraries(${UI_TEST} PRIVATE Qt6::Core Qt6::Gui Qt6::UiTools Qt6::Widgets)
target_compile_features(${UI_TEST} PRIVATE cxx_std_17)
set_target_properties(${UI_TEST} PROPERTIES AUTOMOC ON AUTOUI ON)
2 changes: 1 addition & 1 deletion recipes/qt/6.x.x/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str, run=can_run(self))
self.requires(self.tested_reference_str, options={"qttools": True}, run=can_run(self))

def build_requirements(self):
if not can_run(self):
Expand Down
303 changes: 303 additions & 0 deletions recipes/qt/6.x.x/test_package/test.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>CalculatorForm</class>
<widget class="QWidget" name="CalculatorForm" >
<property name="objectName" >
<string notr="true" >CalculatorForm</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>276</width>
<height>98</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Calculator Builder</string>
</property>
<layout class="QGridLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="objectName" >
<string notr="true" >label</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>45</width>
<height>19</height>
</rect>
</property>
<property name="text" >
<string>Input 1</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="inputSpinBox1" >
<property name="objectName" >
<string notr="true" >inputSpinBox1</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>26</y>
<width>45</width>
<height>25</height>
</rect>
</property>
<property name="mouseTracking" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="objectName" >
<string notr="true" >label_3</string>
</property>
<property name="geometry" >
<rect>
<x>54</x>
<y>1</y>
<width>7</width>
<height>52</height>
</rect>
</property>
<property name="text" >
<string>+</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="objectName" >
<string notr="true" >label_2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>45</width>
<height>19</height>
</rect>
</property>
<property name="text" >
<string>Input 2</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="inputSpinBox2" >
<property name="objectName" >
<string notr="true" >inputSpinBox2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>26</y>
<width>45</width>
<height>25</height>
</rect>
</property>
<property name="mouseTracking" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_3_2" >
<property name="objectName" >
<string notr="true" >label_3_2</string>
</property>
<property name="geometry" >
<rect>
<x>120</x>
<y>1</y>
<width>7</width>
<height>52</height>
</rect>
</property>
<property name="text" >
<string>=</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="objectName" >
<string notr="true" />
</property>
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2_2_2" >
<property name="objectName" >
<string notr="true" >label_2_2_2</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>1</y>
<width>37</width>
<height>17</height>
</rect>
</property>
<property name="text" >
<string>Output</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="outputWidget" >
<property name="objectName" >
<string notr="true" >outputWidget</string>
</property>
<property name="geometry" >
<rect>
<x>1</x>
<y>24</y>
<width>37</width>
<height>27</height>
</rect>
</property>
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>0</string>
</property>
<property name="alignment" >
<set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<spacer>
<property name="objectName" >
<string notr="true" >verticalSpacer</string>
</property>
<property name="geometry" >
<rect>
<x>85</x>
<y>69</y>
<width>20</width>
<height>20</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<spacer>
<property name="objectName" >
<string notr="true" >horizontalSpacer</string>
</property>
<property name="geometry" >
<rect>
<x>188</x>
<y>26</y>
<width>79</width>
<height>20</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit 79ed1eb

Please sign in to comment.