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. Clearing QDateEdit and QLabel
Servers for Qt installer are currently down

Clearing QDateEdit and QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 793 Views 2 Watching
  • 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.
  • L Offline
    L Offline
    LT-K101
    wrote on 25 Oct 2021, 14:37 last edited by
    #1

    Is there a way to set QDateEdit and QLabel containing an image to empty string like the example below? I have tried this method and it is not working for me. Please any assistance. Thank you.

    QdateEdit method 1:
    dob = self.ui.dateEdit.clear()
    
    QdateEdit method 2:
    dob = self.ui.dateEdit.setText("")
    
    
    
    QLabel method 1:
    self.ui.Display_label.setPixmap(QPixmap(pixmap)).clear()
    
    
    E P 2 Replies Last reply 25 Oct 2021, 14:43
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 25 Oct 2021, 14:42 last edited by mrjj
      #2

      Hi
      QDateEdit cannot be empty. ( it resets to 01-01-2000)

      Regarding the QLabel. This can contain emoty text but what you mean with the
      image/icon ?

      Like an icon with nothing drawn ?

      L 1 Reply Last reply 25 Oct 2021, 14:51
      0
      • L LT-K101
        25 Oct 2021, 14:37

        Is there a way to set QDateEdit and QLabel containing an image to empty string like the example below? I have tried this method and it is not working for me. Please any assistance. Thank you.

        QdateEdit method 1:
        dob = self.ui.dateEdit.clear()
        
        QdateEdit method 2:
        dob = self.ui.dateEdit.setText("")
        
        
        
        QLabel method 1:
        self.ui.Display_label.setPixmap(QPixmap(pixmap)).clear()
        
        
        E Offline
        E Offline
        eyllanesc
        wrote on 25 Oct 2021, 14:43 last edited by
        #3

        @LT-K101 self.ui.Display_label.clear()

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        L 1 Reply Last reply 26 Oct 2021, 08:51
        2
        • L LT-K101
          25 Oct 2021, 14:37

          Is there a way to set QDateEdit and QLabel containing an image to empty string like the example below? I have tried this method and it is not working for me. Please any assistance. Thank you.

          QdateEdit method 1:
          dob = self.ui.dateEdit.clear()
          
          QdateEdit method 2:
          dob = self.ui.dateEdit.setText("")
          
          
          
          QLabel method 1:
          self.ui.Display_label.setPixmap(QPixmap(pixmap)).clear()
          
          
          P Offline
          P Offline
          Pl45m4
          wrote on 25 Oct 2021, 14:43 last edited by Pl45m4
          #4

          @LT-K101

          dateedit.clear() should work
          The second method wont work, since QDateEdit has no function setText.

          For your QLabel try:
          self.ui.Display_label.clear()

          Edit:
          @eyllanesc was faster :)


          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
          1
          • M mrjj
            25 Oct 2021, 14:42

            Hi
            QDateEdit cannot be empty. ( it resets to 01-01-2000)

            Regarding the QLabel. This can contain emoty text but what you mean with the
            image/icon ?

            Like an icon with nothing drawn ?

            L Offline
            L Offline
            LT-K101
            wrote on 25 Oct 2021, 14:51 last edited by
            #5

            @mrjj thanks for your response. The Qlabel uses the QFileDialog.getOpenFilename() method to load an image into the QLabel with a help of a QPushButton.

            M 1 Reply Last reply 25 Oct 2021, 14:51
            0
            • L LT-K101
              25 Oct 2021, 14:51

              @mrjj thanks for your response. The Qlabel uses the QFileDialog.getOpenFilename() method to load an image into the QLabel with a help of a QPushButton.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 25 Oct 2021, 14:51 last edited by mrjj
              #6

              @LT-K101

              So you want to "CLEAR" the icon also ?
              Update. Clear() also removes the icon :)

              L 2 Replies Last reply 25 Oct 2021, 15:01
              0
              • M mrjj
                25 Oct 2021, 14:51

                @LT-K101

                So you want to "CLEAR" the icon also ?
                Update. Clear() also removes the icon :)

                L Offline
                L Offline
                LT-K101
                wrote on 25 Oct 2021, 15:01 last edited by
                #7

                @mrjj Yes, after image is loaded. I want to CLEAR the content of the Qlabel .

                1 Reply Last reply
                0
                • M mrjj
                  25 Oct 2021, 14:51

                  @LT-K101

                  So you want to "CLEAR" the icon also ?
                  Update. Clear() also removes the icon :)

                  L Offline
                  L Offline
                  LT-K101
                  wrote on 25 Oct 2021, 15:23 last edited by
                  #8

                  @mrjj the .clear() worked for the Qlabel thanks a lot. I'm trying to see if i can use Qtoolbutton to display a calendar widget Dialog.

                  1 Reply Last reply
                  1
                  • E eyllanesc
                    25 Oct 2021, 14:43

                    @LT-K101 self.ui.Display_label.clear()

                    L Offline
                    L Offline
                    LT-K101
                    wrote on 26 Oct 2021, 08:51 last edited by
                    #9

                    @eyllanesc Thanks for your response. The .clear() worked.

                    1 Reply Last reply
                    1

                    3/9

                    25 Oct 2021, 14:43

                    topic:navigator.unread, 6
                    • Login

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