summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-25 07:24:53 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-10-24 10:30:38 (GMT)
commit84218e1870ab075c9e2be1f2947358702c849fed (patch)
treebf9c4c40c03ef8d5e07340457969b5181b7ef458 /Tests
parent94a0ca604ca6ba3699b6d309938e881b2a3984a0 (diff)
downloadCMake-84218e1870ab075c9e2be1f2947358702c849fed.zip
CMake-84218e1870ab075c9e2be1f2947358702c849fed.tar.gz
CMake-84218e1870ab075c9e2be1f2947358702c849fed.tar.bz2
Add automatic uic invocation for Qt.
The source files are already processed by cmQtAutomoc to look for moc includes, so extend that to also look for ui_ includes and find corresponding .ui files to process. This replaces the need to invoke qt4_wrap_ui(). As the ui files are not likely to be part of the SOURCES of the target, store the options associated with them separately in the cmMakefile for querying during the autogen run.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/calwidget.cpp3
-rw-r--r--Tests/QtAutogen/calwidget.h7
-rw-r--r--Tests/QtAutogen/calwidget.ui32
4 files changed, 44 insertions, 0 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 39c1ae9..e194b94 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -35,6 +35,8 @@ add_definitions(-DFOO -DSomeDefine="Barx")
# enable relaxed mode so automoc can handle all the special cases:
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+set(CMAKE_AUTOUIC ON)
+
# create an executable and two library targets, each requiring automoc:
add_library(codeeditorLib STATIC codeeditor.cpp)
diff --git a/Tests/QtAutogen/calwidget.cpp b/Tests/QtAutogen/calwidget.cpp
index cbfa5a8..defde20 100644
--- a/Tests/QtAutogen/calwidget.cpp
+++ b/Tests/QtAutogen/calwidget.cpp
@@ -49,7 +49,10 @@
#include "calwidget.h"
+ #include "ui_calwidget.h"
+
Window::Window()
+ : ui(new Ui::Window)
{
createPreviewGroupBox();
createGeneralOptionsGroupBox();
diff --git a/Tests/QtAutogen/calwidget.h b/Tests/QtAutogen/calwidget.h
index 8447389..d21a473 100644
--- a/Tests/QtAutogen/calwidget.h
+++ b/Tests/QtAutogen/calwidget.h
@@ -52,6 +52,11 @@
class QGroupBox;
class QLabel;
+ namespace Ui
+ {
+ class Window;
+ }
+
class Window : public QWidget
{
Q_OBJECT
@@ -116,6 +121,8 @@
QCheckBox *firstFridayCheckBox;
QCheckBox *mayFirstCheckBox;
+
+ Ui::Window *ui;
};
#endif
diff --git a/Tests/QtAutogen/calwidget.ui b/Tests/QtAutogen/calwidget.ui
new file mode 100644
index 0000000..1c245ca
--- /dev/null
+++ b/Tests/QtAutogen/calwidget.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Window</class>
+ <widget class="QWidget" name="Window">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>180</y>
+ <width>94</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>