qml

QML - Vertical Swipe View?

允我心安 提交于 2019-12-14 02:04:52
问题 Is it possible to use the SwipeView in QML for vertical swiping rather than horizontal? I'd like the Page contents of a SwipeView to float vertically, so a user has to scroll up and down to navigate between Pages. If this is not possible how would I go about it? UPDATE This functionality has been added to QT as seen here: http://doc-snapshots.qt.io/qt5-dev/qml-qtquick-controls2-swipeview.html#orientation-prop 回答1: After some more research I came up with a solution that works fine, using a

Shadow for qml frameless windows

拥有回忆 提交于 2019-12-14 01:54:53
问题 I have frameless main window, created by qml ( ApplicationWindow {..} in my main.qml file) I instantiate qml by QQmlApplicationEngine::load (class introduced in Qt5.1). If I set the Qt.FramelessWindowHint flag, the window is frameless, but loses shadow (in Windows). How to add shadow to my window? My window listing: ApplicationWindow { id: rootWindow color : "#f8f8f8" maximumHeight: 445 minimumHeight: 445 minimumWidth: 730 maximumWidth: 730 flags : Qt.FramelessWindowHint | Qt.Window Component

QML : How to read a QList from C++

孤街醉人 提交于 2019-12-14 01:51:37
问题 I have a simple need : I have defined a C++ class class MyClass: public QDeclarativeItem { Q_OBJECT public: MyClass(QDeclarativeItem * parent=0); ... private: QList<QString> mList } And of course, I've registered it : qmlRegisterType<MyClass>(...) I want to access in the QML code to my QList<QString> mList . How can I do it? It annoys me as it looks like a simple problem, but I can't find anything about this. (I can create a Q_INVOKABLE slot, but I can't read the results, etc...) Edit : QML

How to dynamically add components in QML?

蹲街弑〆低调 提交于 2019-12-14 00:16:19
问题 I am trying to create a component on the fly when a button is pressed, then add it to the current parent. I'm not sure what I am doing wrong here, I have this simple layout: import QtQuick 2.0 import Ubuntu.Components 0.1 import "components" import "componentCreation.js" as MyScript /*! \brief MainView with a Label and Button elements. */ MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" // Note! applicationName needs to match the "name" field of

Why do I get a “QDeclarativeComponent:Component is not ready” error?

痞子三分冷 提交于 2019-12-13 21:22:15
问题 I have done few things but stuck in one particular example. The code is like MyItem.qml import QtQuick 1.0 Item { function myQmlFunction(msg) { console.log("Got message:", msg) return "some return value" } } main.cpp QDeclarativeEngine engine; QDeclarativeComponent component(&engine, "MyItem.qml"); QObject *object = component.create(); QVariant returnedValue; QVariant msg = "Hello from C++"; QMetaObject::invokeMethod(object, "myQmlFunction", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG

Installing ruby-qml - ERROR: Failed to build libqmlbind - What is missing?

大城市里の小女人 提交于 2019-12-13 20:04:53
问题 I am trying to install ruby-qml on Ubuntu 15.10 (Wily). I had previously checked for prerequisites. There is nothing documented for Linux on the web site. I had checked some usual suspects (build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev git-core subversion autoconf xorg-dev libgl1-mesa-dev libglu1-mesa-dev). Checking/installing libqt5qml5 libqt5quick5 qtdeclarative5-dev qt5-default fixed

Add objects to QML layout from C++

一世执手 提交于 2019-12-13 19:36:13
问题 How can I, from the C++, add some more Rectangle s dynamically to the one with id root ? For example, two more Rectangle s colored red and green ? main.qml: Rectangle { id: root } Typical QML objects to add under 'root': Rectangle { color: "red"; width: 200; height: 200 } Rectangle { color: "green"; width: 200; height: 200 } Qt Creator generated main.cpp : int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral

Qt (QML) Dashed Circle

萝らか妹 提交于 2019-12-13 17:44:17
问题 Is there any way to draw half dashed circle in QML? I drawn half circle in this way var Circle = getContext("2d"); Circle.save(); var CircleGradient = Circle.createLinearGradient(parent.width/4,parent.height,parent.width/4,0); CircleGradient.addColorStop(0, firstGradientPoint); CircleGradient.addColorStop(1, secondGradientPoint); Circle.clearRect(0, 0, parent.width, parent.height); Circle.beginPath(); Circle.lineCap = "round"; Circle.lineWidth = 10; Circle.strokeStyle = CircleGradient Circle

Refreshing QQuickWidget in QML file After Button Click

一曲冷凌霜 提交于 2019-12-13 17:34:16
问题 Created a MapWidget using QQuickWidget and a qml file to zoom into the given location coordinates. However, the map does not refresh whenever the coordinates changed. I am trying to connect a button that can be clicked to update the map but with no luck so far. Is there a way to obtain an id for the button and pass it on to the qml file to update or refresh the map whenever the coordinates are changed? main.py class MapWidget(QtQuickWidgets.QQuickWidget): def __init__(self, parent=None):

QML - Move to top #TOP

做~自己de王妃 提交于 2019-12-13 17:25:58
问题 I am using a Flickable which is embedded in a Rectangle. There is a button in the bottom of the rectangle. My requirement is when I press the button my Flickable will move to top. Its almost like #TOP in HTML. Is anybody have an idea how to achieve this? 回答1: You should be able to set Flickable's contentY property to 0. 来源: https://stackoverflow.com/questions/7564558/qml-move-to-top-top