简体   繁体   中英

In Qt Creator, examples are missed

Installed Qt Creator 2.8 in ArchLinux Installed qt5-* (* as every related package) using pacman

QT_SYSROOT:
QT_INSTALL_PREFIX:/usr
QT_INSTALL_ARCHDATA:/usr/lib/qt
QT_INSTALL_DATA:/usr/share/qt
QT_INSTALL_DOCS:/usr/share/doc/qt
QT_INSTALL_HEADERS:/usr/include/qt
QT_INSTALL_LIBS:/usr/lib
QT_INSTALL_LIBEXECS:/usr/lib/qt/libexec                                                                                                              
QT_INSTALL_BINS:/usr/lib/qt/bin                                                                                                                      
QT_INSTALL_TESTS:/usr/tests                                                                                                                          
QT_INSTALL_PLUGINS:/usr/lib/qt/plugins                                                                                                               
QT_INSTALL_IMPORTS:/usr/lib/qt/imports                                                                                                               
QT_INSTALL_QML:/usr/lib/qt/qml                                                                                                                       
QT_INSTALL_TRANSLATIONS:/usr/share/qt/translations                                                                                                   
QT_INSTALL_CONFIGURATION:/etc/xdg                                                                                                                    
QT_INSTALL_EXAMPLES:/usr/share/doc/qt/examples                                                                                                       
QT_INSTALL_DEMOS:/usr/share/doc/qt/examples                                                                                                          
QT_HOST_PREFIX:/usr                                                                                                                                  
QT_HOST_DATA:/usr/lib/qt                                                                                                                             
QT_HOST_BINS:/usr/lib/qt/bin                                                                                                                         
QT_HOST_LIBS:/usr/lib                                                                                                                                
QMAKE_SPEC:linux-g++                                                                                                                                 
QMAKE_XSPEC:linux-g++                                                                                                                                
QMAKE_VERSION:3.0
QT_VERSION:5.1.0

I know OP asked for archlinux but I faced the same issue with Ubuntu 20.04. To solve it I had to install the following two packages:

sudo apt-get install qtbase5-examples qtbase5-doc-html

This will show the basic widget examples.

Additional examples (eg qt quick) can be added by installing them explicitly:

sudo apt install qtquickcontrols2-5-examples

To actually get them displayed in qtcreator I had to install:

sudo apt install qt5-doc qt5-doc-html

Here is the output of echo $(apt-mark showmanual | grep -P '(libqt|qt)')

cmake-qt-gui qt5-default qt5-doc qt5-doc-html qtbase5-dev qtbase5-doc-html qtbase5-examples qtcreator qtquickcontrols2-5-examples

Edit:

Also make sure to install the qml modules you need, for example:

sudo apt install qml-module-qtquick-controls2

Navigate to the installation location of the examples and open the .pro project file with qt-creator.

Alternatively if you just want to build and run the example. Navigate to the directory qmake and then make and then simple run the output

Additionally if you strictly require the examples to show in the IDE, try launching with admin privileges as the installation directory of the examples may require admin privileges.

QtCreator Examples are added in Official Repository 'Extra'

https://www.archlinux.org/packages/extra/any/qt5-examples/

install it using :-

sudo pacman -S qt5-examples

My situation is that qt example folder has no permission to read and execute for non-root users, fixed it and everything OK. In your case:

sudo chmod +rx /usr/share/doc/qt/examples

I am also using archlinux and have had the same problem. Despite not having the examples & demo installed the qmake-qt5 -query is printing a non-existence path.

It seems Qt5 examples are now on AUR(Arch User Repository).

To get the them

  1. Download https://aur.archlinux.org/packages/qt/qt5-examples/qt5-examples.tar.gz
  2. Extract the package maybe with $ tar xzf qt5-examples.tar.gz
  3. cd qt5-examples which contains the PKGBUILD . Then run makepkg .This will download 165MB qt-everywhere-opensource-src-5.2.0.tar.xz
  4. Run pacman -U qt-everywhere-opensource-src-5.2.0.tar.xz

只需从 AUR PKGBUILD 安装示例: https : //aur.archlinux.org/packages/qt5-examples/

Qtcreator cannot detect the example without its html file.

So, in my case I've already installed qtbase5-examples, but could not able to see examples in qtcreator.

After,

sudo apt-get install qtbase5-doc-html

examples are visible in qtcreator. It was the same with qt5serialport-examples.

sudo apt-get install qt5serialport-examples qtserialport5-doc-html

Have a nice one.

make sure you run the qt-opensource-linux-x86-android-5.4.0.run like this:

$sudo ./qt-opensource-linux-x86-android-5.4.0.run

please do not forget the "sudo" or you will find that the examples in the qtcreator is missing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM