Qt5 port

560 views
Skip to first unread message

Alexander Sokolov

unread,
Feb 7, 2013, 11:15:29 PM2/7/13
to razo...@googlegroups.com
Qt guys promises that porting on Qt5 will be easy, but not for us. As you know in Qt5 libraries was splitted. We are using "#include <Module/Header>" form for includes (https://github.com/Razor-qt/razor-qt/wiki/Coding-Style section Including headers).
In Qt5 modules are changed, as result we we should to add #ifdef for includes directivies in the all files. 
I talked wit ABBAPOH (author of the andromeda and Qt5 mime module) and he said that we understand next passage incorrectly. 

In public header files, always use this form to include Qt headers: #include <QtCore/qwhatever.h>. The library prefix is neccessary for Mac OS X frameworks and is very convenient for non-qmake projects.

This only for Qt headers itself, but in the end-users programs programmers should to use simple "#include <Header>" form in that case porting on Qt5 will be real easy.

PICCORO McKAY Lenz

unread,
Feb 8, 2013, 8:34:31 AM2/8/13
to razo...@googlegroups.com
i good to make a brand to begin port in github...separate from qt4 brand of razorqt?


--
--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Razor-qt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to razor-qt+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Lenz McKAY Gerardo (PICCORO)

Alec Moskvin

unread,
Feb 8, 2013, 9:47:32 AM2/8/13
to razo...@googlegroups.com
On Thursday 07 February 2013 20:15:29, Alexander Sokolov wrote:
> Qt guys promises that porting on Qt5 will be easy, but not for us. As you
> know in Qt5 libraries was splitted. We are using "#include <Module/Header>"
> form for includes (https://github.com/Razor-qt/razor-qt/wiki/Coding-Style section Including
> headers).
> In Qt5 modules are changed, as result we we should to add #ifdef for
> includes directivies in the all files.
> I talked wit ABBAPOH (author of the andromeda and Qt5 mime module) and he
> said that we understand next passage incorrectly.
> *
>
> *
> >
> > *In public header files, always use this form to include Qt headers:
> > #include <QtCore/qwhatever.h>. The library prefix is neccessary for Mac OS
> > X frameworks and is very convenient for non-qmake projects.*
>
> http://qt-project.org/wiki/Coding-Conventions
>
> This only for Qt headers itself, but in the end-users programs programmers
> should to use simple "#include <Header>" form in that case porting on Qt5
> will be real easy.
>

Well, fixing headers is the easy part:
find . -name '*.cpp' -or -name '*.h' -exec sed -i -e 's:\(#include\s*<\)Qt[^>]*/:\1:' '{}' \;

Now if someone could get CMake to work with both Qt4 and Qt5 for at
least the libraries...

Luís Pereira

unread,
Feb 8, 2013, 4:31:10 PM2/8/13
to razo...@googlegroups.com
On Fri, Feb 8, 2013 at 6:47 AM, Alec Moskvin <al...@gmx.com> wrote:
Well, fixing headers is the easy part:
  find . -name '*.cpp' -or -name '*.h' -exec sed -i -e 's:\(#include\s*<\)Qt[^>]*/:\1:' '{}' \;

there is a tool for that. 

Now if someone could get CMake to work with both Qt4 and Qt5 for at
least the libraries...
 
I've some experience. I can do it



--
        Luís Pereira

Kuzma Shapran

unread,
Feb 9, 2013, 1:22:28 AM2/9/13
to razo...@googlegroups.com
I also have a CMake-based project which can be built with any of Qt4 and Qt5.

The main thing is:

find_package(Qt4 4.4.0 COMPONENTS QtCore QtGui QtDBus)

if(NOT QT4_FOUND)
	find_package(Qt5Core)
	find_package(Qt5Widgets)
	find_package(Qt5DBus)
endif()

message(STATUS "Using Qt version ${QTVERSION}")

if(${QT_VERSION_MAJOR} EQUAL 4)
	include(${QT_USE_FILE})
endif()

The rest is easy - everything depends on ${QT_VERSION_MAJOR}:
For example linking:
if(${QT_VERSION_MAJOR} EQUAL 4)
	target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
elseif(${QT_VERSION_MAJOR} EQUAL 5)
	qt5_use_modules(${PROJECT_NAME} Core Widgets DBus)
endif()

Macros like
qt4_wrap_cpp, qt4_add_resources, qt4_wrap_ui, qt4_create_translation
renamed to qt5_...

Basically that's it. I don't know whether it's a proper way, but it works for me and I hope it will help.

Александр Соколов

unread,
Feb 9, 2013, 3:44:58 AM2/9/13
to razo...@googlegroups.com
So, do we can change codding style? 

2013/2/8 Alec Moskvin <al...@gmx.com>
--
--
You received this message because you are subscribed to the Google
Groups "Razor-qt" group.
For more options, visit this group at
http://groups.google.com/group/razor-qt?hl=en

---
You received this message because you are subscribed to the Google Groups "Razor-qt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to razor-qt+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Best regards,
Alexander.

Alec Moskvin

unread,
Feb 9, 2013, 11:29:11 AM2/9/13
to razo...@googlegroups.com
I guess it's better than:

#if QT_VERSION < 0x050000
#include <QtGui/QPushButton>
#else
#include <QtWidgets/QPushButton>
#endif

So I vote for changing it.

Alec Moskvin

unread,
Feb 9, 2013, 11:30:17 AM2/9/13
to razo...@googlegroups.com
That would be really appreciated!

>
>

Kuzma Shapran

unread,
Feb 9, 2013, 3:56:06 PM2/9/13
to razo...@googlegroups.com
I also vote for readability (i.e. #include <QPushButton> ), despite the fact that I prefer module names included.



BTW, it's better:

#include <QtCore/qglobal.h>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)

than:

#if QT_VERSION < 0x050000

Luís Pereira

unread,
Feb 14, 2013, 2:23:21 PM2/14/13
to razo...@googlegroups.com
On Fri, Feb 8, 2013 at 10:22 PM, Kuzma Shapran <leaf.o...@gmail.com> wrote:
>
> find_package(Qt4 4.4.0 COMPONENTS QtCore QtGui QtDBus)
>
>
> if(NOT QT4_FOUND)
>
> find_package(Qt5Core)
>
> find_package(Qt5Widgets)
>
> find_package(Qt5DBus)
>
> endif()
>
>
> message(STATUS "Using Qt version ${QTVERSION}")
>
>
> if(${QT_VERSION_MAJOR} EQUAL 4)
>
> include(${QT_USE_FILE})
>
> endif()


That's the basic idea.
But we also have to account for the possibility of both Qt4 and Qt5
are installed.
That's the reasoning behind FindQt.cmake
http://cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/FindQt.cmake;hb=HEAD

--
Luís Pereira

Kuzma Shapran

unread,
Feb 14, 2013, 2:32:09 PM2/14/13
to razo...@googlegroups.com
As you can see, my example prefers Qt4 in case if both are installed, but we can add some switches to force Qt5 to be used - something like -DCMAKE_PREFER_QT5.

In your link FindQt.cmake only supports Qt3 and Qt4, is there anywhere version which supports Qt5 as well?

Luís Pereira

unread,
Feb 14, 2013, 2:38:18 PM2/14/13
to razo...@googlegroups.com
On Thu, Feb 14, 2013 at 11:32 AM, Kuzma Shapran <leaf.o...@gmail.com> wrote:
> As you can see, my example prefers Qt4 in case if both are installed, but we
> can add some switches to force Qt5 to be used - something like
> -DCMAKE_PREFER_QT5.

Of course

> In your link FindQt.cmake only supports Qt3 and Qt4, is there anywhere
> version which supports Qt5 as well?

At the time no

FCore

unread,
Feb 26, 2013, 7:06:48 AM2/26/13
to razo...@googlegroups.com
If you plan to use QT5 in future then please do not force users to use GPU always, CPU is always most robust, stable and future proof.

Leslie Zhai

unread,
Mar 30, 2014, 9:51:24 PM3/30/14
to razo...@googlegroups.com
Hey guys,

I am preparing to add USE_QT5 option and other Qt5_XXX for cmake file at first https://github.com/xiangzhai/razor-qt/commit/2f47d352c226b1e611afa1fbcaae88a1b248eb8c

Then add #if QT_VERSION >= 0x50000 macro and Qt5 style source code, such as Qt5 bindings for PackageKit https://github.com/xiangzhai/PackageKit-Qt/commit/a2308b9812935b5ea66fc73c5be8c313d9ff22f4

I just want to know whether or not some other guys already did it or prepare to do, if so, I can follow them and work together instead :)

Regards,
Leslie Zhai

Jerome Leclanche

unread,
Mar 31, 2014, 12:44:03 AM3/31/14
to razo...@googlegroups.com
Hi

Appreciate any contributions to the Qt5 port. But please use the
current upstream which is LXQt:
https://github.com/LXDE/lxde-qt/

Cheers
J. Leclanche
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Razor-qt" group.
> For more options, visit this group at
> http://groups.google.com/group/razor-qt?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Razor-qt" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to razor-qt+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Luís Pereira

unread,
May 2, 2014, 1:53:01 PM5/2/14
to razo...@googlegroups.com
I did some work on the QtX cmake modules.
Please check it out at: https://github.com/luis-pereira/qtxmodules

--
Luís Pereira

Leslie Zhai

unread,
May 3, 2014, 3:05:38 AM5/3/14
to razo...@googlegroups.com
Hi Luís,

Thanks for your reply :)

