Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is that possible to use library from Qt4 in Qt5? [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Is that possible to use library from Qt4 in Qt5? [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
qt4qt5library
10 Posts 4 Posters 2.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sosunS Offline
    sosunS Offline
    sosun
    wrote on last edited by sosun
    #1

    The first solution that comes to mind - substitute all headers and functions that are not in use in Qt5. Like Phonon. In this case, how can I deal with lines that seems like don't have analogues in Qt5. For instance, what should I do with Phonon::Path, Phonon::AudioOutput etc. ?

    Otherwise, will it be a bad solution, if it's even possible of course, to add Phonon library to the project and compile with it?

    K 1 Reply Last reply
    1
    • sosunS sosun

      The first solution that comes to mind - substitute all headers and functions that are not in use in Qt5. Like Phonon. In this case, how can I deal with lines that seems like don't have analogues in Qt5. For instance, what should I do with Phonon::Path, Phonon::AudioOutput etc. ?

      Otherwise, will it be a bad solution, if it's even possible of course, to add Phonon library to the project and compile with it?

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @sosun

      The question is why you want to do this??

      AFAIK the functionality of Qt 4 shall be completely replaced by functionality of Qt 5.

      One thing coming to mind is the compiler issue between versions. You would be required to compile Qt 4 or Qt 5 yourself. Next point will be the eventually existing duplication of classes. Sounds all like a major task to me, if you like to plugin one of the old major libraries. With third party libs like Qwt it is different.

      Vote the answer(s) that helped you to solve your issue(s)

      sosunS 1 Reply Last reply
      0
      • K koahnig

        @sosun

        The question is why you want to do this??

        AFAIK the functionality of Qt 4 shall be completely replaced by functionality of Qt 5.

        One thing coming to mind is the compiler issue between versions. You would be required to compile Qt 4 or Qt 5 yourself. Next point will be the eventually existing duplication of classes. Sounds all like a major task to me, if you like to plugin one of the old major libraries. With third party libs like Qwt it is different.

        sosunS Offline
        sosunS Offline
        sosun
        wrote on last edited by sosun
        #3

        @koahnig You're right, I want to use 3rd party library - liblastfm. It requires 4.8. So, at the same time I want to be able to use functionality from Qt5 classes. Is there a way I can do this?

        K 1 Reply Last reply
        0
        • sosunS sosun

          @koahnig You're right, I want to use 3rd party library - liblastfm. It requires 4.8. So, at the same time I want to be able to use functionality from Qt5 classes. Is there a way I can do this?

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @sosun My approach would be trying to compile and try to link with Qt 5. Possibly there are only minor adjustments. However, that seems to be questionable. You should try to get feedback from the lastfm contributors. They will know and they might be interested to move forward and achieve compatibility with Qt 5.

          I do not know the internal details of Qt 4 and Qt 5 enough to give a final judgement. However, I expect that the Qt 4 part will require at least some core sections. Just imagining that the same core sections are still present in Qt 5, I do not think that there is a way. How should a linker decide which of the core objects shall be used?

          It is for sure that an easy task to mix those functionalities. This looks like a major development in my opinion. The route through getting the lastfm lib working with Qt 5 looks much easier IMHO.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          1
          • M Offline
            M Offline
            mchinand
            wrote on last edited by
            #5

            Looking at the list of commits to liblastfm, there was some work done to get it working to work with Qt5. With just a quick glance, it's not clear to me if it was completed however.

            1 Reply Last reply
            1
            • sosunS Offline
              sosunS Offline
              sosun
              wrote on last edited by sosun
              #6

              @koahnig @mchinand Hm, thanks for the suggestions. I will ask developers about this opportunity. I'll put answers here as soon as developers will reply to my issue. Also, @mchinand, it's my fault I didn't notice commits about qt5-stuff, but what if I had used another 3rd party library based on Qt 4.x? This because question still has some value, but thank you for pointing me to this.

              ...Waiting answers from developers for posting it here...

              1 Reply Last reply
              0
              • sosunS Offline
                sosunS Offline
                sosun
                wrote on last edited by
                #7

                @mchinand @koahnig Well, I've noticed that AUR has this library for building with qt5 named liblastfm-qt5-git. I think this is exactly what I need. I don't know why they didn't mention anything about it in the desctiption. Also, should I notify you when developers will reply?

                K 1 Reply Last reply
                0
                • sosunS sosun

                  @mchinand @koahnig Well, I've noticed that AUR has this library for building with qt5 named liblastfm-qt5-git. I think this is exactly what I need. I don't know why they didn't mention anything about it in the desctiption. Also, should I notify you when developers will reply?

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by koahnig
                  #8

                  @sosun Bascially with any 3rd party lib you will have the same issues. At the day's end it depends how deep thing are done. However, in most cases the adjustments to be done for Qt are moderate. I consider it merely a matter of time until things have been moved to Qt 5.

                  This might be a pre-release only and they are still checking or it has been simply forgotten to update the description of lib.

                  Personally, I think you should place at least a summary of the feedback you. Eventually you can links to more details, if the info is public anyway.

                  [edit, koahnig] also a note when you succeed with or without developer's help is really useful.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  1
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi,

                    On the matter of mixing Qt 4 and Qt 5: don't even try. You'll have a symbol clash

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • sosunS Offline
                      sosunS Offline
                      sosun
                      wrote on last edited by sosun
                      #10

                      @SGaist @koahnig @mchinand Thanks to all of you! They confirmed that library can be built with Qt5. Also, if we look at the CMakeLists.txt file, we'll find some lines like these:

                      option(BUILD_WITH_QT4 "Build liblastfm with Qt4 no matter if Qt5 was found" OFF)
                      
                      if( NOT BUILD_WITH_QT4 )
                          # try Qt5 first, and prefer that if found
                          find_package(Qt5Core QUIET)
                      endif()
                      
                      if(Qt5Core_DIR)
                          set(LASTFM_LIB_VERSION_SUFFIX 5)
                          message(STATUS "Found Qt5! Please keep in mind, this is highly experimental and not our main development target..")
                      

                      You can easily choose how to build library by switching OFF/ON keywords. I had to check it before asking ;)

                      Thanks!

                      UPD: marked the issue as SOLVED

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved