Coder Social home page Coder Social logo

Qt 6 support about osgqt HOT 13 OPEN

openscenegraph avatar openscenegraph commented on June 9, 2024 2
Qt 6 support

from osgqt.

Comments (13)

david-antiteum avatar david-antiteum commented on June 9, 2024

Can you for now fork and let us access the porting in the meantime?

I have been looking at the CMake code and is quite complex but, as you say, changes in Qt are quite small. So I would prefer to have a single solution splitting/redoing CMakeLists.txt files based on Qt version and a few ifdef (#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) and so on..) in C++ code.

Thanks,

David

from osgqt.

DeadParrot avatar DeadParrot commented on June 9, 2024

I put the minimal Qt 6 changes in a topic/Qt6 branch of my fork at https://github.com/DeadParrot/osgQt/tree/topic/Qt6.

No QT_VERSION checks are needed in the C++ source: all the C++ changes for Qt 6 are compatible with Qt 5 (but not Qt 4).

If the plan is to merge the CMake changes to support Qt 5 and 6 I think the logic has to respect -DDESIRED_QT_VERSION=5 or -DDESIRED_QT_VERSION=6 rather than just going with IF( Qt6Widgets_FOUND ) ... ELSEIF( Qt5Widgets_FOUND ) ... logic the since many systems will have both Qt 5 and 6 installed so the developer needs to be able to choose the Qt to build against.

from osgqt.

david-antiteum avatar david-antiteum commented on June 9, 2024

Thanks for the fork @DeadParrot and, yes, you are right, better use -DDESIRED_QT_VERSION

from osgqt.

mtola avatar mtola commented on June 9, 2024

Hello @DeadParrot , I just looked at your modifications here : DeadParrot@c4d48d1

I wanted to tell you that I did essentially the same thing on my side at the beginning of October 2021. For the file src/osgQOpenGL/OSGRenderer.cpp, indeed most of the changes are compatible with Qt5 at the exception of one line, line 356 :

m_osgWinEmb->getEventQueue()->mouseMotion(event->position().x() * m_windowScale, event->position().y() * m_windowScale);

---> Indeed with Qt5.12.11 we need to keep the 'old' one : m_osgWinEmb->getEventQueue()->mouseMotion(event->x() * m_windowScale, event->y() * m_windowScale);

PS: as you may have read, I tested with Qt5.12.11 and I guess you didn't have this problem because you probably tested with Qt5.15.x (which introduces most things for Qt6) ?

But it is very good news that we have arrived at much the same thing. :-))

from osgqt.

DeadParrot avatar DeadParrot commented on June 9, 2024

Hi @mtola. Thanks for the feedback. Nice that we arrived at the same place!

Yes, I was only testing on Qt 5.15.x so I missed that. I guess something like this would make it work on all versions of Qt 5 and 6:

#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
    m_osgWinEmb->getEventQueue()->mouseMotion(event->position().x() * m_windowScale,
                                              event->position().y() * m_windowScale);
#else
    m_osgWinEmb->getEventQueue()->mouseMotion(event->x() * m_windowScale,
                                              event->y() * m_windowScale);
#endif

As I described above, I'm not sure it makes sense to try and make this branch support Qt 5 and 6 since the old branch already supports 4 and 5, but if the osgQt maintainers decide to do that then this change is needed. I'm not sure there is much maintenance going on though so maybe we should ask Robert Osfield to let us set up an osgQt6 project?

from osgqt.

mtola avatar mtola commented on June 9, 2024

Yes, exactly, just a test to properly support Qt5 and Qt6. I am OK with this test. ;-)

For me it is very important to properly support Qt5 and Qt6. We have just seen that the cost is also low.

Originally the osgQt module was an integral part of OSG then for several years it was extracted from OSG. I think Robert no longer handles this. Moreover, for 2/3 years he seems very busy with VulkanSceneGraph.

As you have a fork with just one commit in advance, I think you have to finish the little work that remains (especially with the Qt5/Qt6 test added today just above but also the small differences in the cmake files for proper detection and management of Qt5 or Qt6 libraries -> a new lib with Qt6: OpenGLWidgets, qt5_wrap_cpp/qt6_wrap_cpp, etc...) and then simply submit a Pull Request here. ;-)

The osgQt module will then be able to support Qt5 and Qt6. :-))

from osgqt.

DeadParrot avatar DeadParrot commented on June 9, 2024

