QTCreator에서 Ubuntu.Components 0.1이 누락 된 이유는 무엇입니까?


13

우선 http://developer.ubuntu.com/get-started/gomobile/에 설명 된대로 QML 및 QT Creator를 사용하여 "hello world"앱을 만들어야합니다.

둘째, QML 플랫폼과 종속성을 설치하려고 할 때 우분투 12.04를 기반으로 배포판 (백 박스)이 있기 때문에 2 단계 ( "Ubuntu QML 툴킷 미리보기 설치")를 실행할 수 없지만 다음과 같이 해결합니다. 이 게시물의 지침 : /ubuntu/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
       }
    }
}

더 많은 정보를 추가해 주시겠습니까? 실제로 앱을 어떻게 실행하고 있습니까? 명령 줄에서 앱을 실행하면 앱이 실행됩니까? 시작하기 단계에서 다음 비트의 설치 명령을 실행 했습니까? echo 'export PATH=/opt/qt5/bin:$PATH' >> ~/.bashrc
David Planella

안녕하세요, 물론입니다. 명령을 복사하여 붙여 넣기 만하면됩니다. 100 % 정확하다고 확신하므로 첫 번째 단계와 두 번째 단계가 완료됩니다. 그 후 QTCreator를 열고 위의 세 번째 단계 지침을 따랐습니다. 위의 코드를 붙여 넣으면 "import Ubuntu.Components 0.1"행이 강조 표시되고 "QML 모듈을 찾을 수 없습니다. 가져 오기 경로 : / usr / lib / qt4 / imports"입니다. 나는 우분투를 사용하지 않고 우분투 12.04를 기반으로 배포판을 사용하고 있습니다. 유일한 차이점은 xfce4가 있고 단합이 아니라는 것입니다.
CodeArtist

@DavidPlanella 나는 12.10에 있으며 같은 경험을합니다. 나는 두 명령을 모두 복사하여 붙여 넣었고 모든 것이 잘 된 것처럼 보입니다. 예제-CurrenyConverter.qml : 2 : 1 : QtCreator에서 "Ubuntu.Components"모듈이 설치되지 않았습니다 (QtQuick 2.0에 대해서도 동일한 오류가 발생했습니다). echo $ PATH / opt / qt5 / bin : / usr / lib / lightdm / lightdm : / usr / local / sbin : / usr / local / bin : / usr / sbin : / usr / bin : / sbin : / bin : / usr / games : / usr / local / games
trent

@ JorgeCode, 당신이 설명하는 것은 코드 실행을 막지 않아야하는 Qt Creator의 경고라고 생각합니다. 위에서 요청한대로 qmlscene튜토리얼에 설명 된대로 명령 행에서 앱을 실행할 때 오류 메시지가 표시 됩니까? 그렇다면 명령 행의 정확한 결과는 무엇입니까?
David Planella

@DavidPlanella, 나는 또한 같은 오류가 발생하며 이것은 컴파일을 완료했을 때 터미널이나 Qt Creator에서 얻는 코드입니다. paste.ubuntu.com/1658717 과 수입 Ubuntu.Components 0.1에서 빨간색 선이 표시됩니다. 내가 지금해야 할 일.
rɑːdʒɑ

답변:


3

적어도 우분투 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 덕분 에 선택하여 정상적으로 실행됩니다.


그 빨간 선은 나처럼 완벽 주의자에게 방해가됩니다. 무엇이 든 원인을 고칠 수있는 방법이 있습니까?
Djentleman

0

실제로 옵션-> 빌드 및 실행-> qt 버전으로 이동할 수 있습니다 (폴란드어 버전이 있으므로 영어로 다시 번역해야합니다-이름이 약간 다른 경우 죄송합니다). 그런 다음 qt이미 설치 한 최신 버전을 추가 /opt/qt5/bin합니다.


0

QT5가 올바르게 설치되어 있고 여전히 import Ubuntu.Components 0.1강조 표시되어 있으면 다음을 수행하십시오.

  • .qmlproject 파일 열기 (자동 생성 된 프로젝트에 포함됨)
  • 이 텍스트를 추가하십시오 : importPaths: [ "/opt/qt5/imports" ]마지막 닫기 전에 :}

... 문제가 사라져야합니다.


0

특정 예제의 .pro 파일을 열어 모든 qt 데모를 실행 / 빌드하려고 할 것입니다.

chown -R yourusername /opt/qt5/examples/

qtcreator 내에서 textures.pro 파일을 열어서 opengl / textures 예제를 만들 때, 기본적으로 QT4를 가리키는 프로젝트 BUT을 자동으로 구성했습니다. 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.
당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.