Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. the qml file dialog caused the problem.couldnt find the reason.

the qml file dialog caused the problem.couldnt find the reason.

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 708 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1
     FileDialog {
            id: fileDialog
            title: ""
            folder: shortcuts.home 
            selectExisting: true
            onAccepted: {
                console.log("You chose: " + fileDialog.fileUrl.toString(
                                )) 
                let t_filename_act = fileDialog.fileUrl.toString()
    
                let t_view_path = fileDialog.folder.toString()
                let t_view_path_t = t_view_path.substr(8, t_view_path.length - 8)
                let t_view_file = fileDialog.fileUrl.toString().split('/').pop(
                        ).toString()
                for (var i = 0; i < global_selected_files.length; i++) {
    
                    console.log("t_view_pathi", global_selected_files[i])
                    if (global_selected_files[i] === t_filename_act) {
                        return
                    }
                }
    
                let t_linevalue = getShortFilepath(96, t_view_path_t, t_view_file)
    
                modelData.append({
                                     "linename": t_linevalue.toString(),
                                     "linevalue": t_filename_act.toString()
                                 })
                global_selected_files.push(t_filename_act)
                let t_files_count = modelData.count
    
                labelTitle.text = global_title + " - " + t_files_count + " FILES"
                if (global_saved_file === "default_none"
                        || global_saved_file === undefined) {
                    global_saved_file = t_linevalue.toString()
                    labelTips.text = " Saved file into: " + global_saved_file.toString()
                }
            }
            onRejected: {
                console.log("Canceled") 
            }
            visible: false
        }
    

    the modelData was used by the

    ListView {
        model: ListModel {
                id: modelData
        }
    }
    
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:385:29: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:385:29: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
    file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
    
    jsulmJ 1 Reply Last reply
    0
    • nicker playerN nicker player
       FileDialog {
              id: fileDialog
              title: ""
              folder: shortcuts.home 
              selectExisting: true
              onAccepted: {
                  console.log("You chose: " + fileDialog.fileUrl.toString(
                                  )) 
                  let t_filename_act = fileDialog.fileUrl.toString()
      
                  let t_view_path = fileDialog.folder.toString()
                  let t_view_path_t = t_view_path.substr(8, t_view_path.length - 8)
                  let t_view_file = fileDialog.fileUrl.toString().split('/').pop(
                          ).toString()
                  for (var i = 0; i < global_selected_files.length; i++) {
      
                      console.log("t_view_pathi", global_selected_files[i])
                      if (global_selected_files[i] === t_filename_act) {
                          return
                      }
                  }
      
                  let t_linevalue = getShortFilepath(96, t_view_path_t, t_view_file)
      
                  modelData.append({
                                       "linename": t_linevalue.toString(),
                                       "linevalue": t_filename_act.toString()
                                   })
                  global_selected_files.push(t_filename_act)
                  let t_files_count = modelData.count
      
                  labelTitle.text = global_title + " - " + t_files_count + " FILES"
                  if (global_saved_file === "default_none"
                          || global_saved_file === undefined) {
                      global_saved_file = t_linevalue.toString()
                      labelTips.text = " Saved file into: " + global_saved_file.toString()
                  }
              }
              onRejected: {
                  console.log("Canceled") 
              }
              visible: false
          }
      

      the modelData was used by the

      ListView {
          model: ListModel {
                  id: modelData
          }
      }
      
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:385:29: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:385:29: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Dialogs/DefaultFileDialog.qml:362:29: Unable to assign QQmlListModel to QString
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @nicker-player said in the qml file dialog caused the problem.couldnt find the reason.:

      file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13

      So what is in this line?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      nicker playerN 1 Reply Last reply
      0
      • jsulmJ jsulm

        @nicker-player said in the qml file dialog caused the problem.couldnt find the reason.:

        file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13

        So what is in this line?

        nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote on last edited by
        #3

        @jsulm

        property Component itemDelegate: Item {
               height: Math.max(16, label.implicitHeight)
               property int implicitWidth: label.implicitWidth + 16
        
               Text {
                   id: label
                   objectName: "label"
                   width: parent.width
                   font: __styleitem.font
                   anchors.left: parent.left
                   anchors.right: parent.right
                   anchors.leftMargin: styleData.hasOwnProperty("depth") && styleData.column === 0 ? 0 :
                                       horizontalAlignment === Text.AlignRight ? 1 : 8
                   anchors.rightMargin: (styleData.hasOwnProperty("depth") && styleData.column === 0)
                                        || horizontalAlignment !== Text.AlignRight ? 1 : 8
                   horizontalAlignment: styleData.textAlignment
                   anchors.verticalCenter: parent.verticalCenter
                   elide: styleData.elideMode
                   text: styleData.value !== undefined ? styleData.value : ""  // here it is !
                   color: styleData.textColor
                   renderType: Text.NativeRendering
               }
           }
        
        JonBJ 1 Reply Last reply
        0
        • nicker playerN nicker player

          @jsulm

          property Component itemDelegate: Item {
                 height: Math.max(16, label.implicitHeight)
                 property int implicitWidth: label.implicitWidth + 16
          
                 Text {
                     id: label
                     objectName: "label"
                     width: parent.width
                     font: __styleitem.font
                     anchors.left: parent.left
                     anchors.right: parent.right
                     anchors.leftMargin: styleData.hasOwnProperty("depth") && styleData.column === 0 ? 0 :
                                         horizontalAlignment === Text.AlignRight ? 1 : 8
                     anchors.rightMargin: (styleData.hasOwnProperty("depth") && styleData.column === 0)
                                          || horizontalAlignment !== Text.AlignRight ? 1 : 8
                     horizontalAlignment: styleData.textAlignment
                     anchors.verticalCenter: parent.verticalCenter
                     elide: styleData.elideMode
                     text: styleData.value !== undefined ? styleData.value : ""  // here it is !
                     color: styleData.textColor
                     renderType: Text.NativeRendering
                 }
             }
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @nicker-player
          @jsulm asked you what line is:

          file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13

          So he is expecting you to tell him which is line #109. If you just paste the whole delegate how can we know which is line #109? Please think about providing the necessary information to help others help you.

          1 Reply Last reply
          0
          • nicker playerN Offline
            nicker playerN Offline
            nicker player
            wrote on last edited by
            #5

            image.png
            Ive just marked the line109

            text: styleData.value !== undefined ? styleData.value : ""

            nicker playerN JonBJ 2 Replies Last reply
            0
            • nicker playerN nicker player

              image.png
              Ive just marked the line109

              text: styleData.value !== undefined ? styleData.value : ""

              nicker playerN Offline
              nicker playerN Offline
              nicker player
              wrote on last edited by
              #6

              @nicker-player
              by the way when i was used the icon from the qrc path it also give me a tip whats below

              QPainter::begin: Paint device returned engine == 0, type: 2
              QWidget::render: Cannot render with an inactive painter
              QPainter::begin: Paint device returned engine == 0, type: 3
              QPainter::setCompositionMode: Painter not active
              QPainter::end: Painter not active, aborted
              QPainter::begin: Paint device returned engine == 0, type: 3
              ASSERT: "img.format() == QImage::Format_ARGB32_Premultiplied || img.format() == QImage::Format_RGB32 || img.format() == QImage::Format_Indexed8 || img.format() == QImage::Format_Grayscale8" in file effects\qpixmapfilter.cpp, line 705
              QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?
              
              1 Reply Last reply
              0
              • nicker playerN nicker player

                image.png
                Ive just marked the line109

                text: styleData.value !== undefined ? styleData.value : ""

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @nicker-player
                I see that now, I did not notice it (if it was there) when I posted originally.

                I know nothing about QML, but

                file:///D:/program/qt/5.14.1/msvc2017/qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:109:13: Unable to assign QQmlListModel to QString

                looks to me like styleData.value is an actual QQmlListModel? Which obviously cannot be converted to a string. So, however you do it in QML, what it is the bound value (or its type) in whatever cell in your table?

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved