Results 1 to 4 of 4

Thread: Model for a (custom) calendar widget

  1. #1
    Join Date
    Sep 2006
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Model for a (custom) calendar widget

    Hello,
    I want to create a calendar application, but not whit the QCalendarWidget because I want to display some texte on each day.
    calendar.jpg
    Anyway, I want to load my data into a model, and then ask for it from the view.
    I've been reading and testing a lot, but still I can't figure a way to do this.

    Do you have any tips on this?

    Thank you!

    Asier

  2. #2
    Join Date
    Apr 2012
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Model for a (custom) calendar widget

    1. Create view class inherited from QListView or QTableView.
    2. Create appropriate model class.
    3. Setup delegate for view.
    4. Make money on your application)

  3. #3
    Join Date
    Sep 2006
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: Model for a (custom) calendar widget

    Thank you,
    I've tried what you said (except for the 4th point ;-))
    But I don't know what's the best model for such data, and how can I select only the data (rows) for certain dates.
    Because, as I have understood, a view ask for data, with a index, that is a x,y coordinate (in a table).
    I've thougth that maybe I could use a treemodel, being the parent nodes the dates, and the child nodes the data (one or more) for that specific date. But, how can I covert the date to a index?

    (I don't think that this is very easy, since I've been looking for examples or already done similar widgets, and I have only found one in korganizer for KDE, but I got lost in the code)

  4. #4
    Join Date
    Apr 2012
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Model for a (custom) calendar widget

    1. Try to use simple *ItemModel.
    2. To determine selected items in view use selectedIndexes() function.

Similar Threads

  1. Opensource Calendar Widget
    By donmorr in forum Qt Tools
    Replies: 5
    Last Post: 15th February 2012, 18:54
  2. Calendar Widget - Change cell colour
    By Gavin Harper in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2011, 08:31
  3. Is there any model for calendar?
    By nifei in forum Qt Programming
    Replies: 4
    Last Post: 16th February 2009, 22:22
  4. custom widget and model
    By asieriko in forum Qt Programming
    Replies: 2
    Last Post: 6th October 2008, 14:11
  5. Calendar widget with selectionMode != SingleSelection
    By Tamara in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2007, 10:13

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.