qt

Use a QSortFilterProxyModel from QML with PyQt5

允我心安 提交于 2021-02-10 22:24:33
问题 I try to combine a QML view with a QSortFilterProxyModel within PyQt5. Unfortunately I can't get it to work in any way. My main problem right now seems to be to pass the items back from QML. But even if this would be possible it seems that it does not work, I get TypeError: QSortFilterProxyModel.setSourceModel(QAbstractItemModel): argument 1 has unexpected type 'PyCapsule' if I set the model directly in python. Currently I have: class SortFilterProxyModel(QSortFilterProxyModel): @pyqtProperty

QListWidget crash when reusing the widget associated with item

佐手、 提交于 2021-02-10 22:21:34
问题 I have a custom simple widget inheriting from QWidget and I add it to a QListWidget like this : void MainWindow::AddToWidgetList(const QString &tag, const QString &html) { HtmlItem *html_item = new HtmlItem(); html_item->set_tag(tag); html_item->set_html(html); connect(html_item, SIGNAL(RemoveIt(uintptr_t)), this, SLOT(on_RmBtn_clicked(uintptr_t))); QListWidgetItem *list_item = new QListWidgetItem(); html_item->set_list_item(list_item); list_item->setSizeHint(html_item->sizeHint()); ui-

QListWidget crash when reusing the widget associated with item

故事扮演 提交于 2021-02-10 22:20:49
问题 I have a custom simple widget inheriting from QWidget and I add it to a QListWidget like this : void MainWindow::AddToWidgetList(const QString &tag, const QString &html) { HtmlItem *html_item = new HtmlItem(); html_item->set_tag(tag); html_item->set_html(html); connect(html_item, SIGNAL(RemoveIt(uintptr_t)), this, SLOT(on_RmBtn_clicked(uintptr_t))); QListWidgetItem *list_item = new QListWidgetItem(); html_item->set_list_item(list_item); list_item->setSizeHint(html_item->sizeHint()); ui-

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

Qt Creator: community vs enterprise

喜欢而已 提交于 2021-02-10 18:40:54
问题 I downloaded and installed two versions of Qt, one is 5.9.4 and the other is 5.11.2. On operating system, one is shown with Community tag and the other with Enterprise tag. I wonder what the difference is: To clarify, I think I downloaded open-source version of Qt 5.11.2, but it is tagged as enterprise. 回答1: Qt Creator Commercial Features: You can use the following Qt Creator features if you have the appropriate Qt license. Performance Analyzer Browsing ISO 7000 Icons in the Design mode

Qt Creator: community vs enterprise

家住魔仙堡 提交于 2021-02-10 18:39:05
问题 I downloaded and installed two versions of Qt, one is 5.9.4 and the other is 5.11.2. On operating system, one is shown with Community tag and the other with Enterprise tag. I wonder what the difference is: To clarify, I think I downloaded open-source version of Qt 5.11.2, but it is tagged as enterprise. 回答1: Qt Creator Commercial Features: You can use the following Qt Creator features if you have the appropriate Qt license. Performance Analyzer Browsing ISO 7000 Icons in the Design mode

Zooming in / out on images - QT c++

不想你离开。 提交于 2021-02-10 18:35:05
问题 I am currently using QT to load images into a graphicsview scene. Essentially, I am looking for a way to be able to zoom in and out on the loaded image using a slider. The image loads successfully into the pane, but whatever I try to implement to zoom in / out, the image would disappear. This is how it looks: This is my implemented function, but the image disappears: void MainWindow::on_horizontalSlider_valueChanged(int value) { float pool ; if(value==0 ) pool=0.1; else pool = value*0.01;

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

c++ programming for joystick in windows

时光毁灭记忆、已成空白 提交于 2021-02-10 18:00:45
问题 i want to connect joystick to my c++ qt program in windows.I studied about programming with win32 api using the joystickapi library in microsoft guid for joystick program But I didn't understand exactly What should I do after checking the system compatibility? Completion description: my code for system compatibility: JOYINFO joyinfo; UINT wNumDevs, wDeviceID; BOOL bDev1Attached, bDev2Attached; void joyCapablitis(){ if((wNumDevs = joyGetNumDevs()) == 0) qDebug()<<"no driver available";