Results 1 to 5 of 5

Thread: ui, mainwindow and other classes

  1. #1
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default ui, mainwindow and other classes

    Good morning, all --

    Okay, this question falls into a theoretical category not technical (I've figured that one out). I have a large mainwindow application and up until now I've kept most of the data handling in the slots that I've created in my mainwindow class, but I'm trying to redesign it as I've become more familiar with OOD techniques (and I'm not under a time constraint), so instead of handling both the data and ui aspect of, for instance, creating a new user in Mainwindow:n_NewUserPB_clicked(), I'm having that class call UserManager::CreateNewUser() to handle it.

    So, my question is this: should I leave the ui management in my Mainwindow class and have my UserManager class handle only the model processing, or should I have UserManager handle both? I'm leaning strongly toward option one as it separate the two.

    Thoughts? Thanks!


    Kodi
    Last edited by mtnbiker66; 1st February 2013 at 17:54.

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: ui, mainwindow and other classes

    i think that your manager class should take care of model processing only and leave the ui management in mainwindow, although you can do some ui managements(like validations) in another class, that your manger class should handle it.

  3. The following user says thank you to alizadeh91 for this useful post:

    mtnbiker66 (2nd February 2013)

  4. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: ui, mainwindow and other classes

    So, my question is this: should I leave the ui management in my Mainwindow class and have my UserManager class handle only the model processing, or should I have UserManager handle both? I'm leaning strongly toward option one as it separate the two.
    You have to realize the fact that user management is superficial, all that matter is functionality. Functionality meaning that all that user want to do (not how user does it).

    So I will say,

    -> All that user wants is core functionality (classes, interfaces, dependency....etc, may be OOP in your terms) should be your main concern.
    -> All that user wants to do in a particular way (very often subjective) will form the UI part of the solution.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. The following user says thank you to Santosh Reddy for this useful post:

    mtnbiker66 (2nd February 2013)

  6. #4
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: ui, mainwindow and other classes

    Sounds like ya'll are confirming what I thought (thankfully, because I've spent hours recoding and separating UI from the model/data management!)

    I appreciate the thoughts!

  7. #5
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: ui, mainwindow and other classes

    Don't worry, it will all be paid off, if not for you, than to somebody else.....
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Replies: 0
    Last Post: 6th November 2011, 09:22
  2. How to access Classes from another Classes
    By revellix in forum General Programming
    Replies: 1
    Last Post: 4th August 2011, 15:39
  3. Replies: 1
    Last Post: 12th April 2011, 09:53
  4. construction of classes within classes
    By mobucl in forum Newbie
    Replies: 8
    Last Post: 10th January 2011, 13:51
  5. fax classes in qt
    By dyams in forum Qt Programming
    Replies: 5
    Last Post: 7th September 2007, 09:14

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.