qt5.5

Qt QML ComboBox override wheel events

强颜欢笑 提交于 2020-01-02 08:51:33
问题 Is there any way to override ComboBox MouseArea to ignore wheel event instead of changing current index? ComboBox itself has no option to change wheel focus behaviour. So far I've tried to override onWheel from CB MouseArea with code like this: ComboBox { Component.onCompleted: { for (var i = 0; i < combobox_ctrl.children.length; ++i) { console.log(combobox_ctrl.children[i]) console.log(combobox_ctrl.children[i].hasOwnProperty('onWheel')) if (combobox_ctrl.children[i].hasOwnProperty('onWheel'

[Windows, Qt5, QMediaPlayer, QMediaPlaylist]: Tiny duration black screen when the current video source changed

佐手、 提交于 2019-12-25 12:52:25
问题 I'm writing a Video Player with Qt5::QMediaPlayer to play randomly some videos for a randomly duration as this: int main(int argc, char *argv[]) { QApplication a(argc, argv); QMediaPlaylist* playlist = new QMediaPlaylist(&a); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/A-060405V4651.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/E-102604.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/C-102304.WMV")); QMediaPlayer*

[Windows, Qt5, QMediaPlayer, QMediaPlaylist]: Tiny duration black screen when the current video source changed

∥☆過路亽.° 提交于 2019-12-25 12:52:10
问题 I'm writing a Video Player with Qt5::QMediaPlayer to play randomly some videos for a randomly duration as this: int main(int argc, char *argv[]) { QApplication a(argc, argv); QMediaPlaylist* playlist = new QMediaPlaylist(&a); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/A-060405V4651.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/E-102604.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/C-102304.WMV")); QMediaPlayer*

How to make double MouseArea take effect?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 02:56:21
问题 Here is my QML code : Rectangle { ..... Rectangle { ....height and width is smaller than parent MouseArea { id: mouseArea2 anchors.fill: parent hoverEnabled: true onEntered: { console.log("enter 2") } } } MouseArea { id: mouseArea1 anchors.fill: parent hoverEnabled: true onEntered: { console.log("enter 1") } } } Only mouseArea1 takes effect. If I remove mouseArea1 then mouseArea2 takes effect. So I think the mouse event must be handled by mouseArea1 and let it couldn't be passed to mouseArea2

How to change the titlebar color of a window in a Qt/Qml application?

懵懂的女人 提交于 2019-12-22 23:39:33
问题 I would like to change the colour of the (top) border and the titlebar of the window of my application in Qt 5.5, but can't find any solution. I know I can create a frameless windows (but then resizing doesn't work) and style my own window, I can also change the background colour of the window, but the border colour. I think there is probably since most apps in Windows 10 are able to do this. 来源: https://stackoverflow.com/questions/32251399/how-to-change-the-titlebar-color-of-a-window-in-a-qt

QPainter::drawPixmap() doesn't look good and has low quality?

妖精的绣舞 提交于 2019-12-21 02:30:28
问题 I'm trying to draw an icon(.png) inside a QWidget with QPainter::drawPixmap() : QPixmap _source = "/.../.png"; painter.setRenderHint(QPainter::HighQualityAntialiasing); painter.drawPixmap(rect(), _source); but in comparing to QLabel (for example) and in lower size (19*19 in my case) the result isn't perfect. What can I do? ****Edit**** QLabel with pixmap @ size 19*19: My painting @ size 19*19 via SmoothPixmapTransform render type: 回答1: You are setting the wrong render hint, you need QPainter:

How to display correctly Treeview with QML Qt 5.5

Deadly 提交于 2019-12-19 07:35:03
问题 I'm trying to create a correct Treeview with Qml Qt 5.5. I succeed to have a Treeview with a global root. But impossible to find how to add child for row item. For the moment I got something like that : TreeView { id:listTree anchors.fill: parent anchors.leftMargin: 1 headerVisible: false backgroundVisible: false selection: ItemSelectionModel { model: myModel } TableViewColumn { role: "name" } itemDelegate: Item { Text { anchors.verticalCenter: parent.verticalCenter color: styleData.textColor

How to display correctly Treeview with QML Qt 5.5

落爺英雄遲暮 提交于 2019-12-19 07:34:52
问题 I'm trying to create a correct Treeview with Qml Qt 5.5. I succeed to have a Treeview with a global root. But impossible to find how to add child for row item. For the moment I got something like that : TreeView { id:listTree anchors.fill: parent anchors.leftMargin: 1 headerVisible: false backgroundVisible: false selection: ItemSelectionModel { model: myModel } TableViewColumn { role: "name" } itemDelegate: Item { Text { anchors.verticalCenter: parent.verticalCenter color: styleData.textColor

How to display correctly Treeview with QML Qt 5.5

二次信任 提交于 2019-12-19 07:34:26
问题 I'm trying to create a correct Treeview with Qml Qt 5.5. I succeed to have a Treeview with a global root. But impossible to find how to add child for row item. For the moment I got something like that : TreeView { id:listTree anchors.fill: parent anchors.leftMargin: 1 headerVisible: false backgroundVisible: false selection: ItemSelectionModel { model: myModel } TableViewColumn { role: "name" } itemDelegate: Item { Text { anchors.verticalCenter: parent.verticalCenter color: styleData.textColor

How to get the current value of a QComboBox with a model with two columns?

左心房为你撑大大i 提交于 2019-12-12 12:04:54
问题 I have a QComboBox with a QSqlQueryModel as its model. The model is constructed from a database with SELECT type_id, type FROM types where type_id is int and type is a varchar . I set the QComboBox visible column with the setModelColumn(1) function, to see the actual types, instead of the indexes, but when a value is selected, I need to retrieve the type_id and I don't know how to achieve that. I can't use here the currentIndex() function, because the current index of the QComboBox is useless