qt5

How to build Qt (with QtWebEngine support) using meta-toolchain-qt5?

邮差的信 提交于 2019-12-22 08:01:53
问题 I am trying to build Qt using meta-toolchain-qt5 , but when I do this via poky-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-vfp-vfpv4-neon-toolchain-2.0.1.s‌​‌​h , I don't see anything about QtWebEngine in the sysroot directory. I also tried to build Qt using the following command bitbake meta-toolchain-qt5 but it is the same result; I don't have anything regarding Qt WebEngine. How can I build Qt with QtWebEngine support? 回答1: Looking at meta-toolchain-qt5 it inherits populate_sdk_qt5 , which

How to connect signals from singleton object defined in C++ code to QML component?

℡╲_俬逩灬. 提交于 2019-12-22 07:50:43
问题 My main objective is to receive signals from singleton objects while defining QML component in *.qml file. Let's say I defined a singleton object in C++ code like this: class MySingleton : public QObject { Q_OBJECT Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged) typedef QObject Base; public: static MySingleton* instance(); const QString& value() const; void setValue(const QString& value); signals: void valueChanged(); private: MySingleton(QObject* parent = nullptr);

How to use QCommandLineParser for arguments with multiple params?

那年仲夏 提交于 2019-12-22 04:58:41
问题 I wonder, how can I use multiple- or sub-arguments with QCommandLineParser? For example: /home/my_app --my_option_with_two_params first_param second_param --my-option-with-one-param param? 回答1: Try this which has the analogy of -I /my/include/path1 -I /my/include/path2 : --my_option_with_two_params first_param --my_option_with_two_params second_param ... and then you can use this method to have access to the values: QStringList QCommandLineParser::values(const QString & optionName) const

QML screen orientation lock

时光怂恿深爱的人放手 提交于 2019-12-22 04:27:14
问题 I need to lock the screen to a specific orientation for an android app that I'm making. is there a way to do that in QML? Google didn't get me any answers. I am using Qt 5.2. 回答1: You can basically use the Screen.orientation property for reading only. See the following example for details: http://qt-project.org/doc/qt-5/qtquick-window-screeninfo-qml.html The proper way as of today is to use the Android manifest file for this as done by the Qt Android developer at Digia for his QtHangMan game

Qt internationalization and CMake: how to update *.ts and don't lose them

微笑、不失礼 提交于 2019-12-22 04:06:06
问题 I'm having this CMakeLists.txt in directory with translation files ( *.ts ): SET(TRANSLATIONS lang_de.ts lang_en.ts ) FIND_PACKAGE(Qt5LinguistTools) QT5_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS}) SET(QM_FILES ${QM_FILES} PARENT_SCOPE) ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES}) It builds *.qm files from specified *.ts . But I want to improve this and get two custom targets, which won't built automatically. One for appending new strings from sources into ts files, and one for

Running simple QtWebEngine app on Raspberry Pi 2, page not showing

梦想的初衷 提交于 2019-12-21 22:35:09
问题 I compiled and installed QtWebEngine + QML plugins on Raspberry Pi 2 with Yocto recipes using information in this tutorial using Yocto dizzy branch and run the following script: root@raspberrypi2:~# more chromium.qml import QtQuick 2.1 import QtQuick.Controls 1.1 import QtWebEngine 0.9 ApplicationWindow { width: 1280 height: 720 color: "lightgray" visible: true WebEngineView { id: webview url: "file:///home/root/hello.html" anchors.fill: parent } } Note that the IMPORT VERSION 0.9, not 1.0 I

How to create smooth rounded corners on a popup widget in Qt

邮差的信 提交于 2019-12-21 21:19:58
问题 I've been searching for hours now - without much luck. I have a widget with the windowsflag Qt::Popup set, and I'm trying to create smooth rounded corners. I've tried using a stylesheet, but then the transparent part of the corners become black. The same happens if a overwrite the widget's paint event and draw a rectangle with rounded corners in the widget. I've also tried to set a mask, but the result gets very pixelated. After some reading I found out that the black corners appears because

How to create QML object within a singleton?

跟風遠走 提交于 2019-12-21 20:15:38
问题 I have defined a QML object under MyQMLObject.qml . This QML file looks like this: import QtQuick 2.4 Item { id: rootItem implicitWidth: LayoutUtils.maxImplicitWidth(children) implicitHeight: LayoutUtils.maxImplicitHeight(children) Text { id: text1 } Text { id: text2 } // ... Text { id: textN } } The text is added dynamically when the application starts. For each language different text is added, there for the width of the rootItem varies by the chosen language. I would like to somehow create

Qt5 Signal/Slot syntax w/ overloaded signal & lambda

自古美人都是妖i 提交于 2019-12-21 17:08:06
问题 I'm using the new syntax for Signal/Slot connections. It works fine for me, except when I try to connect a signal that's overloaded. MyClass : public QWidget { Q_OBJECT public: void setup() { QComboBox* myBox = new QComboBox( this ); // add stuff connect( myBox, &QComboBox::currentIndexChanged, [=]( int ix ) { emit( changedIndex( ix ) ); } ); // no dice connect( myBox, &QComboBox::editTextChanged, [=]( const QString& str ) { emit( textChanged( str ) ); } ); // this compiles } private: signals

How to fix gstreamer error in Qt5?

半城伤御伤魂 提交于 2019-12-21 15:44:30
问题 I want to create a small mp3 player as a toy project so started with Qt for the GUI. When I try to play an mp3 file i get this error. Warning: "No decoder available for type 'audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)3, rate=(int)44100, channels=(int)2, parsed=(boolean)true'." Error: "Your GStreamer installation is missing a plug-in." I installed gstreamer and it's plugins after googling around sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad