Results 1 to 11 of 11

Thread: Creating a customizable gui

  1. #1
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Creating a customizable gui

    First, the problem:

    For this application I want to have a fully customizable GUI. Imagine an empty mainwindow, perhaps with a single fixed element but even that's not sure yet. Now the end user must be able to do something like "insert->widgetTypeA", which would create a widget of Type A in his mainwindow.

    Well, that's not too hard, but now I want the end user to be able to resize/move this widget.

    At first I was thinking of embedding every created widget in a QDockWidget, but that seems to have serious limitations. First, I can't get the dock widgets to assume a certain size from code, which is important as the user must be able to save/restore the created layout. saveState()/restoreState() doesn't seem the way to go as you don't have a fixed amount of widgets, correct me if I'm wrong.

    Second, I don't want to limit the end user to the space of a single main window. Instead there must be some sort of MDI, probably just with a tab widget. This won't work because the dock widget will not dock in the tab widget

    So, I'm starting to fear that my only solution is to create all-custom widgets, which can be dragged 'n' dropped/resized.

    I would welcome any suggestions

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a customizable gui

    How about using Qt Designer component? Or if you feel this is beyond you, use Designer directly, only modifying the widget box. Then you can create widgets from Designer created forms on the fly.

  3. #3
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a customizable gui

    Hmm, that might be a possible solution.

    Directly using the designer does not seem to be a suitable solution to me, as that would involve my end users using designer, which is unacceptable.

    I don't really see how I could actually embed the designer though? I suppose that will involve switching to some sort of "editing mode" in my application, so the end user is still limited in his/her freedom as it would not be possible to resize/move widgets _really_ on the fly. Apart from that, wouldn't users have to bother with spacers and layouts and stuff in this case?

    Was actually hoping there would be a more simple solution

    As I'm thinking, wouldn't it be possible to create a class that inherits from QWidget and have that class provide resize/move functionality, after which I can subclass my custom widgets from this class?

    Still, it will probably be quite some work to get such a class to behave correctly...

  4. #4
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a customizable gui

    Okay, I've been looking around in the dragndrop examples. I've got an idea, but I would like some opinions.

    Say I implement the drag 'n' drop kinda like in the puzzle example, but then with my own widgets. So I make some sort of grid (making it easy to predict possible overlap, and generally making it easier to create an "aligned" layout for the end user), in which the user may drop widgets.

    Apart from that, I implement some way to resize the custom widgets.

    I do this with a class subclassed from QFrame or QWidget, and I subclass my custom widgets from this class so every widget behaves the same.

    Sounds like a plan?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a customizable gui

    You can do anything you're able to implement. I just suggested a solution where you don't have to implement anything It might prove quicker to train users to use layouts instead of implementing "Designer" from scratch.

  6. #6
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a customizable gui

    I didn't completely disregard your reply wysota

    Anyway, it seems to me that having users use designer to create their gui's is not a very versatile solution, as it won't really allow runtime editing.

    I'll do a quickie on the drag n drop thing to see whether it is a feasible solution Might post it here later as it might be helpful to others.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a customizable gui

    Quote Originally Posted by TMan View Post
    Anyway, it seems to me that having users use designer to create their gui's is not a very versatile solution, as it won't really allow runtime editing.
    On the contrary. You don't have to compile anything to have a working widget, if that's what you're afraid of. Of course it all might be too complex for your needs.

  8. #8
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a customizable gui

    Quote Originally Posted by wysota View Post
    On the contrary. You don't have to compile anything to have a working widget, if that's what you're afraid of. Of course it all might be too complex for your needs.
    I do know that. Let me explain.

    The application will be some sort of hardware control/data acquisiton control center. So you'll have plots and stuff. Using designer, embedded or not, the user can't really change his gui and still have the plots updating.

    Correct me if I'm wrong

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a customizable gui

    You're wrong

  10. #10
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating a customizable gui

    That's not much of a correction :P

    Anyway, there doesn't happen to be an example of designer integration? I couldn't find anything other than the calculatorbuilder example, which isn't of much help.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Creating a customizable gui

    There is an analog clock plugin example in Qt. You can see that it's active (the time passes) in Designer. As for the integration, you need to take a look at the designer component docs and you might also have a look at Edyuk sourcecode. As far as I remember it embedds a Designer component.

Similar Threads

  1. Problem in creating thread in GUI application
    By jyoti kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:05
  2. Creating a global array in my code???
    By therealjag in forum General Programming
    Replies: 5
    Last Post: 13th March 2006, 11:13
  3. uic not creating seperate .h and .cpp files
    By Kapil in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2006, 10:43
  4. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37
  5. Creating a "windowless" software
    By Yorma in forum Qt Programming
    Replies: 7
    Last Post: 9th January 2006, 15: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
  •  
Qt is a trademark of The Qt Company.