Results 1 to 10 of 10

Thread: How does the "PREVIEW" option in Qt Designer work?

  1. #1
    Join Date
    Mar 2012
    Location
    India
    Posts
    102
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How does the "PREVIEW" option in Qt Designer work?

    Hi,

    I want to implement a similar functionality like PREVIEW in Qt Designer on my embedded device. Means I will make a ui file in Qt Designer, then copy it to my embedded device. On this device I am planning to run my custom xml parser and the qt client app. The xml parser will parse the xml file and pass the data to the Qt client app which will then generate and display the form on the fly. This is what I understood of the preview facility of the Designer.

    I wanted an expert advice on the feasibility of this idea taking into account that I plan to run the xml parser and the QT Client app on my not so sophisticated embedded device.

    Also after the app displays the form I have to take user input put it into a packet and pass it to the server. Does this seem also feasible ?

    - Charvi

  2. #2
    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: How does the "PREVIEW" option in Qt Designer work?

    Have a look at QUiLoader instead.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2012
    Location
    India
    Posts
    102
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How does the "PREVIEW" option in Qt Designer work?

    Thank you I tried that. It seems to be just the thing I wanted.

    But what if the ui file was not generated with Qt Designer? Means if I have a custom editor which works just like Qt Designer ( also having the signal slots editor like it ), but the predefined slots for widgets are not the same. They are as per my requirement. Will then also the QUiLoader class work in the same way?

  4. #4
    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: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by Charvi View Post
    But what if the ui file was not generated with Qt Designer?
    Then it wouldn't be a ui file.

    Means if I have a custom editor which works just like Qt Designer ( also having the signal slots editor like it ), but the predefined slots for widgets are not the same. They are as per my requirement. Will then also the QUiLoader class work in the same way?
    I don't understand what you mean about those slots. Slots are slots, QUiLoader doesn't care about their names.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2012
    Location
    India
    Posts
    102
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by wysota View Post
    I don't understand what you mean about those slots. Slots are slots, QUiLoader doesn't care about their names.
    When I connect some signal from a widget to some slot of another using the Designer Signal/Slots Editor, then when the form is shown using QUiLoader the signal and slots connection works. Now in designer only predefined slots can be connected, there is no provision for defining a custom slot ( please correct me if I am wrong ).

    In the same way if I create some custom editor where in I populate a list of widgets on one side ( these are derived from the original class with extra features, like some extra signals and slots ) and I have a drag and drop area on the other, where the form can be created. The file so generated will have .ui extension and will also be in the xml format. Is it possible to load this type of file dynamically with QUiLoader?

  6. #6
    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: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by Charvi View Post
    Now in designer only predefined slots can be connected, there is no provision for defining a custom slot ( please correct me if I am wrong ).
    You are wrong. You can add signals and slots to the form object and to promoted widgets from the context menu.

    The file so generated will have .ui extension and will also be in the xml format. Is it possible to load this type of file dynamically with QUiLoader?
    If it's using the same semantics then obviously yes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2012
    Location
    India
    Posts
    102
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by wysota View Post
    You are wrong. You can add signals and slots to the form object and to promoted widgets from the context menu.
    In Designer? I am sorry, from the post (http://www.qtcentre.org/threads/2195...ts-in-Designer) I perceived that we cannot "define" (write code for) custom signal and slots in Qt Designer. If its possible then can you show me how? Sorry for my ignorance, but if this makes it my problem gets simplified to a huge extent.
    Last edited by Charvi; 19th April 2012 at 12:12.

  8. #8
    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: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by Charvi View Post
    In Designer? I am sorry, from the post (http://www.qtcentre.org/threads/2195...ts-in-Designer) I perceived that we cannot "define" (write code for) custom signal and slots in Qt Designer.
    Looking at my calendar I can see it's April 19th, 2012 today and not May 12th, 2006.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Mar 2012
    Location
    India
    Posts
    102
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How does the "PREVIEW" option in Qt Designer work?

    Thanks for your efforts but I think you are misled.

    Whether its 2006 or 2012, I believe writing code for a custom slots is not supported in Qt Designer. Well here are some latest posts which may not be objectionable:

    1) http://stackoverflow.com/questions/7...de-to-a-button
    2) http://stackoverflow.com/questions/4...qt-designer-go

    etcetera.

    QUiLoader may be working in the following manner:

    A) The Signal/ Slots connections made using the predefined signals and slots in the Designer are between the tags <signal></signal> and <slot></slot> within the <connection></connection> tag int he .ui file.
    B) Next while loading the .ui file first the QUiLoader will parse the tags and look for the code of the signals and slots (with name in between the tags) in the Qt Library. It will fetch the code from from there and display the UI.

    This way when the particular signal is emitted the code of the slot will be executed. So if I need to implement my custom signals and slots I have to write the corresponding class files (.cpp and .h) which will contain its code.
    Last edited by Charvi; 20th April 2012 at 07:58. Reason: spelling mistakes

  10. #10
    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: How does the "PREVIEW" option in Qt Designer work?

    Quote Originally Posted by Charvi View Post
    Whether its 2006 or 2012, I believe writing code for a custom slots is not supported in Qt Designer.
    Nobody said anything about writing code for custom slots. UI class is not about writing any code, it's about connecting signals to slots (existing or not). The slots have to be implemented in appropriate classes. I don't see how it's related to your usecase. I think you are missing a point on how Designer works. If you promote one class (say QPushButton) into another (say MyCustomButton) that adds some signals and slots to its base class, you still have to provide that class in your final binary code and that's where you'll implement those missing slots. Designer doesn't allow you to create custom classes, it only allows to marshall instances of them. However you call your "custom ui tool", it will have to work exactly the same way.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 20th September 2010, 11:42
  2. The "Range" option in QHttpRequestHeader does not work?
    By nhs_0702 in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2010, 10:36
  3. Replies: 1
    Last Post: 5th January 2010, 14:34
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05
  5. "has a relation" to work with designer ?
    By thejester in forum Qt Tools
    Replies: 5
    Last Post: 4th December 2007, 16:45

Tags for this Thread

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.