@mtola I'm fine with having Qt 5 and 6 support in the code and I don't think it would be hard to do that in the CMake setup but someone has to make it handle DESIRED_QT_VERSION and carefully remove the Qt4 stuff and test that with Qt 5 and 6. I'd rather hear from the maintainers that they are on board with this plan before investing that effort only to have a PR ignored for months/years. Plus I am swamped and probably couldn't get to it for months.

Another complication is that the former "Qt4" approach actually works in Qt5 so some discussion should be had about whether keeping that around in a Qt5 branch has any value. I used that approach for a while in Qt5 until I got the new osgQOpenGL approach to work for my application.

If there are no active maintainers here then we should contact Robert about taking this over and make sure we have the Qt4 support correctly archived in the topic/Qt4 branch before we strip that out. Since I helped motivate the separation of osgQt I don't mind contributing here.

from osgqt.

mathieu avatar mathieu commented on June 9, 2024

Hi @mtola and @DeadParrot, I'm the original co-author and still the maintainer on this project but since I changed companies three years ago, I'm no longer daily involved with OpenSceneGraph and Qt projects...
If any of you wants to step up, I'm ok to contact Robert and ask him to give you maintainer rights on this project !

from osgqt.

robertosfield avatar robertosfield commented on June 9, 2024

I handed over management for vsgQt as don't have the required Qt expertise to support the project. If @mathieu needs to pass on the management I'm happy to grant write access to others.

I haven't closely followed the various threads/contributions to vsgQt so am not in position to know who would be appropriate to open out write access to. @mathieu could you decide who would be appropriate?

Also knowing who would be willing to take over would be useful too.

from osgqt.

DeadParrot avatar DeadParrot commented on June 9, 2024

I would consider being a co-maintainer on this with @mtola and/or others but my time is very limited and I have no deep OpenGL expertise to offer.

from osgqt.

mtola avatar mtola commented on June 9, 2024

It was finally decided that in my next project we would no longer use OSG so I will gradually move away from OSG.

from osgqt.

horenso avatar horenso commented on June 9, 2024

Hi,
I'm trying to build @DeadParrot's port on Ubuntu 22.04 LTS, has anyone tried that yet?
I cloned and installed OpenSceneGraph and then when building osgqt it says:

/usr/bin/ld: cannot find -lWidgets: No such file or directory
/usr/bin/ld: cannot find -lOpenGLWidgets: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [examples/osgviewerQt/CMakeFiles/example_osgviewerQt.dir/build.make:117: bin/osgviewerQt] Error 1
make[1]: *** [CMakeFiles/Makefile2:199: examples/osgviewerQt/CMakeFiles/example_osgviewerQt.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

from osgqt.

horenso avatar horenso commented on June 9, 2024

I forgot to update my comment, it does build when I build OSG myself. I had issues using the Ubuntu package of osg.

I build like this

# Build and install OpenSceneGraph

git clone https://github.com/openscenegraph/OpenSceneGraph.git
cd OpenSceneGraph
# A few bug fixes after OpenSceneGraph-3.6.5
git switch --detach 683403244a489fe3e71f1533580c22e099774a36
mkdir build
cmake -S . -B build \
	-DCMAKE_INSTALL_PREFIX=$install_path \
	-DBUILD_OSG_DEPRECATED_SERIALIZERS:BOOL="0" \
	-DOpenGL_GL_PREFERENCE="LEGACY"
make -C build install
cd ..

# Build and install osgQT

git clone https://github.com/DeadParrot/osgQt.git
# TODO: master if this is merged in the future (fingers crossed)
cd osgQt
git switch topic/Qt6
mkdir build
# Build in release mode
cmake -S . -B build \
	-DCMAKE_INSTALL_PREFIX:PATH=$install_path \
	-DOSG_DIR:PATH="$install_path/include" \
	-DCMAKE_BUILD_TYPE="Release" \
	-DOpenGL_GL_PREFERENCE="LEGACY" \
	-DBUILD_OSG_EXAMPLES:BOOL="0"
# Build in debug mode
make -C build install
cmake -S . -B build \
	-DCMAKE_INSTALL_PREFIX:PATH=$install_path \
	-DOSG_DIR:PATH="$install_path/include" \
	-DCMAKE_BUILD_TYPE="Debug" \
	-DOpenGL_GL_PREFERENCE="LEGACY" \
	-DBUILD_OSG_EXAMPLES:BOOL="0"
make -C build install
cd ..

from osgqt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.