Results 1 to 7 of 7

Thread: How to create Custom Slot upon widgets

  1. #1
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question How to create Custom Slot upon widgets

    How to create Custom Slot upon widgets in Qt4.
    In Qt4 .ui.h is available or not? If available how a way I can access?
    I am not getting a way in Qt4.
    Plz. help.
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create Custom Slot upon widgets

    You can create a custom slot upon your widget by reading: http://doc.trolltech.com/4.3/designe...component.html.

    Regards

  3. The following user says thank you to marcel for this useful post:

    Raccoon29 (8th September 2007)

  4. #3
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to create Custom Slot upon widgets

    You can create a custom slot upon your widget by reading: http://doc.trolltech.com/4.3/designe...component.html.
    Hi, I read it too, and I would pose a question about the custom slots:
    so, how do I decide which type of inheritance is better use? I mean, which are the points to follow to decide? I didn't understand reading it...

    Thanks
    Greetings
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

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

    Default Re: How to create Custom Slot upon widgets

    Quote Originally Posted by Raccoon29 View Post
    so, how do I decide which type of inheritance is better use? I mean, which are the points to follow to decide?
    This is what docs have to say about these two approaches:

    The Single Inheritance Approach
    The main advantages of this approach are its simple use of inheritance to provide a QWidget-based interface, and its encapsulation of the user interface widget variables within the ui data member. We can use this method to define a number of user interfaces within the same widget, each of which is contained within its own namespace, and overlay (or "compose") them. This approach can be used to create individual tabs from existing forms, for example.

    The Multiple Inheritance Approach
    Subclassing using multiple inheritance gives us more direct access to the contents of the form, is slightly cleaner than the single inheritance approach, but does not conveniently support composition of multiple user interfaces.

    One of the things that I personally do like in single inheritance approach is that it makes it slightly easier to read (unfamiliar) code. Designed UI components are referred via special UI object. This makes it clear where a certain variable is declared. In multiple inheritance approach member variables are declared in a separate auto generated header file. Of course, a simple naming convention would do the same trick in multiple inheritance approach too.
    J-P Nurmi

  6. #5
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to create Custom Slot upon widgets

    One of the things that I personally do like in single inheritance approach is that it makes it slightly easier to read (unfamiliar) code.
    Thank you for the answer,
    but isn't it going to be annoy to refer to the Ui object everytime you have to use a ui form component? I hope in your personal experience
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

  7. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create Custom Slot upon widgets

    I don't believe its annoying.
    As jpn pointed out it is more cleaner. You always know a certain widget is in the UI class.

    Regards

  8. #7
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to create Custom Slot upon widgets

    Ok,
    thank you all very much
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. picking geometry in qt custom widgets
    By notsonerdysunny in forum Qt Programming
    Replies: 2
    Last Post: 18th July 2007, 00:01
  2. How to create a movable border between two widgets?
    By Teuniz in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2007, 09:45
  3. create custom widgets
    By nimmyj in forum General Discussion
    Replies: 1
    Last Post: 20th November 2006, 09:24
  4. container populated with custom widgets
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2006, 22:02
  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.