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

Clearing QDateEdit and QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 779 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.
  • L Offline
    L Offline
    LT-K101
    wrote on 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()
    
    
    eyllanescE Pl45m4P 2 Replies Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      0
      • L LT-K101

        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()
        
        
        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on 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
        2
        • L LT-K101

          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()
          
          
          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on 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
          • mrjjM mrjj

            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 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.

            mrjjM 1 Reply Last reply
            0
            • L LT-K101

              @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.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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
              0
              • mrjjM mrjj

                @LT-K101

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

                L Offline
                L Offline
                LT-K101
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • mrjjM mrjj

                  @LT-K101

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

                  L Offline
                  L Offline
                  LT-K101
                  wrote on 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
                  • eyllanescE eyllanesc

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

                    L Offline
                    L Offline
                    LT-K101
                    wrote on last edited by
                    #9

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

                    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