IscanderCheDec. 12, 2020, 1:30 p.m.
Использование Button в качестве делегата ListView
Добрый вечер.
Написал делегата для ListView на основе Button. Без параметров signal и onClicked, где должен быть указан сигнал, всё прекрасно работает. С этими параметрами засада, поскольку на файл модели Qt Creator ругается "ListElement: cannot use script for property value". Я понимаю, что сделал глупость, когда указал в качестве параметра сигнал infoClicked() (см. второй листинг).
Как обойти эту засаду? Мне бы хотелось, чтобы кнопки взаимодействовали с кодом Qt, и тут без сигналов никуда.
main.qml
Component { id: buttonDelegate Button { id: button Image { id: image source: imageSource opacity: button.down ? 0.5 : 1 } objectName: objectNameButton signal signalButton onClicked: signalButton ToolTip.visible: hovered ToolTip.timeout: 2000 ToolTip.text: qsTr(toolTipText) } } ListView { anchors.fill: parent model: ButtonsModel {} delegate: buttonDelegate }
ButtonsModel.qml
ListModel { ListElement { imageSource: "qrc:/images/Flex-icon.png" toolTipText: "Save the active project" objectNameButton: "button1" signalButton: infoClicked() } }
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.Do you like it? Share on social networks!
AD
- Akiv Doros
- Nov. 11, 2024, 2:58 p.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:50points,
- Rating points-4
m
- molni99
- Oct. 26, 2024, 1:37 a.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:80points,
- Rating points4
m
- molni99
- Oct. 26, 2024, 1:29 a.m.
C ++ - Test 004. Pointers, Arrays and Loops
- Result:20points,
- Rating points-10
Last comments
Django - Tutorial 055. How to write auto populate field functionality Freckles because of several brand names retin a, atralin buy generic priligy
QML - Tutorial 035. Using enumerations in QML without C ++ priligy cvs 24 Together with antibiotics such as amphotericin B 10, griseofulvin 11 and streptomycin 12, chloramphenicol 9 is in the World Health Organisation s List of Essential Medici…
Qt/C++ - Lesson 052. Customization Qt Audio player in the style of AIMP It decreases stress, supports hormone balance, and regulates and increases blood flow to the reproductive organs buy priligy online safe Promising data were reported in a PDX model re…
Heap sorting algorithm The role of raloxifene in preventing breast cancer priligy precio
PyQt5 - Lesson 006. Work with QTableWidget buy priligy 60 mg 53 have been reported by Javanovic Santa et al
Now discuss on the forum
добавить qlineseries в функции buy priligy senior brother Chu He, whom he had known for many years
Всё ещё разбираюсь с кешем. priligy walgreens levitra dulcolax carbs The third ring was found to be made up of ultra relativistic electrons, which are also present in both the outer and inner rings
IscanderCheOct. 31, 2024, 3:43 p.m.
Машина тьюринга // Начальное состояние 0 0, ,<,1 // Переход в состояние 1 при пустом символе 0,0,>,0 // Остаемся в состоянии 0, двигаясь вправо при встрече 0 0,1,>…
ИМ
Реализация навигации по разделам Спасибо Евгений!
Игорь МаксимовOct. 3, 2024, 4:05 a.m.
https://bugreports.qt.io/browse/QTBUG-80041
https://bugreports.qt.io/browse/QTBUG-80041?focusedCommentId=519352&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-519352