View Poll Results: Do you use QT Designer?

Voters
69. You may not vote on this poll
  • Yes, all the time! I cant live without it!

    32 46.38%
  • Sometimes, when I feel like it...

    16 23.19%
  • Only to visualize the final product before coding it.

    5 7.25%
  • Hell no! I can code it myself!!

    16 23.19%
Page 3 of 3 FirstFirst 123
Results 41 to 48 of 48

Thread: QT Designer? Coding by hand?

  1. #41
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by wysota View Post
    No, this is not a workaround - this is a general way of doing things based on object names.
    And I think this is a terrible hack like way. I some sense you do hand coding within the designer. You have to think of a naming scheme. You have to use regexp to use it. Your naming scheme can easily break, when you layout changes too much.

    Quote Originally Posted by wysota View Post
    Remember that a button group doesn't have anything to do with the layout of objects, so you can't put a QButtonGroup object on a form and assign buttons as children to it.
    Please don't take me literally. And please be a bit more observant when I use examples, e.g. when I try to explain a possible feature in terms of already exiting ones.

    And I can very well put a QButtonGroup on a form. At least in theory, it is just not implemented. It could be implemented as dropping a rectangle on the form, giving it a name, dropping buttons in it. Later on the uic compiler creates a QButtonGroup which is populated with the buttons I dropped in. There is no universal law that the designer can handle only layouts.


    Btw. my idea of a designer meta object consists of several parts. The first part is not that different from that what you are doing. It could even be implemented using the object name (though I would not do so). You create an meta object tree just like you create a layout tree (Attention Example, it is not a layout. It is just used the same way by dropping boxes in boxes.). You drop your widgets in those meta object boxes, name those boxes, and this way your object names are created automatically in a well defined naming schema.
    This would be cramming all meta information in this single string. Ugly, but possible.


    Quote Originally Posted by wysota View Post
    But what is the point of "grouping meta information of objects"? Would you like to use them in Designer or in the hand coded class making use of an ui file? I can imagine having a separate mode for Designer for such things but I don't see any benefit for a larger group of people (which is the only thing capable of making Trolls implement this).
    This would be the second part of my idea. I would use them outside the designer. You create a naming schema manually and parse them in the subclassed object, e.g. you create a QButtonGroup, search all children of the ui class for a certain name to add it to the button group. Finally you then can pass a pointer of the button group to the object, which actually handles the buttons. Next you search for other parts in the ui class, dispatch gui parts to the correct handler, etc.

    As I said, this is ugly, you have to remember your naming schema and if it changes, your regexps might have to change, too. Furthermore you enter your object names manually, which is error prone. One typo and the debugging starts.

    With my idea you generate your object names (or other meta info) graphically. Effectively grouping your objects, e.g. you create a meta box and give it the name 'page_1' in this box you drop a second meta box and give it the name 'group_1'. Now you drop a button in the second box and it is automatically named page_1.group_1.button_1. No, this has nothing to do with layout. I just uses the same user interface to create a tree.

    This is something you could do manually. The way you do it, you now would create some loops, some regexps, which parse the object names.

    I'd like to have an auto generated query method where I can ask 'contains("page_1"). If the answer is true, I'd like to have a method

    "QDesignerObject *getDesignerObect("page_1")",

    This returned QDesignerObject should contain references to group_1 + all children + meta information. Now I can pass this object, which encapsulates a small logical part of the whole gui to a client class, which handles the stuff inside this object, e.g. group_1 and its buttons.

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

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by Kumosan View Post
    And I can very well put a QButtonGroup on a form. At least in theory, it is just not implemented. It could be implemented as dropping a rectangle on the form, giving it a name, dropping buttons in it. Later on the uic compiler creates a QButtonGroup which is populated with the buttons I dropped in.
    The problem is QButtonGroup doesn't change the parent-child relation, meaning that you can have buttons with different parents inside a single button group. So I don't see a way of "dropping" buttons on the button group - you couldn't drop them on a button group AND parent widget at the same time. I can imagine the thing you want to be implemented as a separate working mode for Designer where you could somehow "associate" buttons into groups. But, let's face it, it would be really rarely used.

    There is no universal law that the designer can handle only layouts.
    Actually... I'd argue with that. Qt4 Designer is meant to be strictly a layout editor.

    Btw. my idea of a designer meta object consists of several parts. The first part is not that different from that what you are doing. It could even be implemented using the object name (though I would not do so). You create an meta object tree just like you create a layout tree (Attention Example, it is not a layout. It is just used the same way by dropping boxes in boxes.). You drop your widgets in those meta object boxes, name those boxes, and this way your object names are created automatically in a well defined naming schema.
    Are the "meta-objects" you refer to related to QMetaObject? If not, please try to use a different name as we may be confusing each other here...

    you have to remember your naming schema and if it changes, your regexps might have to change, too.
    Actually, not necessarily. And even if this is the case, I don't really see a problem with it.

    Furthermore you enter your object names manually, which is error prone. One typo and the debugging starts.
    In general it applies to all things you actually do. I tend to assume some sanity of the developer doing the job. If you make a typo, you'll widget will not make it into the button group. This is really easy to track.

    I'd like to have an auto generated query method where I can ask 'contains("page_1").
    In what way is it different than qFindChild()? You could make the same typo with both approaches...

    If the answer is true, I'd like to have a method

    "QDesignerObject *getDesignerObect("page_1")",
    Again, qFindChild() does that...

    This returned QDesignerObject should contain references to group_1 + all children + meta information. Now I can pass this object, which encapsulates a small logical part of the whole gui to a client class, which handles the stuff inside this object, e.g. group_1 and its buttons.
    So you'd like to maintain a virtually unlimited trees of object hierarchies indexed by names, right? So you'd like to have parent-child relations simmilar to the ones maintained by QObject and it's parent-child relation indexed by objectName property, correct? This is fine with me, although I believe it would increase resource usage and object deletion time significantly. But I don't see why Designer should handle such grouppings as they are not related to its functionality... Please notice, that you'd have to first redesign QObject - without it Designer wouldn't be able to do anything. So I think the issue is not in Designer itself here anyway.

    BTW. I remember something about Designer being able to handle "user properties" since 4.3 (I'm not sure if this was exactly what I think). If that was the case, you could create a user property "in button group 1" and set it to true for all buttons you wanted in the button group and then only iterate over all buttons and check the property value, adding them to a particular group. Of course you'd still have to add buttons to the group from within code.
    Last edited by wysota; 2nd April 2007 at 14:31.

  3. #43
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by wysota View Post
    The problem is QButtonGroup doesn't change the parent-child relation, meaning that you can have buttons with different parents inside a single button group. So I don't see a way of "dropping" buttons on the button group - you couldn't drop them on a button group AND parent widget at the same time.
    Ok, this is a weak point in my idea. However, in all my years of development with Qt, it never ever had a QButtonGroup with buttons with different parents.


    Quote Originally Posted by wysota View Post
    Actually... I'd argue with that. Qt4 Designer is meant to be strictly a layout editor.
    Perhaps because noone seriously though about it how to improve it and to make it better beyond pure layout design?


    Quote Originally Posted by wysota View Post
    Are the "meta-objects" you refer to related to QMetaObject? If not, please try to use a different name as we may be confusing each other here...
    Not in code, but in the idea. But you are right, let's define:

    With a QDesigerObject I mean an object, which can be created by generated code from the designer, which contains a part of the user interface hierarchy.

    With QDesignerMetaObject I mean an Object, which is located within a QDesignerObject, which might carry additional informations for all objects (references/pointers) within this QDesignerObject.


    Quote Originally Posted by wysota View Post
    In general it applies to all things you actually do. I tend to assume some sanity of the developer doing the job. If you make a typo, you'll widget will not make it into the button group. This is really easy to track.
    I don't think I can agree here. Of course you are right that it applies to all things we do, and that bugs can be found. But if the compiler or some tool can help prevent bugs like that in the first place, it should be used.

    Quote Originally Posted by wysota View Post
    Again, qFindChild() does that...
    But this is only a small part of what I want. And it handles a concrete object. My idea was not to find a concrete child, but a certain node in a tree.

    Quote Originally Posted by wysota View Post
    So you'd like to maintain a virtually unlimited trees of object hierarchies indexed by names, right? So you'd like to have parent-child relations simmilar to the ones maintained by QObject and it's parent-child relation indexed by objectName property, correct? This is fine with me, although I believe it would increase resource usage and object deletion time significantly.
    I am not sure about that. The QDesignerObject tree, which, according to my proposal, in the designer should be created like a layout tree, would have to be kept in the resources. Temporarily an at best medium sized xml structure. This information is only needed to build the QDesignerObjects. Once the gui is created, this info could be unloaded/deleted. I would have a small influence on the gui creation, but none on object deletion.

    Quote Originally Posted by wysota View Post
    But I don't see why Designer should handle such grouppings as they are not related to its functionality...
    I'd say they are related to good code design.

    Quote Originally Posted by wysota View Post
    Please notice, that you'd have to first redesign QObject - without it Designer wouldn't be able to do anything. So I think the issue is not in Designer itself here anyway.
    I don't think so. I think it could roughly work like this:

    When you call my getDesignerObject method with the parameter "group_1", it creates a container object, for the sake of the example, suppose it is a simple QList<QObject *>. Then it traverses the above mentioned QDesignerObject tree, which is an XML structure, and adds all object pointers, which belong to the "group_1" branch to the list.
    Finally it returns a pointer to this list.

    I reality it would not be a simple QList<Object *> since it should also carry the QDesignerMetaObjects and retain the hierarchy informations, but it still would be some sort of container.

    This is just an example, that this could be added without changing QObject. The QDesignerObject would also be only a temporary transfer object to pass their content around.

    Even the QDesignerObject resource tree could be deleted once the gui is built.

    It might cost a little bit more time and resources to build and initialise the gui, but I don't think this would be too costly.

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

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by Kumosan View Post
    Ok, this is a weak point in my idea. However, in all my years of development with Qt, it never ever had a QButtonGroup with buttons with different parents.
    But it doesn't mean it can't be used this way. If you wanted to provide support for that in Designer, it would need to handle such a situation as well.

    Perhaps because noone seriously though about it how to improve it and to make it better beyond pure layout design?
    No. Before Qt4 Designer was a tool that was able to do many more things than just lay out widgets. But then Trolls decided to make Designer only a layout editor which can be embedded into real IDEs.

    But if the compiler or some tool can help prevent bugs like that in the first place, it should be used.
    I agree but I don't think Designer should be the tool.

    But this is only a small part of what I want. And it handles a concrete object. My idea was not to find a concrete child, but a certain node in a tree.
    ...based on the name. That's exactly what qFindChild does.

    I am not sure about that. The QDesignerObject tree, which, according to my proposal, in the designer should be created like a layout tree, would have to be kept in the resources.
    Resources are compiled into the binary and occupy the memory all the time.
    Once the gui is created, this info could be unloaded/deleted. I would have a small influence on the gui creation, but none on object deletion.
    Hmm... so how do you want to access the data from code if it is only to be available to the automated code? Or maybe I don't understand what you mean by "gui creation" - for me setupUi() does that.


    When you call my getDesignerObject method with the parameter "group_1", it creates a container object, for the sake of the example, suppose it is a simple QList<QObject *>. Then it traverses the above mentioned QDesignerObject tree, which is an XML structure, and adds all object pointers, which belong to the "group_1" branch to the list.
    Finally it returns a pointer to this list.
    So it does the same qFindChildren() does, only on the separate object hierarchy, right?

    This is just an example, that this could be added without changing QObject. The QDesignerObject would also be only a temporary transfer object to pass their content around.
    But then you could only use it in a class generated by Designer.

    According to me the thing you want is a nice candidate for a completely separate component that can be implemented using Qt but not necessarily inside Qt.

  5. #45
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by wysota View Post
    Resources are compiled into the binary and occupy the memory all the time.
    Really? I thought there is a way to unload them and free the memory. Q_CLEANUP_RESOURCE()? I never tried that.

    Quote Originally Posted by wysota View Post
    Hmm... so how do you want to access the data from code if it is only to be available to the automated code? Or maybe I don't understand what you mean by "gui creation" - for me setupUi() does that.
    Ah yes, I really don't meant gui creation, but hmm, how do I call it...interface dispatch? All in all I am trying to find a better way to give classes a better way to access the designer generated objects. The designer is a fine tool, I just think the way its code has to be connected to the main program code sucks.

    Quote Originally Posted by wysota View Post
    So it does the same qFindChildren() does, only on the separate object hierarchy, right?
    Actually yes, the returned object should be different. Else if you want to keep the method to encode hierarchy informations in the object name, you probably could even use qFindChildren the way it is now. But I don't think this 'reuse' would be good.

    Quote Originally Posted by wysota View Post
    But then you could only use it in a class generated by Designer.
    This I don't understand. Why?

    Quote Originally Posted by wysota View Post
    According to me the thing you want is a nice candidate for a completely separate component that can be implemented using Qt but not necessarily inside Qt.
    I am thinking how I could create such a component. I think I could create a wrapper around designer generated classes, which implements parts of the interface I described. But all depends on hierarchy information somewhere in the designer created objects. I might be willing to swallow the bitter pill and parse the object names, but then I had to set them manually. And this makes IMHO all the work pointless.

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

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by Kumosan View Post
    Really? I thought there is a way to unload them and free the memory. Q_CLEANUP_RESOURCE()? I never tried that.
    This won't work for resources compiled into the application as they are part of application memory space. This macro only applies to plugins.

    Ah yes, I really don't meant gui creation, but hmm, how do I call it...interface dispatch?
    How would you define when "interface dispatch" ends? IMO there is no way to do that, especially if you allow subclassing.

    This I don't understand. Why?
    Because it wouldn't be supported by Qt core, only by the code Designer generates (just like you don't use "setupUi" with hand written classes).


    I am thinking how I could create such a component. I think I could create a wrapper around designer generated classes, which implements parts of the interface I described. But all depends on hierarchy information somewhere in the designer created objects. I might be willing to swallow the bitter pill and parse the object names, but then I had to set them manually. And this makes IMHO all the work pointless.
    IMO it should be completely separate from Designer with a separate tool (or two - "designer" and "compiler") handing it. Then you could incorporate it into QMake.

  7. #47
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by wysota View Post
    BTW. I remember something about Designer being able to handle "user properties" since 4.3 (I'm not sure if this was exactly what I think). If that was the case, you could create a user property "in button group 1" and set it to true for all buttons you wanted in the button group and then only iterate over all buttons and check the property value, adding them to a particular group. Of course you'd still have to add buttons to the group from within code.
    After you wrote this I had to check in the Qt 4.3 designer. You are right. right clicking the property editor opens a popup, which allows you to add a 'dynamic propery'. This handles most of the parts, which I named QDesignerMetaObject.

    Unfortunately I cannot use the 4.3 designer. In 4.3.0beta the preview window has no window decorations. I cannot close a preview window and have to brutally kill the program.

  8. #48
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: QT Designer? Coding by hand?

    Quote Originally Posted by wysota View Post
    This won't work for resources compiled into the application as they are part of application memory space. This macro only applies to plugins.
    Good to know.

    Quote Originally Posted by wysota View Post
    How would you define when "interface dispatch" ends? IMO there is no way to do that, especially if you allow subclassing.
    Yeah, probably only through evil hacks. But I don't like to think about code with never will be too deeply now.

    Quote Originally Posted by wysota View Post
    Because it wouldn't be supported by Qt core, only by the code Designer generates (just like you don't use "setupUi" with hand written classes).
    The QDesignerObject I meant is a simple container class, which is generated by designer generated code. All it has to do is implement a well defined interface. It could even be a subclass of QObject, though this would be overkill. But even if it is nowhere else supported in Qt, I would only need the header file of the interface. Maybe I am a bit blockheaded at the moment, but I cannot follow you here.

Similar Threads

  1. Designer crashes when selecting some widgets
    By gwendal in forum Qt Tools
    Replies: 4
    Last Post: 21st July 2006, 14:18
  2. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 19th May 2006, 00:28
  3. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 15:01
  4. qt4.1.1 designer
    By raphaelf in forum Qt Tools
    Replies: 10
    Last Post: 26th February 2006, 17:56
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 21:46

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.