I am migrating qtpanel to qt5 https://github.com/xiangzhai/qtpanel
and eggwm https://github.com/xiangzhai/eggwm

So I might not follow the razor-qt project.

Regards,
Leslie Zhai <xiang...@i-soft.com.cn>

Jerome Leclanche

unread,
May 3, 2014, 3:29:11 AM5/3/14
to razo...@googlegroups.com
Why not focus on LXQt panel?

https://github.com/lxde/lxqt-panel
J. Leclanche

Leslie Zhai

unread,
May 3, 2014, 3:39:23 AM5/3/14
to razo...@googlegroups.com, Sian Cao
Hi Jerome,

I tried to compile the BIG lxqt relative projects followed the READMEs
in github repos, but it FAILED! even if I am able to FIX it with my
hacking patch, I still argued that it should be fixed by CO-developers
such as Jserv or other maintainers. it is real BAD experience if failed
to compile the lxqt with github repos, but razor-qt is better in this case.

And I just want to develop TINY WM/DE, for example, eggwm/qtpanel are
very tiny, so I choose to maintain them, perhaps I will try lxqt
relative components again later :)

Regards,
Leslie Zhai <xiang...@i-soft.com.cn>

Jerome Leclanche

unread,
May 3, 2014, 4:18:12 AM5/3/14
to razo...@googlegroups.com, Sian Cao
You should know LXQt essentially replaces Razor entirely. razor-panel
has been replaced by lxqt-panel, which can be built and installed
independently from LXQt. You do need some libs though, there is a wiki
page for it.
J. Leclanche

