def pro_add_qt_dependencies(target_config, metadata, pro_lines, debug=None):
    """ Add the Qt dependencies of a module to a .pro file.  target_config is
    the target configuration.  metadata is the module's meta-data.  pro_lines
    is the list of lines making up the .pro file that is updated.  debug is set
    if debug, rather than release, mode is to be used.  If it is None then the
    mode is taken from the target configuration.
    """
    if debug is None:
        debug = target_config.debug
    add = []
    remove = []
    for qt in metadata.qmake_QT:
        if qt.startswith('-'):
            remove.append(qt[1:])
        else:
            add.append(qt)
    if len(remove) != 0:
        pro_lines.append('QT -= %s' % ' '.join(remove))
    if len(add) != 0:
        pro_lines.append('QT += %s' % ' '.join(add))
    pro_lines.append('CONFIG += %s' % ('debug' if debug else 'release'))
    if metadata.cpp11:
        pro_lines.append('CONFIG += c++11')
    pro_lines.extend(target_config.qmake_variables)
