qt5

Font stretching in QML

旧城冷巷雨未停 提交于 2021-02-10 18:55:12
问题 We are converting some older QT widget code to use QML and I cannot find the equivalent property for the QFont::setStretch() operation. The QML Font page shows only family, bold, italic, underline, pointSize, pixelSize, weight, overline, strikeout, capitalization, letterSpacing, wordSpacing, kerning, preferShaping and hintingPreference. This font selection is being done within a Text object, along the lines of: Text { font.family: "LiberationSans" font.pixelSize: 178 font.weight: 80 //font

Font stretching in QML

夙愿已清 提交于 2021-02-10 18:50:43
问题 We are converting some older QT widget code to use QML and I cannot find the equivalent property for the QFont::setStretch() operation. The QML Font page shows only family, bold, italic, underline, pointSize, pixelSize, weight, overline, strikeout, capitalization, letterSpacing, wordSpacing, kerning, preferShaping and hintingPreference. This font selection is being done within a Text object, along the lines of: Text { font.family: "LiberationSans" font.pixelSize: 178 font.weight: 80 //font

Hide area of QGraphicsItem that is out of boundary

纵然是瞬间 提交于 2021-02-10 18:16:11
问题 I have a QGraphicsPixmap item in a QGraphicsScene . The item has flags set to ItemIsMovable , and ItemIsSelectable . How do I ensure that when the item is moved out of a certain boundary - it can be a QGraphicsScene or just a fixed frame size at fixed coordinates - the part becomes hidden? Eg. The left part of the basketball becomes hidden. 回答1: You have to use setClipPath() . In the following code I have created a class that inherits from QGraphicsPixmapItem (the same could do with other

Can I use QCommandLineParser to determine GUI mode or CLI mode?

╄→尐↘猪︶ㄣ 提交于 2021-02-10 16:55:30
问题 One of the programs that I work with has two modes that it can run in: GUI (Graphical User Interface) mode or CLI (Command-Line Interface) mode. We determine which mode to use via a command line argument (i.e., if "--cli" is passed, it will use CLI mode). The type of QApplication that is instantiated depends on which mode is used: QApplication should be used for GUI mode, and QCoreApplication should be used for CLI mode, because the GUI parts of Qt should not be instantiated for CLI mode

How to Add Dynamic Data to a QML Table

三世轮回 提交于 2021-02-09 11:46:22
问题 I'm trying to add rows to a table from Python. I'm using a TableView described with QML. I can't figure out how to add a model to the table, unless the model is also in QML. But I can't figure out how to add values to the model. import sys from PyQt5.QtCore import QAbstractTableModel, QObject, QUrl from PyQt5.QtQml import QQmlApplicationEngine from PyQt5.QtQuick import QQuickView from PyQt5.QtWidgets import QApplication myApp = QApplication(sys.argv) engine = QQmlApplicationEngine() context =

format date/time value shown by a QTableView

北战南征 提交于 2021-02-08 11:14:09
问题 I´m using a QTableView to show a database table via model. One of the table columns have a timestamp, acctually a QDateTime was stored there before. Is there some way to format the timestamp value at presentation time? I was thinking in something like the .toString of a QDateTime("yyyy-MM-dd hh:mm:ss.zzz") . 回答1: It is possible to return date formatted as you wish in this virtual method of QAbstractItemModel : QVariant QAbstractItemModel::data(const QModelIndex &item, int role = Qt:

format date/time value shown by a QTableView

人走茶凉 提交于 2021-02-08 11:13:02
问题 I´m using a QTableView to show a database table via model. One of the table columns have a timestamp, acctually a QDateTime was stored there before. Is there some way to format the timestamp value at presentation time? I was thinking in something like the .toString of a QDateTime("yyyy-MM-dd hh:mm:ss.zzz") . 回答1: It is possible to return date formatted as you wish in this virtual method of QAbstractItemModel : QVariant QAbstractItemModel::data(const QModelIndex &item, int role = Qt:

Yocto build error for python and qt5

百般思念 提交于 2021-02-08 10:40:52
问题 I'm getting below yocto build error and I'm not sure what is the problem. I am trying to build yocto for my warpx board. Able to build headless image but not headfull. Can you please anyone point out any issue ? I have used yocto krogoth version with freescal platform bsp. These are the commands I followed. repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b krogoth repo sync cd sources git clone https://github.com/Kynetics/meta-warpx.git cd meta-warpx git checkout krogoth

Yocto build error for python and qt5

耗尽温柔 提交于 2021-02-08 10:40:45
问题 I'm getting below yocto build error and I'm not sure what is the problem. I am trying to build yocto for my warpx board. Able to build headless image but not headfull. Can you please anyone point out any issue ? I have used yocto krogoth version with freescal platform bsp. These are the commands I followed. repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b krogoth repo sync cd sources git clone https://github.com/Kynetics/meta-warpx.git cd meta-warpx git checkout krogoth