Results 1 to 3 of 3

Thread: Complex Custom Widget with QTextEdit (How would you do this?)

  1. #1
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Complex Custom Widget with QTextEdit (How would you do this?)

    Hello,

    imagine your task is to implement some fancy todo app like "Things" from CulturedCode (http://culturedcode.com/things/). Now consider this image of Things: http://culturedcode.com/styles_2.5/i...hings_big5.jpg

    How would you implement the central part of the main window, the task list? What would be your approach? (Don't consider the tag bar at top, the tool bar at the bottom and the panel on the left)

    Here are some hints:
    • Yes, it has to look nice! (so no standard widget appearance)
    • Clicking a task expands it to an task editor (as you can see in the middle of the screenshot)
    • Between the tasks could be some separators (as text, if you sort/group your tasks)
    • It has to be fast, the tasklist could containt thousands of entries


    Apparently you have to create a custom widget or several custom widgets:

    Approach #1: One big custom widget (do _everything_ on your own)
    Approach #3: One custom widget composed of standard widgets (using stylesheets?)
    Approach #3: One custom widget composed of other custom widgets
    Approach #3.1: Using layout managers?
    Approach #3.2: ...or Model/View-Framework (implement QAbstractListModel, some delegates and a view)

    Especially I'm interested in implementing this task editor (task can be expanded to edit the tags, due schedule, notes...). The user has the possibility to enter some lines for a task, especially rich text is important. Sounds like a widget composed of others with a layout manager? Or is there another way to embed a QTextEdit in your own widget (which has to paint his own parts, too)?!

    So to sum up:

    1) What is your general approach for the whole tasklist?
    2) What is your approach for the task editor?

    I'm interested in the structure and the reasoning ("This could be a custom widget. (then describe 'this'). Then you can compose these ...that's a nice approach because...").

    Thank you very very much,
    binduschen

    P.S.: My first post, yeah!

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Complex Custom Widget with QTextEdit (How would you do this?)

    Quote Originally Posted by binduschen View Post
    Approach #3.2: ...or Model/View-Framework (implement QAbstractListModel, some delegates and a view)
    Looking at the screenshot, the model/view pattern is the way to go.

    The custom look can be done via a delegate.
    The model is very easy, this can even be a standard item model.
    The view itself might need some subclassing though.

    But there's another nice model/view pattern in Qt. QGraphicsView.
    Using a QGraphicsView might make it considerable more easy to do the painting.

    So my first choice would be a QGraphicsView.
    If, however, you do need to share the data with other views, I would go for the item views which will be a bit more work.

  3. #3
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Complex Custom Widget with QTextEdit (How would you do this?)

    Hello,

    thank you very much. Anybody an idea for the text widget?

    Best regards!

Similar Threads

  1. Replies: 1
    Last Post: 6th May 2010, 10:09
  2. casting complex widget pointers
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 8th February 2007, 18:52
  3. QTextEdit with custom space between lines
    By Lele in forum Qt Programming
    Replies: 4
    Last Post: 22nd November 2006, 08:24
  4. Replies: 1
    Last Post: 5th November 2006, 23:50
  5. Replies: 9
    Last Post: 8th May 2006, 14: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.