Results 1 to 3 of 3

Thread: QDateedit date changes on mouse press

  1. #1
    Join Date
    Feb 2014
    Posts
    60
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default QDateedit date changes on mouse press

    Hello,
    I have a QDateEdit and set some date on it .But when i mouse press on the widget the date automatically changes i dont want this behaviour to happen and this happens only when i have the following option on date edit,i want to change the date only when user click on the popup menu or when he edits in line edit part.I have attached a video for much better understanding.Any help on the issue is highly appreciated.

    Qt Code:
    1. QDateEdit *startDateEdit = new QDateEdit;
    2. QDateEdit *endDateEdit = new QDateEdit;
    3.  
    4. startDateEdit->setCalendarPopup(true);
    5. startDateEdit->setDate(QDate::currentDate());
    6.  
    7. endDateEdit->setCalendarPopup(true);
    8. endDateEdit->setDate(QDate::currentDate());
    To copy to clipboard, switch view to plain text mode 


  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QDateedit date changes on mouse press

    Your video is totally illegible, even at full-screen display, so I have no idea what is actually happening when you click. The tiny bit of code you have posted is completely out of context, so there is no way to tell where you are executing it or why.

    If what you are trying to do is to prevent the user from directly editing the date fields by typing into it, then try calling QDateEdit::setReadOnly() with a "true" argument. (setReadOnly() is inherited from the base class QAbstractSpinBox).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QDateedit date changes on mouse press

    I can see the current section of the date, the year, is incrementing by one on each click. It could be doing that because of any number of bits of code we cannot see.
    We really need a small, complete, compilable example that demonstrates this behaviour. While we can assume Windows it would also help to know what Qt version.

Similar Threads

  1. Replies: 1
    Last Post: 3rd May 2014, 17:46
  2. QDateEdit and mouse click signal
    By ouekah in forum Newbie
    Replies: 2
    Last Post: 23rd February 2010, 20:00
  3. Replies: 1
    Last Post: 10th July 2009, 10:54
  4. QDateEdit and date returned
    By cydside in forum Qt Programming
    Replies: 17
    Last Post: 26th May 2009, 22:08
  5. QDateEdit and empty date
    By vieraci in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2007, 17:19

Tags for this Thread

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.