Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. Warum ist das Löschen von einem Pointer in diesem Funktion falsch ?

Warum ist das Löschen von einem Pointer in diesem Funktion falsch ?

Scheduled Pinned Locked Moved Solved German
5 Posts 3 Posters 1.6k 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.
  • G Offline
    G Offline
    Galilio
    wrote on last edited by Galilio
    #1
    This post is deleted!
    G 1 Reply Last reply
    0
    • G Galilio

      This post is deleted!

      G Offline
      G Offline
      Galilio
      wrote on last edited by Galilio
      #2

      @Galilio said in Warum ist das Löschen von einem Pointer in diesem Funktion falsch ?:

      void MainWindow::setLogoAnimation()
      {
      	QPropertyAnimation *animation1 = new QPropertyAnimation(ui.labFirmaLogo, "geometry");
      	animation1->setDuration(3000);
      	animation1->setStartValue(ui.labFirmaLogo->geometry());
      	animation1->setEndValue(QRect(300, 150, 250, 100));
      
      	QEasingCurve curve;
      	curve.setType(QEasingCurve::OutBounce);
      	curve.setAmplitude(1.00);
      	curve.setOvershoot(1.70);
      	curve.setPeriod(0.60);
      
      	animation1->setEasingCurve(curve);
      
      	animation1->start();
              delete animation1; // das delete macht keinen Sinn
             // Die Frage ist: soll ich überhaupt das Object animation1 löschen?  
      
      }
      

      Danke in voraus

      jsulmJ 1 Reply Last reply
      0
      • G Galilio

        @Galilio said in Warum ist das Löschen von einem Pointer in diesem Funktion falsch ?:

        void MainWindow::setLogoAnimation()
        {
        	QPropertyAnimation *animation1 = new QPropertyAnimation(ui.labFirmaLogo, "geometry");
        	animation1->setDuration(3000);
        	animation1->setStartValue(ui.labFirmaLogo->geometry());
        	animation1->setEndValue(QRect(300, 150, 250, 100));
        
        	QEasingCurve curve;
        	curve.setType(QEasingCurve::OutBounce);
        	curve.setAmplitude(1.00);
        	curve.setOvershoot(1.70);
        	curve.setPeriod(0.60);
        
        	animation1->setEasingCurve(curve);
        
        	animation1->start();
                delete animation1; // das delete macht keinen Sinn
               // Die Frage ist: soll ich überhaupt das Object animation1 löschen?  
        
        }
        

        Danke in voraus

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #3

        @Galilio said in Warum ist das Löschen von einem Pointer in diesem Funktion falsch ?:

        Die Frage ist: soll ich überhaupt das Object animation1 löschen?

        Nicht unbedingt da es einen Parent hat - wird parent gelöscht wird auch animation1 gelöscht

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

        1 Reply Last reply
        1
        • G Offline
          G Offline
          Galilio
          wrote on last edited by
          #4

          @jsulm
          danke

          J.HilkJ 1 Reply Last reply
          1
          • G Galilio

            @jsulm
            danke

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @Galilio du kannst auch
            start(QAbstractAnimation::DeleteWhenStopped)
            aufrugen, um die Animation automatisch nach Ende zu löschen


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            3

            • Login

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