> But... I think there are quite some places where we can pimp LyX a > bit and maybe we can use it in more places as you say.
Very well! > > Is there a reason for which the moc_ file is included at > the end? I've spent an > > hour (in cmake's lyx_automoc & friends) to understand why > the moc_ file was not > > created for the new file. In my little experience (with > qmake) you don't need to > > do that. Maybe we should write it to /src/frontends/qt4/README. > > The moc file is not created because you put the code in support. > Classes in support are not moc'ed by default by autotools. There > is only an exception for SystemcallPrivate.h: > > src/support/Makefile.am: > > MOCHEADER = SystemcallPrivate.h > > MOCEDFILES = $(MOCHEADER:%.h=moc_%.cpp) > > CLEANFILES += $(MOCEDFILES) > BUILT_SOURCES += $(MOCEDFILES) > > moc_%.cpp: %.h > $(MOC4) -o $@ $< > > liblyxsupport_a_DEPENDENCIES = $(MOCEDFILES) Mmmh, I've moved the class in src/frontend/qt4 with the same results. The solution was (both for src/frontend/qt4 and src/support) adding #include "moc_fancylineedit.cpp" in fancylineedit.cpp, at least for CMake, see [1]. If I'm correct CMake ignores src/support/Makefile.am, so maybe my solution won't work with other build systems. I'm a bit confused by all the build systems we're using. > > I've added to Makefile.am the two files, I don't know > whether it's correct or > > completely useless. > > Also: I've edited the header of the two files, take a look > at the originals [1] > > [2] and tell me if it's OK or if we should credit Nokia in > some other way. > > The image for the X (attached) on the textbox is taken from > Qt Creator too, but > > maybe we can replace it. > > I've no idea how to handle the license and credits. I see. Thanks for the quick reply ;) Have you tried the patch what do you think of the result? venom00 [1] In file src/support/CMakeLists.txt: ... file(GLOB support_sources ${TOP_SRC_DIR}/src/support/${LYX_CPP_FILES}) ... lyx_automoc(${support_sources}) Lyx_automoc is defined in file: development/cmake/modules/LyXMacros.cmake macro(LYX_AUTOMOC) if (QT4_GET_MOC_INC_DIRS) QT4_GET_MOC_INC_DIRS(_moc_INCS) endif() set(_matching_FILES) foreach (_current_FILE ${ARGN}) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. # here. this is required to make bouic work correctly: # we need to add generated .cpp files to the sources (to compile them), # but we cannot let automoc handle them, as the .cpp files don't exist yet when # cmake is run for the very first time on them -> however the .cpp files might # exist at a later run. at that time we need to skip them, so that we don't add two # different rules for the same moc file get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC) if (EXISTS ${_abs_FILE} AND NOT _skip) file(READ ${_abs_FILE} _contents) get_filename_component(_abs_PATH ${_abs_FILE} PATH) # HERE LOOKS FOR THE #include <moc_*.cpp> IN THE FILE, IF IT'S PRESENT # THE MOC FILE WILL BE CREATED string(REGEX MATCHALL "#include +[\"<]moc_[^ ]+\\.cpp[\">]" _match "${_contents}") if (_match) foreach (_current_MOC_INC ${_match}) string(REGEX MATCH "moc_[^ <\"]+\\.cpp" _current_MOC "${_current_MOC_INC}") get_filename_component(_basename ${_current_MOC} NAME_WE) string(LENGTH ${_basename} _length) MATH(EXPR _mocless_length ${_length}-4) STRING(SUBSTRING ${_basename} 4 ${_mocless_length} _mocless_name ) set(_header ${_abs_PATH}/${_mocless_name}.h) #message(STATUS "moc : ${_header}") #set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) #set(_header ${_abs_PATH}/${_basename}.h) set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) if (WIN32) set(_def -D_WIN32) endif() #set(_moc ${_abs_PATH}/${_current_MOC}) add_custom_command(OUTPUT ${_moc} COMMAND ${QT_MOC_EXECUTABLE} ARGS ${_def} ${_moc_INCS} ${_header} -o ${_moc} MAIN_DEPENDENCY ${_header}) macro_add_file_dependencies(${_abs_FILE} ${_moc}) SET_SOURCE_FILES_PROPERTIES(${_moc} GENERATED) endforeach (_current_MOC_INC) else() #message(STATUS "moc not found : ${_abs_FILE} ") endif() endif() endforeach (_current_FILE) endmacro (LYX_AUTOMOC)