Results 1 to 6 of 6

Thread: QDateEdit change the "first day of week"

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QDateEdit change the "first day of week"

    Hi!

    How can I change the "First day of Week in a QDateEdit?

    Thanks
    Last edited by xgoan; 3rd April 2008 at 08:54. Reason: updated contents

  2. #2
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDateEdit change the "first day of week"

    Hi,

    What do you need to do exactly?
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDateEdit change the "first day of week"

    Quote Originally Posted by xgoan View Post
    Hi!

    How can I change the "First day of Week in a QDateEdit?

    Thanks
    Is not possibel! ...
    i rewrite a Widget to display all day from one Year now is a QTableWidget..

    http://www.qt-apps.org/content/show....?content=76026

  4. #4
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QDateEdit change the "first day of week"



    I want the weeks start on monday

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDateEdit change the "first day of week"

    Isn't it locale dependent? BTW. Didn't you mean QCalendarWidget and not QDateEdit? The latter is just a spinbox. If you want to change settings of the calendar widget it user, you can use QDateTimeEdit::calendarWidget() and change its firstDayOfWeek property.

  6. #6
    Join Date
    May 2013
    Posts
    1
    Thanks
    3
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QDateEdit change the "first day of week"

    Here is a simple hack to change first day of week in QDateEdit using class inherited from QItemDelegate :

    Qt Code:
    1. QWidget *MyDateDelegate::createEditor ( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
    2. {
    3. if ( index.column() == 1 || index.column() == 6 )
    4. {
    5. QDateEdit *de = new QDateEdit ( parent );
    6. de->setCalendarPopup ( true );
    7. QCalendarWidget *cw = const_cast<QCalendarWidget*> ( de->calendarWidget() );
    8. cw->setFirstDayOfWeek ( Qt::Monday );
    9. return de;
    10. }
    11. return QItemDelegate::createEditor ( parent, option, index );
    12. }
    To copy to clipboard, switch view to plain text mode 

    It is not an example of good practice to remove const, but it works.

    You must change the index of collumn(s) where QDateEdit will appear.

    You should also implement setEditorData, setModelData, updateEditorGeometry, etc. according to your vision.
    Last edited by Raycho Raykov; 23rd December 2013 at 08:22.

Similar Threads

  1. clear text in QDateEdit
    By dyams in forum Qt Programming
    Replies: 6
    Last Post: 31st August 2010, 22:30
  2. Replies: 0
    Last Post: 2nd May 2007, 10:53
  3. QDateEdit and 2 digit years
    By Byngl in forum Qt Programming
    Replies: 4
    Last Post: 4th September 2006, 23:00
  4. Clearing QDateEdit
    By jpujolf in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2006, 21:19
  5. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21

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.