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. Qt Creator crashes after implementing any kind of charts in Qt Designer Studio Qml

Qt Creator crashes after implementing any kind of charts in Qt Designer Studio Qml

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 434 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.
  • K Offline
    K Offline
    Kiovtorov
    wrote on 15 Oct 2024, 15:36 last edited by
    #1

    Hi, I am creating a small desktop app where the design is made in design studio(qml) and some backend is created in C++. I tried to implement a bar chart in design studio which led to the crash of the program. I tried to add charts to the cmake file but gave the same result. Why could that be?

    P 1 Reply Last reply 15 Oct 2024, 15:45
    0
    • K Kiovtorov
      15 Oct 2024, 15:36

      Hi, I am creating a small desktop app where the design is made in design studio(qml) and some backend is created in C++. I tried to implement a bar chart in design studio which led to the crash of the program. I tried to add charts to the cmake file but gave the same result. Why could that be?

      P Offline
      P Offline
      Pl45m4
      wrote on 15 Oct 2024, 15:45 last edited by Pl45m4
      #2

      @Kiovtorov said in Qt Creator crashes after implementing any kind of charts in Qt Designer Studio Qml:

      Hi, I am creating a small desktop app where the design is made in design studio(qml) and some backend is created in C++. I tried to implement a bar chart in design studio which led to the crash of the program. I tried to add charts to the cmake file but gave the same result. Why could that be?

      I got a car with five seats, four tires and two doors.
      What color is it?

      :D

      Sorry but you need to provide a lil more information on what you are doing :)
      From just knowing that you've created a QML/C++ app, nobody is able to help you :)

      So, please provide more context or some actual code which leads to the crash.
      Also, define "App is crashing". What happens exactly? Any error message?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kiovtorov
        wrote on 15 Oct 2024, 16:28 last edited by
        #3

        No error message. I am not that good at debugging so excuse me .The debugger stopped at

        void QWidgetTextControl::setCursorWidth(int width)
        {
            Q_D(QWidgetTextControl);
            if (width == -1)
                width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth, nullptr, qobject_cast<QWidget *>(parent()));
            d->doc->documentLayout()->setProperty("cursorWidth", width);
            d->repaintCursor();
        }
        

        esp this pat

                width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth, nullptr, qobject_cast<QWidget *>(parent()));
        

        Screenshot 2024-10-15 at 19.27.53.png

        P 1 Reply Last reply 15 Oct 2024, 18:40
        0
        • K Kiovtorov
          15 Oct 2024, 16:28

          No error message. I am not that good at debugging so excuse me .The debugger stopped at

          void QWidgetTextControl::setCursorWidth(int width)
          {
              Q_D(QWidgetTextControl);
              if (width == -1)
                  width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth, nullptr, qobject_cast<QWidget *>(parent()));
              d->doc->documentLayout()->setProperty("cursorWidth", width);
              d->repaintCursor();
          }
          

          esp this pat

                  width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth, nullptr, qobject_cast<QWidget *>(parent()));
          

          Screenshot 2024-10-15 at 19.27.53.png

          P Offline
          P Offline
          Pl45m4
          wrote on 15 Oct 2024, 18:40 last edited by
          #4

          @Kiovtorov

          That's inside the Qt library right?!
          But what is your code that causes the crash?
          It seems that there is HTML code or style involved?


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          K 1 Reply Last reply 15 Oct 2024, 19:36
          0
          • P Pl45m4
            15 Oct 2024, 18:40

            @Kiovtorov

            That's inside the Qt library right?!
            But what is your code that causes the crash?
            It seems that there is HTML code or style involved?

            K Offline
            K Offline
            Kiovtorov
            wrote on 15 Oct 2024, 19:36 last edited by Kiovtorov
            #5

            @Pl45m4 The code is indeed inside qt library
            the code that causes the crash is

            Rectangle {
                    id: rectangle_33
                    width: 918
                    height: 362
                    color: "#4dffffff"
                    radius: 10
                    border.color: "#727272"
                    border.width: 1
                    anchors.left: parent.left
                    anchors.top: parent.top
                    anchors.leftMargin: 28
                    anchors.topMargin: 453
            
                    ChartView {
                        id: area
                        x: 279
                        y: 62
                        width: 300
                        height: 300
                        AreaSeries {
                            name: "AreaSeries"
                            upperSeries: LineSeries {
                                XYPoint {
                                    x: 0
                                    y: 1.5
                                }
            
                                XYPoint {
                                    x: 1
                                    y: 3
                                }
            
                                XYPoint {
                                    x: 3
                                    y: 4.3
                                }
            
                                XYPoint {
                                    x: 6
                                    y: 1.1
                                }
                            }
                        }
                    }
                }
            

            There is no html or any styling. The files are .ui.qml generated from figma but they are not the problem. The app works perfect without the chart. And it only crashes in Qt Creator before the login page loads the dashboard page

                    logInButton.onClicked: {
                        var username = usernameField.text;
                        var password = passwordField.text;
                         login.logInUser(username, password);
                        login.logInSuccessful()
                        {
                            loader.source = "Dashboard.qml";
                            signInWindow.visible = false;
                        }
                    }
            
            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kiovtorov
              wrote on 15 Oct 2024, 19:53 last edited by
              #6

              Found the answer in https://forum.qt.io/topic/70575/qt-charts-crash
              In main.cpp you should change QGuiApplication to QApplication
              QApplication app(argc, argv);

              1 Reply Last reply
              2
              • K Kiovtorov has marked this topic as solved on 15 Oct 2024, 20:18

              6/6

              15 Oct 2024, 19:53

              • Login

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