web-dev-qa-db-ja.com

QTCreatorにUbuntu.Components 0.1がないのはなぜですか?

まず、ここで説明するようにQML&QT Creatorを使用して「hello world」アプリを作成する必要があります http://developer.ubuntu.com/get-started/gomobile/

第二に、私はQMLプラットフォームと依存関係をインストールしようとしていたとき、ubuntu 12.04に基づいたディストリビューション(バックボックス)を持っているが、次のように解決するため、ステップ2(「Ubuntu QMLツールキットプレビューのインストール」)を実行できませんでしたこの投稿の手順: https://askubuntu.com/questions/235440/how-do-i-install-the-qml-toolkit-on-12-04

第三に、QTCreatorを開いて CurrencyConverter (helloWorldアプリ)を実行しようとすると、プログラムは次のパッケージを見つけることができません。

import Ubuntu.Components 0.1

アプリを実行するにはどうすればよいですか?

前もって感謝します。

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: root
    width: units.gu(60)
    height: units.gu(80)
    color: "lightgray"

    property real margins: units.gu(2)
    property real buttonWidth: units.gu(9)

    Label {
       id: title
       ItemStyle.class: "title"
       text: i18n.tr("Currency Converter")
       height: contentHeight + root.margins
       anchors {
           left: parent.left
           right: parent.right
           top: parent.top
       }
    }
}
13
CodeArtist

少なくともubuntu 12.04の解決策を見つけました。公式サイト http://qt-project.org/downloads#qt-creator に行き、Qt 5.0.0である最新のQtパッケージをダウンロードする必要がありました。

*:Ubuntu 12.04には最新のQtバージョンが含まれていないため、手動でダウンロードする必要があります。

*:インストールの前に、以前のバージョンのQtCreator(2.5.0)を削除しました

Qt5パッケージをインストールするために必要なことは次のとおりです。

  • chmod 755 qt-linux-opensource-5.0.0-x86_64-offline.run

次に、パッケージを実行し、デフォルト設定でインストーラーを実行します。

  • ./qt-linux-opensource-5.0.0-x86_64-offline.run

  • これで、すべてのライブラリとともに/opt/qt5/imports/Ubuntu/Componentsパスが存在するはずです!

その後、 CurrencyConverter の指示に従いました

*その行:import Ubuntu.Components 0.1はまだ赤い線で強調表示されていますが、プログラムはTools > External > Qt Quick > Preview (qmlviewer)を選択することで正常に実行されます(ありがとう@David Planella)

3
CodeArtist

あなたは実際にオプションに行くことができます->ビルドして実行-> qtバージョン(私はポーランド語バージョンを持っているので、英語に戻す必要があります-名前がわずかに異なる場合は申し訳ありません)。次に、qtの最新バージョンを追加します。これは既にインストール済みです-/opt/qt5/binにあります。

0
Tomasz

QT5が適切にインストールされていて、import Ubuntu.Components 0.1が強調表示されている場合、これを行う必要があります。

  • .qmlprojectファイルを開く(自動生成プロジェクトに含まれる)
  • 次のテキストを追加:importPaths: [ "/opt/qt5/imports" ]最後のクローズの前:}

...そして問題はなくなるはずです。

0
kuba.murky

特定の例の.proファイルを開いて、すべてのqtデモを実行/ビルドすることになるでしょう。

chown -R yourusername /opt/qt5/examples/

Qtcreator内でtextures.proファイルを開いてopengl/texturesサンプルをビルドすると、プロジェクトが自動的に構成されましたが、デフォルトではQT4を指していました。 qt4を使用してビルドしようとしたときにQtWidgetsが見つからないという奇妙なエラーが発生しました。 Qt5をビルドツールとして使用すると、問題はなくなりました。

Qtcreatorのデフォルトではないため、デバッグ/リリース用のプロジェクトビルドとしてQT5を指定してください。そうしないと、ビルド時に奇妙なエラーが発生します。この問題は、qt5 includeおよびqt5 libsパスを示すはずのコンパイル出力で簡単に見つけることができます。

2:58:51: Running steps for project textures...
12:58:51: Starting: "/usr/bin/make" clean -w
make: Entering directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop Release'
rm -f qrc_textures.cpp
rm -f moc_glwidget.cpp moc_window.cpp
rm -f glwidget.o main.o window.o qrc_textures.o moc_glwidget.o moc_window.o
rm -f *~ core *.core
make: Leaving directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
12:58:52: The process "/usr/bin/make" exited normally.
12:58:52: Configuration unchanged, skipping qmake step.
12:58:52: Starting: "/usr/bin/make" -w
make: Entering directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o glwidget.o ../textures/glwidget.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o main.o ../textures/main.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o window.o ../textures/window.cpp
/opt/qt5/bin/rcc -name textures ../textures/textures.qrc -o qrc_textures.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o qrc_textures.o qrc_textures.cpp
/opt/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. ../textures/glwidget.h -o moc_glwidget.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o moc_glwidget.o moc_glwidget.cpp
/opt/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. ../textures/window.h -o moc_window.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o moc_window.o moc_window.cpp
g++ -m64 -Wl,-O1 -Wl,-rpath,/opt/qt5/lib -o textures glwidget.o main.o window.o qrc_textures.o moc_glwidget.o moc_window.o   -L/usr/X11R6/lib64 -L/opt/qt5/lib -lQtOpenGL -lQtWidgets -lQtGui -lQtCore -lGL -lpthread 
make: Leaving directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
12:58:57: The process "/usr/bin/make" exited normally.
0
user123744