diff --git a/CHANGES b/CHANGES
index 6ce5f856f..ada67e572 100644
--- a/CHANGES
+++ b/CHANGES
@@ -38,6 +38,7 @@ Incompatible changes
* Modifying a template variable ``script_files`` in templates is allowed now.
Please use ``app.add_js_file()`` instead.
* #5072: Save environment object also with only new documents
+* #5035: qthelp builder allows dashes in :confval:`qthelp_namespace`
Deprecated
----------
diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py
index 9afe47637..a40cb2709 100644
--- a/sphinx/builders/qthelp.py
+++ b/sphinx/builders/qthelp.py
@@ -140,7 +140,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
else:
nspace = 'org.sphinx.%s.%s' % (outname, self.config.version)
- nspace = re.sub('[^a-zA-Z0-9.]', '', nspace)
+ nspace = re.sub('[^a-zA-Z0-9.\-]', '', nspace)
nspace = re.sub(r'\.+', '.', nspace).strip('.')
nspace = nspace.lower()
diff --git a/tests/test_build_qthelp.py b/tests/test_build_qthelp.py
index a0d4fcf2a..f427ec2d8 100644
--- a/tests/test_build_qthelp.py
+++ b/tests/test_build_qthelp.py
@@ -88,11 +88,11 @@ def test_qthelp_namespace(app, status, warning):
app.builder.build_all()
qhp = (app.outdir / 'Python.qhp').text()
- assert 'org.sphinxdoc.sphinx' in qhp
+ assert 'org.sphinx-doc.sphinx' in qhp
qhcp = (app.outdir / 'Python.qhcp').text()
- assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' in qhcp
- assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' in qhcp
+ assert 'qthelp://org.sphinx-doc.sphinx/doc/index.html' in qhcp
+ assert 'qthelp://org.sphinx-doc.sphinx/doc/index.html' in qhcp
@pytest.mark.sphinx('qthelp', testroot='basic')