Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build: QFileOpenEvent does not name a type #858

Closed
1 task done
davidgarland opened this issue Feb 13, 2023 · 3 comments · Fixed by #859
Closed
1 task done

Cannot build: QFileOpenEvent does not name a type #858

davidgarland opened this issue Feb 13, 2023 · 3 comments · Fixed by #859
Labels
bug Something isn't working
Milestone

Comments

@davidgarland
Copy link

Operating System

Linux

Version of Prism Launcher

latest git

Version of Qt

Qt 5.15.8

Description of bug

I get the following errors:

[ 72%] Building CXX object launcher/CMakeFiles/Launcher_logic.dir/ui/pages/global/LauncherPage.cpp.o
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp: In member function 'virtual bool Application::event(QEvent*)':
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:917:31: error: 'QFileOpenEvent' does not name a type
  917 |         auto ev = static_cast<QFileOpenEvent*>(event);
      |                               ^~~~~~~~~~~~~~
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:917:45: error: expected '>' before '*' token
  917 |         auto ev = static_cast<QFileOpenEvent*>(event);
      |                                             ^
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:917:45: error: expected '(' before '*' token
  917 |         auto ev = static_cast<QFileOpenEvent*>(event);
      |                                             ^
      |                                             (
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:917:46: error: expected primary-expression before '>' token
  917 |         auto ev = static_cast<QFileOpenEvent*>(event);
      |                                              ^
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:917:54: error: expected ')' before ';' token
  917 |         auto ev = static_cast<QFileOpenEvent*>(event);
      |                                                      ^
      |                                                      )
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:918:34: error: cannot convert '<brace-enclosed initializer list>' to 'QList<QUrl>'
  918 |         m_mainWindow->processURLs({ ev->url() });
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/Application.cpp:48:
/home/david/.cache/kiss/proc/3576/build/prismlauncher/launcher/ui/MainWindow.h:85:34: note:   initializing argument 1 of 'void MainWindow::processURLs(QList<QUrl>)'
   85 |     void processURLs(QList<QUrl> urls);
      |                      ~~~~~~~~~~~~^~~~

Steps to reproduce

git clone https://github.com/PrismLauncher/PrismLauncher
cd PrismLauncher
git submodule update --init --recursive
cmake -S . -B build \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX="/usr" \
	-DENABLE_LTO=ON
cmake --build build -j$(nproc)
cmake --install build

...in reality I'm doing this inside of the KISS package manager, and the real script is as follows, but the above should be easier for you to replicate on anything else:

#!/bin/sh -e

export DESTDIR="$1"
git submodule update --init --recursive
cmake -S . -B build \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX="/usr" \
	-DENABLE_LTO=ON
cmake --build build -j$(nproc)
cmake --install build

Suspected cause

#include <QFileOpenEvent> should be added to Application.cpp, as said in https://doc.qt.io/qt-5/qfileopenevent.html
If there is some way that it is supposed to be transitively imported, then that isn't working.

This issue is unique

  • I have searched the issue tracker and did not find an issue describing my bug.
@davidgarland davidgarland added the bug Something isn't working label Feb 13, 2023
@davidgarland
Copy link
Author

davidgarland commented Feb 13, 2023

Because it's such a simple fix, if you'd prefer I would be happy to make a PR for this, and I've verified that the following patch fixes the problem:

diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 0d3b086f..caaa74c8 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -79,6 +79,7 @@
 #include <iostream>
 #include <mutex>
 
+#include <QFileOpenEvent>
 #include <QAccessible>
 #include <QCommandLineParser>
 #include <QDir>

@Ryex
Copy link
Contributor

Ryex commented Feb 13, 2023

it's interesting that this is popping up now. This code has been in place for a while and builds on our CI just fine.

Adding the patch isn't a problem but what is your build environment and distro like?

@davidgarland
Copy link
Author

I would agree, I'm curious what differences in header files we have that could be causing this. Seems like a very random breaking change in either the build system or Qt...
I'm running Qt version 5.18.8, and I'm on KISS Linux. It's a from-source distribution, kind of like Gentoo, if you're familiar with that, meaning there are very few binary distributions of packages, and so package versions tend to be on the bleeding edge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants