Results 1 to 3 of 3

Thread: display date in LineEdit using CalendarWidget.

  1. #1
    Join Date
    Mar 2011
    Location
    delhi
    Posts
    45
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation display date in LineEdit using CalendarWidget.

    Hello all..
    please tell me how to display date in LineEdit or on QDateEdit control using CalendarWidget.
    ie( Calendar widget will popup on clicking on calendar icon nea by LineEdit or QDateEdit. On selection of date that specific date should display in LineEdit or QDateEdit control.)



    thanks with regards:
    gauravg
    Last edited by gauravg; 15th September 2011 at 12:11. Reason: updated contents

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: display date in LineEdit using CalendarWidget.

    You can catch the mosuePressEvent() in your QLineEdit, and there popup the Calendar widget, and have the selectionChanged() or as below me suggested the ::clicked ( const QDate & date ) signal trigger a slot in which you get the selected date and set it in your LineEdit.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: display date in LineEdit using CalendarWidget.

    Create a slot and connect it to void QCalendarWidget::clicked ( const QDate & date ) signal, then convert the date to string and set this text in line edit.
    Edit: QCalendarWidget::selectionChanged () will be better.

Similar Threads

  1. Replies: 6
    Last Post: 19th March 2011, 03:39
  2. Change colors of date of calendarwidget
    By moh.gup@gmail.com in forum Qt Programming
    Replies: 0
    Last Post: 6th April 2010, 19:36
  3. Date format is not display
    By sosanjay in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2009, 10:26
  4. How to link A label with CalendarWidget
    By Rakesh_Kumar in forum Qt Programming
    Replies: 2
    Last Post: 29th October 2008, 10:49
  5. How to default Date-Edit Widget to system date
    By JohnToddSr in forum Qt Tools
    Replies: 4
    Last Post: 17th January 2007, 19:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.