Leslie Zhai

unread,
May 3, 2014, 4:18:16 AM5/3/14
to razo...@googlegroups.com
Hi Jerome,

Yup I know razor-qt`s upstream is lxqt :)

But I wanna develop or maintain a WM for Qt5 based on X11 or Wayland.

I will try lxqt-panel later, thanks for your introduce :)

Leslie Zhai

unread,
May 3, 2014, 9:36:41 PM5/3/14
to razo...@googlegroups.com
Hi Jerome,

How is your day :)

I git clone the lxqt-panel, and I found it is based on Qt4, is not it?

But qtpanel https://github.com/xiangzhai/qtpanel and eggwm
https://github.com/xiangzhai/eggwm have been migrated to Qt5 right now,
it is better to deploy only one Qt runtime for saving space :)

Jerome Leclanche

unread,
May 3, 2014, 9:53:12 PM5/3/14
to razo...@googlegroups.com
Well that's the thing, isn't it? We've been actively porting all of
LXQt to Qt5 and help is more than welcome, which is why it's a little
annoying seeing efforts go to an unmaintained project instead.
J. Leclanche

Leslie Zhai

unread,
May 3, 2014, 10:11:08 PM5/3/14
to razo...@googlegroups.com
Hi Jerome,

GREATE :)

Have you guys ported the CMAKE files to Qt5? for example, cmake
-DUSE_QT5=ON .. just like PackageKit-Qt
https://github.com/xiangzhai/PackageKit-Qt

I wanna work together to migrate lxqt relative components to Qt5 :)

Regards,
Leslie Zhai

Jerome Leclanche

unread,
May 3, 2014, 10:38:11 PM5/3/14
to razo...@googlegroups.com, lxde-list, 洪任諭
This is a question for PCMan; he's been working on it.

Let's move things to the lxde ML.
J. Leclanche
Reply all
Reply to author
Forward
0 new messages