Results 1 to 2 of 2

Thread: Simple DB app, some questions.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Simple DB app, some questions.

    Quote Originally Posted by juannm View Post
    My first doubt is about 1), because it seems that I cannot add dynamic columns, just hide or show the ones existing in the database. So, is SqlRelationalTableModel a bad selection for my purposes?
    You can reimplement columnCount() and data() in either QSqlRelationalTableModel subclass or QSortFilterProxyModel subclass. If index passed to data() refers to a dynamic column you calculate data and return it, otherwise you call the base class implementation.

    For achieving 2), I thought that a QDialog could arise when the user double-clicks onto a given row. That QDialog would contain the "extended" information, and let the user modify it, so this idea would also accomplish 3)
    What about showing tooltips or a separate widget next to the view (a bit like in QColumnView)? A separate widget could even use QDataWidgetMapper to let user directly edit model data. I guess a popup dialog goes too but I like to avoid them myself.

    Last, for 4) I want to let the user decide if he wants to search in one of three posible manners, selectable by three exclusive radio buttons:
    * Name + surname1 + surname2
    * Member num
    * Member id
    The problem, is that QSortFilterProxyModel can only search one column at a time, or all of them, but there is no intermediate option. So what would be the best way of doing a search which affects 3 (or an arbitrary number of) columns?
    You can reimplement QSortFilterProxyModel::filterAcceptsRow() to apply custom filtering.
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    juannm (20th August 2008)

Similar Threads

  1. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12
  2. Memory management questions (im new to Qt)
    By scarvenger in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2007, 07:41
  3. simple questions. qt3 to qt4
    By impeteperry in forum Newbie
    Replies: 16
    Last Post: 3rd April 2006, 17:41
  4. 2 Questions about layouts
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2006, 13:54
  5. Qt related questions and thoughts about getting job
    By AlexKiriukha in forum General Discussion
    Replies: 4
    Last Post: 26th January 2006, 12:25

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
  •  
Qt is a trademark of The Qt Company.