[Gambas-user] qt5

Ian Haywood ihaywood3 at ...626...
Thu Jun 16 10:32:40 CEST 2016


On Wed, Jun 15, 2016 at 5:40 AM, Benoît Minisini
<gambas at ...1...> wrote:
> Le 14/06/2016 13:21, Ian Haywood a écrit :
>>
>> The problem quite complicated. Gambas looks for Qt4 and Qt5. If both are found,
>> Qt4 is loaded.
>
> No, if Qt5 and Qt4 are present, Qt5 is used.
>
> The choice between both is implemented in the gb.gui.qt component. So if
> you have ideas about how to enhance the algorithm, tell me!
>From the 3.8.4 sources: main/lib/gui.qt/main.c
I interperse my "translation", tell me where I'm wrong

    59         if (use == USE_NOTHING)
so GB_GUI hasn't been set
     60         {
     61                 use = USE_GB_QT4;
 try Qt4
     63                 env = getenv("KDE_FULL_SESSION");
     64
     65                 if (env && !strcmp(env, "true"))
     66                 {
     67                         env = getenv("KDE_SESSION_VERSION");
     68                         if (env)
     69                         {
     70                                 if (strcmp(env, "4") == 0)
     71                                         use = USE_GB_QT4;
     72                                 else if (strcmp(env, "5") == 0)
     73                                         use = USE_GB_QT5;
     74                         }
     75                 }
     76         }
     look for some KDE variables (which won't be set at all on non-KDE systems)
     78         switch (use)
     79         {
     80                 case USE_GB_QT4: comp = "gb.qt4"; break;
     81                 case USE_GB_QT5: comp = "gb.qt5"; break;
     82                 default: comp = "gb.qt5"; break;
     83         }
turn setting constant into a string (remember we have set to
"USE_GB_QT4" above so "gb.qt4" will always be selected here)

     85         if (GB.Component.Load(comp))
try the first one
     86         {
     87                 comp2 = use == USE_GB_QT5 ? "gb.qt4" : "gb.qt5";
 that didn't work, try the other
     89                 if (GB.Component.Load(comp2))
     90                 {
fail if that doesn't work either.
     91                         fprintf(stderr, "gb.gui.qt: error:
unable to find any QT component\n");
     92                         exit(1);
     93                 }

my patch is very, very simple: line 61 becomes "use = USE_GB_QT5;",
and so Qt5 is loaded first.

Ian




More information about the User mailing list