Results 1 to 7 of 7

Thread: QDate Help pls

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QDate Help pls

    Quote Originally Posted by munna
    I dont want user to select any format. User should be able to enter as normal text (as he usually enteres the date. In different country people enter date in different format) and still be able to see finally the date in dd MMMM yyyy format if he had entered the year otherwise in dd MMMM format.

    How can I achieve this?
    I think you can't achieve this in the general case. For example, in most of Europe 9/11/2006 means November 9 while in America it would be interpreted as September 11. How do you intend to handle this? You have to force the user into some format or use locale information, maybe together with QComboBoxes as suggested by Kapil.

  2. #2
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDate Help pls

    hi...

    if you really want to use a QLineEdit sort of thing then i suppose you would have to write check conditions for most of the possible cases... you can also start a simultaneous thread or a check activated whenever the user enters anything in the line edit that he/she is doing it in proper format...
    You can use is line Edit isModified() function which on any input given to the line edit enable you to throw some event and this event which would be thrown would be a check specifier or say date processor which would check whether the user is giving in the date in proper format or not...
    this way you can force the user to give the input in a set format..
    if you want to give the user the privildge to give in any format then it would be very tough for you as you would have to write many conditions and still left with many exceptions which cannot be handled..
    so my suggestion would be either a combobox kinda thing or modified text check kind of thing...

    Kapil
    All you have to decide is what to do with the time that is given to you

Similar Threads

  1. QDate class extension
    By Carlton in forum Newbie
    Replies: 1
    Last Post: 22nd February 2009, 07:33
  2. QDate an locale setting
    By Boron in forum Qt Programming
    Replies: 5
    Last Post: 10th October 2008, 15:15
  3. Problems with QDate
    By cyberboy in forum Qt Programming
    Replies: 4
    Last Post: 25th May 2008, 21:17
  4. Converting VC++ qreal to QDate
    By Krish_ng in forum Qt Programming
    Replies: 13
    Last Post: 12th January 2008, 19:23
  5. Two QDate issues
    By GreyGeek in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2006, 02:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.