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. QDateEdit->setSpecialValueText() not working
QtWS25 Last Chance

QDateEdit->setSpecialValueText() not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
empty qdateedit
4 Posts 3 Posters 1.7k 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.
  • D Offline
    D Offline
    dream_captain
    wrote on 2 Jun 2016, 11:47 last edited by
    #1

    I'm trying to visualize an empty value in QDateEdit. But instead of "null" string, QDateEdit shows me default value 01.01.2000. Here's my code:

    #include <QApplication>
    #include <QDateEdit>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QDateEdit date_edit;
        date_edit.setSpecialValueText("null");
        date_edit.show();
        return a.exec();
    }
    

    I'm using Qt 5.5.1 x32 on windows 8.1 with a msvc2012 compiler.
    What's wrong with my code?

    R 1 Reply Last reply 2 Jun 2016, 11:56
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 2 Jun 2016, 11:55 last edited by
      #2

      Hi and welcome
      Nothing wrong with your code.
      I dont think it allows an empty date.
      The TimeDate class dont allow so I think the widget also enforces that.

      http://www.qtcentre.org/threads/17295-How-to-put-empty-value-in-QDateEdit

      1 Reply Last reply
      0
      • D dream_captain
        2 Jun 2016, 11:47

        I'm trying to visualize an empty value in QDateEdit. But instead of "null" string, QDateEdit shows me default value 01.01.2000. Here's my code:

        #include <QApplication>
        #include <QDateEdit>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            QDateEdit date_edit;
            date_edit.setSpecialValueText("null");
            date_edit.show();
            return a.exec();
        }
        

        I'm using Qt 5.5.1 x32 on windows 8.1 with a msvc2012 compiler.
        What's wrong with my code?

        R Offline
        R Offline
        Ratzz
        wrote on 2 Jun 2016, 11:56 last edited by
        #3

        @dream_captain
        look at this https://bugreports.qt.io/browse/QTBUG-277

        --Alles ist gut.

        1 Reply Last reply
        1
        • D Offline
          D Offline
          dream_captain
          wrote on 2 Jun 2016, 13:00 last edited by
          #4

          Thanks. Seems like i need another workaround.

          1 Reply Last reply
          0

          4/4

          2 Jun 2016, 13:00

          • Login

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