Results 1 to 5 of 5

Thread: QQuickView redraw: setSource() 2nd time leads to Qt-Assert

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QQuickView redraw: setSource() 2nd time leads to Qt-Assert

    Hi and thanks for your time and attention,

    Qt Code:
    1. view->engine()->clearComponentCache();
    To copy to clipboard, switch view to plain text mode 
    is an interesting idea! I had not tried that before, but unfortunately it doesn't help, too (same crash).

    As to the basic structure of what I am doing here: I have different kinds of incidents in my model which all derive from an "Incident" base class. For interaction with qml I cache this in different interfaces which also derive from one "IncEditInterface", which covers the "Incident" base stuff.

    On qml side I use a IncEdit.qml which allows the editing of the base class properties of the interface (most of them invisible by default, opening on demand). The additional properties of the derived classes are covered by a Loader that - depending on the actual class - sideloads additional interface elements by taking the source of a class-specific qml file.

    Structure:
    model:
    incident (base)
    --> incidentA (derived)
    --> incidentB (derived)
    --> incidentC (derived)

    interface:
    incEditInterface (base)
    --> incEditInterfaceA(derived)
    --> incEditInterfaceB (derived)
    --> incEditInterfaceC (derived)

    QML
    incEdit.qml
    {
    [base class stuff]
    Loader.source = "interfaceA.qml"
    [additional base class stuff]
    }

    The actual qml code is this one (destilled for readability):
    Qt Code:
    1. import QtQuick 2.5
    2. import QtQuick.Controls 1.4
    3. import QtQuick.Dialogs 1.2
    4. [imports]
    5.  
    6. Flickable {
    7. id: incEditFlickable
    8. [Layout/Size stuff]
    9. Item {
    10. id: incEditBaseItem
    11. [Layout/Size stuff]
    12. property string pupilDisplayNameComposition: IncEditInterface.pupilFullName + " ("+ priv.nick + priv.gender + ")"
    13. QtObject {
    14. id: priv
    15. property string nick: IncEditInterface.pupilNickName ? IncEditInterface.pupilNickName + ", " : ""
    16. property string gender: IncEditInterface.pupilGender === Enums.MALE ? "m" : IncEditInterface.pupilGender === Enums.FEMALE ? "w" : "?"
    17.  
    18. }
    19. // optionally overlaid dialog items ------------------------------------------------------------------------------------------------------------
    20. Calendar {
    21. z: 500
    22. visible:false
    23. id: datePickerBookedFor
    24. [Layout/Size stuff]
    25. onClicked: {
    26. datePickerBookedFor.visible = false
    27. dateButton.text = Qt.formatDate(date, "ddd dd.MM.yy")
    28. IncEditInterface.bookedForDate = date
    29. dateButton.shrinkToFitFromPixelSize(pupilNameSmall.font.pixelSize)
    30. }
    31. }
    32.  
    33. // incEditButtons -----------------------------------------------------------------------
    34. RowLayout {
    35. id: incEditButtonRow
    36. [Layout/Size stuff]
    37. CustomIconPushButton {
    38. id: okButton
    39. [...]
    40. }
    41. CustomIconPushButton {
    42. id: adoptButton
    43. [...]
    44. }
    45. CustomIconPushButton {
    46. id: resetButton
    47. [Layout/Size stuff]
    48. text: "Reset"
    49. onPushButtonClicked: {
    50. IncEditInterface.resetEntries()
    51. }
    52. }
    53. CustomIconPushButton {
    54. id: deleteButton
    55. [...]
    56. }
    57.  
    58. }
    59.  
    60. // small version of incEdit header --------------------------------------------------------------------------------------------------------------
    61. Rectangle {
    62. id: smallTopItem
    63. [Layout/Size stuff]
    64. visible: true
    65. Rectangle {
    66. id: pupilNameSmallRect
    67. [Layout/Size stuff]
    68. Text {
    69. id: pupilNameSmall
    70. [Layout/Size stuff]
    71. text: incEditBaseItem.pupilDisplayNameComposition
    72. }
    73. }
    74. CustomIconPushButton {
    75. id: showHideTitle1
    76. visible: true
    77. [Layout/Size stuff]
    78. text: "s"
    79. onPushButtonClicked: {
    80. smallTopItem.visible = false;
    81. largeTopItem.visible = true;
    82. }
    83. }
    84. }
    85. // large version of incEdit header --------------------------------------------------------------------------------------------------------------
    86. Rectangle {
    87. id: largeTopItem
    88. [Layout/Size stuff]
    89. visible: false
    90. Rectangle {
    91. id: pupilNameLargeRect
    92. color: "transparent"
    93. [Layout/Size stuff]
    94. Image {
    95. id: pupilPicture
    96. [Layout/Size stuff]
    97. source: IncEditInterface.pupilCustomPictureFileName === "" ? "" : IncEditInterface.paths.customPicturePath+IncEditInterface.pupilCustomPictureFileName
    98. fillMode: Image.PreserveAspectFit
    99. }
    100. Text {
    101. id: pupilNameLarge
    102. [Layout/Size stuff]
    103. text: incEditBaseItem.pupilDisplayNameComposition
    104. }
    105. SetCombo {
    106. Component.onCompleted: {
    107. groupCombo.currentIndex = groupCombo.find(IncEditInterface.groupName)
    108. }
    109.  
    110. id: groupCombo
    111. enabled: !datePickerBookedFor.visible
    112. [Layout/Size stuff]
    113. model: IncEditInterface.groupNames
    114. textRole: "text"
    115. onCurrentTextChanged: {
    116. IncEditInterface.groupName = groupCombo.currentText
    117. }
    118. }
    119. CustomIconPushButton {
    120. id: dateButton
    121. [Layout/Size stuff]
    122. text: Qt.formatDate(IncEditInterface.bookedForDate, "ddd dd.MM.yy")
    123. onPushButtonClicked: {
    124. datePickerBookedFor.visible = true
    125. }
    126. }
    127. CustomIconPushButton {
    128. id: showHideTitle2
    129. [Layout/Size stuff]
    130. text: "h"
    131. onPushButtonClicked: {
    132. smallTopItem.visible = true;
    133. largeTopItem.visible = false;
    134. }
    135. }
    136. } //pupilNameLargeRect
    137. } //largeTopItem
    138. Loader {
    139. id: incEditLoader
    140. [Layout/Size stuff]
    141. source: IncEditInterface.loaderSourceUrl
    142. }
    143. SetTextAreaInput {
    144. id: additionalInfoTextInput
    145. [Layout/Size stuff]
    146. title: "Bemerkungen:"
    147. text: IncEditInterface.additionalInfo
    148. onTextChanged: IncEditInterface.additionalInfo = text
    149. }
    150. } //FlickableBaseItem
    151. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by sedi; 6th August 2016 at 22:59.

Similar Threads

  1. How to set QWebEngineView on QQuickView
    By ejoshva in forum Newbie
    Replies: 112
    Last Post: 11th July 2015, 09:07
  2. QQuickView or QQmlApplicationEngine or QQuickWidget
    By ustulation in forum Qt Quick
    Replies: 0
    Last Post: 18th January 2015, 13:16
  3. Repaint a QML Scene (QQuickView)
    By alizadeh91 in forum Qt Programming
    Replies: 0
    Last Post: 23rd July 2013, 09:54
  4. textBrowser->setSource() end-of-line
    By gib in forum Qt Programming
    Replies: 8
    Last Post: 24th April 2011, 00:05
  5. QTextBrowser setSource (Qt 4.2.2)
    By manojmka in forum Qt Programming
    Replies: 0
    Last Post: 10th January 2008, 07:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.