I created file dialogs to select files within a Qt application. When migrating to Qt5 I encounter a regression, the file dialog is much poorer when linking against Qt5 rather than Qt4:
Qt4
Qt5
For example it is very hard for an user to navigate to the network mounted share directories.
The code is as simple as this:
QString path;
path = QFileDialog::getExistingDirectory(this, tr("Pick a file"));
QFileDialog::DontUseNativeDialog does not change anything.
My OS is Ubuntu 16.04, I have both nautilus (3.14.3) and nemo (2.8.7) installed. nemo is configured to be the default file manager:
xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search
Every other application seems to use the same dialog as the Qt4 file dialog screenshot.
How do I get the "old" file dialog in Qt5?
If I try with QT_QPA_PLATFORMTHEME= ./my_app then I get this:
The following works for me on Ubuntu 16.04 – it is more of a workaround than an actual solution, though:
Edit: First make sure that the package libqt5libqgtk2 is installed. It brings the GTK2 bindings for Qt5. If the package is not installed, the file choosers will look like the last screenshot shown in the question above.
Then, assuming you want to launch your application my_app from a terminal, launch it as follows (mind the space after =):
$ QT_QPA_PLATFORMTHEME= my_app
This is because, according to a bug report on launchpad, there seems to be a problem with the Ubuntu package appmenu-qt5: the package forces Qt5 dialogs to become non-native as a side effect of explicitly setting QT_QPA_PLATFORMTHEME=appmenu-qt5 via /etc/profile.d/appmenu-qt5.sh. Unsetting the platform theme via QT_QPA_PLATFORMTHEME= before launching your application changes this behavior locally.
Edit: When using the described approach, however, the global menu might not work in my_app.
Related
After last update (I'm using Manjaro GNU/Linux distribution) I am not able to see any pane when opening RStudio. Only the Toolbar and buttons with icons like that to open new or existent files, open folders, and save files are shown.
If I go to View -> Panes, and change options there, nothing seems to happen, or a tiny window is open where only apply and OK buttons are visible. If other options are selected, eg. File -> New File, a bunch of text appears for a short time and then disappears, but nothing is shown after that. Similarly, a message indicating RStudio window.program_mode = "desktop" appears momentarily when opening the application.
If RStudio is opened from the command line terminal, the following error messages appear:
Qt WebEngine resources not found at /share/qt/resources. Trying parent directory...
Qt WebEngine resources not found at /share/qt. Trying application directory...
Qt WebEngine resources not found at /usr/lib/qt/libexec. Trying fallback directory... The application MAY NOT work.
Path override failed for key base::DIR_QT_LIBRARY_DATA and path '/home/user/.QtWebEngineProcess'
Installed Qt WebEngine locales directory not found at location /share/qt/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /usr/lib/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Path override failed for key ui::DIR_LOCALES and path '/home/user/.QtWebEngineProcess'
[0101/102738.515189:ERROR:resource_bundle.cc(887)] Failed to load /home/user/.QtWebEngineProcess/qtwebengine_resources.pak
Some features may not be available.
[0101/102738.515234:ERROR:resource_bundle.cc(887)] Failed to load /home/user/.QtWebEngineProcess/qtwebengine_resources_100p.pak
Some features may not be available.
[0101/102738.515240:ERROR:resource_bundle.cc(887)] Failed to load /home/user/.QtWebEngineProcess/qtwebengine_resources_200p.pak
Some features may not be available.
[0101/102738.515965:WARNING:resource_bundle_qt.cpp(117)] locale_file_path.empty() for locale
Use of deprecated not thread-safe setter, use setUrlRequestInterceptor instead.
Use of deprecated not thread-safe setter, use setUrlRequestInterceptor instead.
"Invalid splitter position detected: 304/0"
So far, I've tried to reinstalling RStudio and qt, and deleting .rstudio-desktop/, but no luck, and I am not able to figure out what is going on. Any ideas?
I had the same issue on Arch and found this solution on the bug reports: https://bugs.archlinux.org/task/64973
It was solved by adding this /usr/lib/qt/libexec/qt.conf
[Paths]
Prefix = /usr/lib/qt
Data = /usr/share/qt
Translations = /usr/share/qt/translations
Hope it helps someone else.
I've been trying to automate some basic stuff with Robotframework. Here is my configuration.
Python - 2.7.10
MAC High Sierra 10.13.2
Eclipse Oxygen with RED Editor
I've downloaded Geckodriver executable and put in under several places including usr/local/bin, folder on desktop
Here is what i've tried
Setup FFDriver Set Environment Variable webdriver.gecko.driver Users/[my username]/Desktop/geckodriver
Setup FFDriver Set Environment Variable webdriver.gecko.driver usr/local/bin/geckodriver
and my test
open browser http://www.google.com firefox
I've added usr/local/bin in PATH as well and still getting "geckodriver executable needs to be in PATH" error. The same happens with Chromedriver too. I am sure I must be missing something trivial here, can someone help me out please?
Launching the eclipse from command prompt, has fixed this issue. Yes, the PATH is not being inherited when launched from desktop icon.
when you use Python. the best shortcut you can do is, put you 'geckodriver.exe' file in pythons script folder. and set the Script folder path in you system path. this will resolve your problem.
I'm trying to set up a python like environment with Atom-editor on a Linux machine.
I find the autocomplete-python package that uses jedi.
In the settings of the package I tried to add some python path where the APIs are (/usr/lib/python2.7/dist-packages/) but then the autocompletion doesn't recognize these libraries (for example the PyQt ones)
Am I missing something?
For anybody having the same issue please look here.
Basically everything should work out of the box, but if it does not -- try to configure path to python executable with which you have installed your external module. If it's still fails to complete -- try to configure extra path to python modules. (usually your site-packages directory)
I am trying to set up an OpenGL development environment on a Linux machine (Mint 17). I have just installed GLEW from the source on the GLEW source forge page (Downloaded source; extracted; make install).
I want to check that everything is set up correctly and am trying to run a test program. My program compiles and links but when I try to run it I get the error "error while loading shared libraries: libGLEW.so.1.12: cannot open shared object file: No such file or directory"
libGLEW.so.1.12 exists; from what I read I think I have a 32bit executable and the SO is 64bit. However I can't find a solution to this problem; I know I need to create a 32bit library but I can't find any instructions for doing this.
Can someone please provide instructions to either (or preferably both):
Install 32bit libraries for GLEW
Link with GLEW statically
Preferably I'd like to link statically for now (I find it far more convenient for testing) but the instructions on the GLEW website only say how to do this for windows. Eventually I do plan to link everything dynamically.
I want to setup Qt Creator (3.0) in a way, that I can debug into the Qt classes. So I download the corresponding src code (http://gitorious.org/qt/qt5) and install it in a directory (e.g. c:\Qt5\src).
Then I have my own project. Where do I need to set the source code path of Qt (c:\Qt5\src), so I can debug my code, but also into a Qt class where necessary.
-- Edit:Pavel's comment --
Pavel has given a good hint: But I am using a precompiled version of Qt/Qt Creator. So I am basically looking for a solution which does not require me to compile from source. Nevertheless a useful hint. Thanks.
If you are using a prebuilded version just remap the source code location as described in http://doc.qt.io/qtcreator/creator-debugger-engines.html
Mapping Source Paths
To enable the debugger to step into the code and display the source
code when using a copy of the source tree at a location different from
the one at which the libraries where built, map the source paths to
target paths:
Select Tools > Options > Debugger > General > Add.
In the Source path field, specify the source path in the debug information of the executable as reported by the debugger.
In the Target path field, specify the actual location of the source tree on the local machine.
To get "the source path in the debug information of the executable as reported by the debugger", you can activate the "Use Tooltips in Stack-View when Debugging" option by right-clicking in the Stack View and move the mouse over a specific function call.
If you look into the tooltips, you will see references to /Users/qt/work, the Mac deployed debug symbols are pointing there. Of course, this is not documented, as these folks want you to buy enterprise.
If you create the /Users/qt/work directory (as root), then make a soft link to your source directory named qt, everything will work. No need to build anything from source (under Mac that would result in tens of gigs wasted). Same considerations about plugins
Example:
sudo -s
mkdir /Users/qt
cd /Users/qt
mkdir work
cd work
ln -s /Users/your_user_name/Qt/your_qt_release/Src qt
Everything will work. Any source mapping failed here, so leave those alone.
Hope this helps
With Xcode, before you step into the Qt library the first time, enter the following command in the LLDB window:
settings set target.source-map /Users/qt/work/qt /path/to/Qt/5.10.1/Src
(Obviously you'll want to change the version number, as relevant).
But suppose Trolltech changes its build directory, what to do then? (Or, how did the community wiki that gave the /Users/qt/work/qt path find it?) You can guess what the path needs to be by editing /path/to/Qt/5.10.1/clang_64/lib/QtCore.framework.dSYM/Contents/Resources/DWARF/QtCore_debug (or any other Qt library) and searching for some paths. "/Users" seems like a good guess. About 2% into the library you'll start seeing sections with a lot of paths like:
../../include/QtCore/../../src/corelib/kernel^#../../include/QtCore
/../../src/corelib/tools^#global^#/Users/qt/work/qt/qtbase/src/corelib
/../../include/QtCore/../../src/corelib/arch^#/Applications/Xcode.app
/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/<etc>
Look for an absolute path that looks like it could be writable. (/Applications/... would not be a likely build path, for example)
In recent Qt creator (v 4.11) press button "Add Qt Sources"
in Tools > Options > Debugger > General
and select Qt sources file.
Qt5 should be installed by online installer with checked "Qt Debug Information files".
Follow the instructions from Qt here:
"In the run configuration, select Use debug version of frameworks."