Can't switch keyboard layout in all Qt5 applications - qt

I use elementary OS Loki based on Ubuntu 16.04.2
I have Qt5 installed in /opt/Qt/ (is it a native and correct place, by the way? or there is a better one?)
To have it recognized by apps, I've created the /etc/ld.so.conf.d/qt5.conf file, which contains the "/opt/Qt/5.8/gcc_64/lib" string.
I use TeXstudio to write in Russian and I always need two layouts: ru and en. But TeXstudio, Neovim-Qt and even Qt Creator does not react on layout switch and always remain with the layout that was enabled on an app startap. I found several tickets for GNOME and Qt5 with this issue, but they were closed back in 2014...
What kind of problem I face? To be honest, when I used a very old Qt and a very old texstudio form ubuntu repositories, everything worked fine. But I needed a fresh Qt5 for Neovim-Qt and after adding the "/etc/ld.so.conf.d/qt5.conf" file (which points the system to the new Qt5), I faced the described bug.
I also notice a pretty strange behavior: If I switch the layout and type a letter immideately, sometimes it goes in the new layout, but the second and further letters are in the old one...
What can I do with it?

Related

How can I make the Eclipse Oomph information browser visible?

I am on Ubuntu 22.04 latest with Wayland with a stock standard latest Eclipse committer edition. I am trying to use Oomph, but find that most of the information is unreadable, due to fly-outs selecting specific colors or the ordering of panes.
I have changed theme and detail views on the OS and Eclipse level and pinned the colors for various dialogue types to now avail.
Before I file a bug, I would like to know if anyone has seen this effect. A bug DB search did not turn up any results.
This is due Eclipse playing poorly with Wayland.
export GDK_BACKEND=x11
before invoking Eclipse turns x11 back on. Here things work ok.
Here is the documentation of the GDK_BACKEND environment variable. It hints the Wayland renderer to use the Wayland implementation old X11 system.

SVG icon is not showing up in a Qt, portable application under Ubuntu

For some reason, I want to publish my application as a portable one. That is, avoiding the pre-installed shared libraries and use my own ones, shipped together with the app.
Long story short. Following the advises on this helpful page, I found that the window icon, which is an svg, not showing up in the foreign computer. What did I miss?
Turns out a shared library it needs cannot be found.
In Windows, you have to put Qt5Svg.dll in the same folder of the exe. And in Linux, besides the libQt5Svg.so.5, iconengines/libqsvgicon.so is also needed.

How can I compile Qt app in Linux using Windows style?

I'm developing a Qt Widgets application and due to compile performance issues, I started developing it in Linux Ubuntu instead of Windows. The problems is that, when compiled and run, the app appears with traditional Ubuntu style instead of Windows (7) style. Since the app is only for Windows, I'ld like to know how can I compile it inside Linux Ubuntu but making it appear with Windows style.
I tried using QApplication::setStyle(QStyleFactory::create("QWindowsStyle")); in main.cpp, without success. I guess the QtAssistant docs just aren't clear enough on how can I do this change. Any help will be appreciated.
Could you by any chance be using a Qt package that is compiled without the style? Can you try running QStyleFactory::keys() to verify that the style exists?
It can't be done, since the style's elements are rendered by Windows (or OS X), not by Qt. Qt's style implementation asks the OS libraries to provide bitmaps of those elements. If you wanted to, you could modify the style to use a disk cache for static items. You could then use the style on all platforms. The problem is that these OS-provided bitmaps are a part of the OS and thus non-redistributable.
The only plastform-specific style that at least used to be available everywhere was the old Windows 95 style, in times of Qt 3. I'm not sure what its current status is.
First check out put of QStyleFactory::keys()
then set the look by calling
qApp->setStyle("Windows");
This command will give you windows 98 look. If you want windows vista look you should configure qt sources with -style-windowsvista and rebuild all sources.
UPDATE
according to http://doc.qt.io/qt-5/qstylefactory.html#details qt style is not platform independent. So IT IS IMPOSSIBLE to have that native look in not windows platform. It's worth mentioning that in windows also Windows SDK itself is required in order to build sources of Qt otherwise your application will look like windows 98 in windows 7.

Qt: Enumerating Windows on the desktop(s)

My Qt application (that will run on Windows, OS X and Ubuntu) has a need to:
List all windows everywhere
Obtain their caption text (if any)
Obtain an Icon of the application, if any, as QIcon or QPixmap (e.g. App Icon)
Obtain some kind of unique ID about them (e.g. HWND on windows)
I know how to do this for Windows using Win32. I can research Mac and Ubuntu separately, but I was wondering if there's an abstracted/unified Qt approach to assist me?
Nope, those are OS specific:
http://www.qtcentre.org/threads/41730-How-to-enumerate-all-top-level-windows
As for starting down the quest of what's doable through published APIs...some X11 hints here:
How to identify top-level X11 windows using xlib?
On Macs, the "forward-looking" way to build Qt is against "Cocoa" instead of "Carbon":
http://doc.qt.nokia.com/latest/developing-on-mac.html#carbon-or-cocoa
And according to other SOers, it's the accessibility API (which has to be enabled by users, it seems) that can do this enumeration:
Get a list of opened windows cocoa
Mac / Cocoa - Getting a list of windows using Accessibility API
Then the question becomes how inside of a C++ application to make "calls out" to Cocoa APIs which are natively Objective-C:
How to mix Qt, C++ and Obj-C/Cocoa
...or you could just not do this. :-)
I would suggest keeping track of this information yourself. It wouldn't be perfect (just have a singleton class and overload the setWindowTitle() calls in your root window types) but would be platform-independent . . .

Is there a way to run Qt Creator from command line supplying a .pro file to open (or how do we deal with multiple Qt installations)?

I have multiple installations of Qt4 on my Windows XP SP2 machine and have installed Qt Creator 2.1 today. However, running the project (.pro) files spawns the oldest version of Qt Designer installed (the one installed in 2009 together with the rest of the framework).
Since
I would not like to remove any previous installations of Qt
and for some obscure reason even if I explicitly ask Windows Explorer to always use the version I need it does not
I would like to give up a bit and just sript the needed behaviour in a .bat file like:
e:\path\to\qtcreator.exe %1
This opens Qt Creator, but something seems to prevent it from treating the .pro file properly (in short, the project does not "open" as it should).
Qt documents have a page on the matter at Qt Creator: Using Command Line Options, but it seems to ignore the topic in question.
Since Qt (being as excellent framework as it is) is also known to have its quirks (like that of qmake), I wonder, may be there is an undocumented way to solve my problem?
(Another way to fix the thing would of course be to make the correct version of Qt Designer run, but frankly I'd prefer the "hard-wired" solution since the mechanisms provided by Qt itself are still a bit unreliable.)
The libraries and tools used for a particular project (and a configuration in it) is set in the Projects panel in Qt Creator:
http://doc.qt.io/qtcreator/creator-build-settings.html
Selecting the Qt version to use with a project should force it to run the Designer that's part of the version. If it doesn't, then you should report it as a bug.

Resources