Results 1 to 4 of 4

Thread: QDialog with multiple backends

  1. #1
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default QDialog with multiple backends

    Hi,
    I am building an application where I view large data in a dialog.
    Dialog contains a QTableWidget which displays the data along wth 3 buttons for Add, Edit, Delete along with other UI stuff. As the data is in some specific format which I parse and fill it in QTableWidget
    Now my problem is that I have 9-10 different sources from where I get the data.
    Also for each of the different dialogs handling of Add, Edit, Delete is different. Also some dialogs are kind of read only dialog where Add, Edit, Delete functionality is not available, but some different functionality like Fetch is to be provided. Also some dialogs have a combo box whose index change changes the data in the table widget.
    How can I use the same UI and add something for that specific dialog ?
    In other words How can I use the same dialog UI but different backends and also customise the UI for different dialog.
    Hope you got my point.

  2. #2
    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: QDialog with multiple backends

    How can I use the same UI and add something for that specific dialog ?
    In other words How can I use the same dialog UI but different backends and also customise the UI for different dialog.
    It is possible to use multiple backend (one at a time per instance of dialog), and dialog be just one (multiple instance). Just make the dialog as composite dialog for all the use cases, i.e. containing all the possible buttons like Add/Remove/Edit/Fetch/Refresh etc. Make each backend as an instance of a class derived from a base class say AbstractBackend. The base class should provide the interface to determine if the specific implementation of the backend supports those kind of operation or not, based on which the dialog can enable/disable/hide/show the corresponding the button. You can go further and even customize dialog UI dynamically basded on information available from the interfaces provided by AbstractBackend.
    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.

  3. #3
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default Re: QDialog with multiple backends

    Sorry to say but I didn't understand it properly. You mean to say that every Backend would inherit the dialog or should contain a dialog object ? Also how my dialog class would have different implementation for Add, Edit, Delete ? Can you please explain ..

  4. #4
    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: QDialog with multiple backends

    Sorry to say but I didn't understand it properly. You mean to say that every Backend would inherit the dialog or should contain a dialog object ? Also how my dialog class would have different implementation for Add, Edit, Delete ? Can you please explain ..
    -> Every backend will inherit a BaseBackend class
    -> BaseBackend or any other inherited backend will not have any knowledge about any dialog, all it knows is how to Add/Delete etc
    -> Dialog class know about the BaseBacked which will provied virtual methods to perform Add/Delete/Edit etc.
    -> There virtual methods will be implemented by the respective backend classes
    -> Dialog class knows how to trigger the editing (i.e button click or other UI operation).
    -> Editing/Adding operation is managed by the dialog, one the operation is done dialog will use the BaseBackend methods to save the data back to backend

    Mostly this will deal the C++ way of implementing interfaces.
    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:

    pratham_shah (15th May 2013)

Similar Threads

  1. Replies: 0
    Last Post: 21st December 2012, 16:56
  2. Phonon backends on Windows
    By Tirkedi in forum Qt Programming
    Replies: 0
    Last Post: 13th December 2011, 15:39
  3. Replies: 9
    Last Post: 25th March 2011, 21:22
  4. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  5. Replies: 1
    Last Post: 6th August 2010, 11:24

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.