qml

Qt QML LevelAdjust shows strange edge effects when applied to svg source

倖福魔咒の 提交于 2020-01-24 22:52:46
问题 When applying a LevelAdjust effect to an image, Qt doesn't seem to handle the edges properly. I have a set of svg icons, all drawn in black. I would like to change their color easily on the fly. I am experimenting with the LevelAdjust effect from QtGraphicalEffects 1.12. According to the doc, using minimumOutput should shift the color curve in a linear fashion: blacks will correspond to minimumOutput, white will be white, and colors in between will be a prorated version of minimumOutput. If I

Qt QML LevelAdjust shows strange edge effects when applied to svg source

左心房为你撑大大i 提交于 2020-01-24 22:52:03
问题 When applying a LevelAdjust effect to an image, Qt doesn't seem to handle the edges properly. I have a set of svg icons, all drawn in black. I would like to change their color easily on the fly. I am experimenting with the LevelAdjust effect from QtGraphicalEffects 1.12. According to the doc, using minimumOutput should shift the color curve in a linear fashion: blacks will correspond to minimumOutput, white will be white, and colors in between will be a prorated version of minimumOutput. If I

qml自定义界面定制(二)从左到右,icon加文本按钮

扶醉桌前 提交于 2020-01-24 22:38:53
/* 从左到右,icon +文字的按钮 */ import QtQuick 2.0 Rectangle { height: 50; width: parent.width signal iconClicked(); signal iconEntered(); signal iconExited(); property alias iconSrc: icon.source property alias iconText: iconLabel.text Image { id: icon anchors.left: parent.left anchors.leftMargin: 10 anchors.verticalCenter: parent.verticalCenter } Text { id: iconLabel color: "#3B3E50" font.pixelSize: 16 elide: Text.ElideRight width: parent.width-icon.width +60 anchors.left: icon.right anchors.leftMargin: 10 anchors.verticalCenter: parent.verticalCenter } MouseArea { anchors.fill: parent hoverEnabled:

Exposing QList<customobj *> to QML

三世轮回 提交于 2020-01-24 21:16:27
问题 I am trying to expose QList with custom objects ( Sample ) into QML. Whenever I store those custom objects (they inherits form QObject) into QList<QObject *> , they show up, but without info, but when I try expose them as a QList<Sample *> , they don't. sample.h class Sample : public QObject { Q_OBJECT Q_PROPERTY(QString getVar READ getVar WRITE setVar NOTIFY varChanged) public: explicit Sample(); //! Returns var QString getVar() const { return var; } //! Sets var void setVar(const QString &a

Exposing QList<customobj *> to QML

不打扰是莪最后的温柔 提交于 2020-01-24 21:14:27
问题 I am trying to expose QList with custom objects ( Sample ) into QML. Whenever I store those custom objects (they inherits form QObject) into QList<QObject *> , they show up, but without info, but when I try expose them as a QList<Sample *> , they don't. sample.h class Sample : public QObject { Q_OBJECT Q_PROPERTY(QString getVar READ getVar WRITE setVar NOTIFY varChanged) public: explicit Sample(); //! Returns var QString getVar() const { return var; } //! Sets var void setVar(const QString &a

Qml GridLayout how to specify a column width?

一笑奈何 提交于 2020-01-24 19:23:20
问题 I have a column with two groupbox which each have a GridLayout . Here is my code: Window { visible: true width: 500 height: 480 title: qsTr("GridLayoutTest") Column { GroupBox { contentWidth: gl1_.width contentHeight: gl1_.height GridLayout { id: gl1_ columns: 2 width: 200 Rectangle { Layout.preferredWidth: 60; Layout.preferredHeight: 25; color: "purple"; } Rectangle { Layout.preferredWidth: 45; Layout.preferredHeight: 25; color: "purple"; } Rectangle { Layout.preferredWidth: 50; Layout

Get active Tab from TabView and change item property

柔情痞子 提交于 2020-01-24 09:31:07
问题 In the context of a dual-pane file manager, I have two TabView items side by side, each contains multiple tabs of course, and each Tab loads a TableView showing the content of a specific directory using FolderListModel . SplitView TabView Tab Tab TabView Tab My current task is to implement a toolbar button to toggle the showHidden property of the FolderListModel instance shown in the active tab. Therefore, I need a way to find out what the currently active tab is. Next, once I get the active

QList<T*> to qml array

余生长醉 提交于 2020-01-24 08:45:30
问题 I have a class Bar which inherits from QObject. I want to have a QList of Bar pointers in class Foo and expose it in qml. foo.h #ifndef FOO_H #define FOO_H #include <QQuickItem> class Bar : public QObject { Q_OBJECT Q_PROPERTY(int x READ x) public: explicit Bar(QObject *parent = nullptr) : QObject(parent), mX(123) {} virtual ~Bar() {} int x() const { return mX; } private: int mX; }; class Foo : public QQuickItem { Q_OBJECT Q_PROPERTY(QList<QObject *> t1 READ t1) Q_PROPERTY(QList<Bar *> t2

QML ListView populate property does not work (its animation)

你离开我真会死。 提交于 2020-01-23 12:29:45
问题 I have following QML ListView inside ueLoginWindow : import QtQuick 2.0 import QtMultimedia 5.5 import QtQuick.Controls 1.3 import QtQuick.Extras 1.4 import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import QtTest 1.1 import Enginio 1.0 import QtBluetooth 5.5 import QtCanvas3D 1.0 import QtLocation 5.5 import QtNfc 5.5 import QtPositioning 5.5 import QtQuick.LocalStorage 2.0 import QtQuick.XmlListModel 2.0 import QtSensors 5.5 import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebSockets

QML ListView populate property does not work (its animation)

删除回忆录丶 提交于 2020-01-23 12:29:07
问题 I have following QML ListView inside ueLoginWindow : import QtQuick 2.0 import QtMultimedia 5.5 import QtQuick.Controls 1.3 import QtQuick.Extras 1.4 import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import QtTest 1.1 import Enginio 1.0 import QtBluetooth 5.5 import QtCanvas3D 1.0 import QtLocation 5.5 import QtNfc 5.5 import QtPositioning 5.5 import QtQuick.LocalStorage 2.0 import QtQuick.XmlListModel 2.0 import QtSensors 5.5 import QtWebChannel 1.0 import QtWebKit 3.0 import QtWebSockets