Results 1 to 7 of 7

Thread: Query about animation in QTabBar/QTabWidget

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Query about animation in QTabBar/QTabWidget

    I have a QTabWidget with tabs which are created and removed dynamically depending upon what option user selects (see attached image tabs.jpg). Now, whenever a new tab is added, an animation needs to be shown. Here are the animation details:

    When a new tab is added, the text of the previous tab disappears and the new tab slides out from left to right. After that the previous tab only contains the image without any text (see attached tabs1.jpg). The newly created tab will have image as well as text.

    Now, the thing i need help with is the slide part of the tab. Rest everything has no animation.
    Is it possible to do it in Qt4.3 or Qt4.4? I think there's some classes like QTimeLine, QGraphicsItemAnimation etc. Also, what's Qt Animation framework (http://qt.nokia.com/products/appdev/...ionframework)? Is it like a separate package i have to download and build? Do i need this framework to do the above mentioned animation or can i just use the current animation classes in Qt?
    Attached Images Attached Images

  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: Query about animation in QTabBar/QTabWidget

    It's possible but not with QTabWidget. You'd have to create your own tab bar, probably based on Graphics View. Then doing animations is very simple.
    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
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Query about animation in QTabBar/QTabWidget

    Quote Originally Posted by wysota View Post
    It's possible but not with QTabWidget. You'd have to create your own tab bar, probably based on Graphics View. Then doing animations is very simple.
    Thanks for the quick reply!
    So, i have to create my own QTabBar class derived from QTabBar and attach to the QTabWidget. Can you give some more details about this or point me to some examples? I haven't used Graphics View yet so don't know much about it. Should i check the examples given inside graphicsview folder of Qt? Also, for this partioular animation, i'll first need to remove the text from the current tab and then change the rect or x,y co-ordinates of the new tab to make it slide from left to right.

  4. #4
    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: Query about animation in QTabBar/QTabWidget

    Quote Originally Posted by montylee View Post
    Thanks for the quick reply!
    So, i have to create my own QTabBar class derived from QTabBar and attach to the QTabWidget.
    No. You have to create your own tab bar and connect it to QStackedWidget.
    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
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Query about animation in QTabBar/QTabWidget

    Quote Originally Posted by wysota View Post
    No. You have to create your own tab bar and connect it to QStackedWidget.
    But for this i'll have to make lot of changes in my application as my application uses lot of QTabWidget APIs. Can't i create my own custom tab bar and attach it to QTabwidget using setTabBar()? Why do i need to use QStackedWidget for this?

  6. #6
    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: Query about animation in QTabBar/QTabWidget

    Quote Originally Posted by montylee View Post
    But for this i'll have to make lot of changes in my application as my application uses lot of QTabWidget APIs.
    So don't use animations and you won't have to change anything.

    Can't i create my own custom tab bar and attach it to QTabwidget using setTabBar()?
    Sure you can, but you have to reimplement the whole QTabBar class to provide a wrapper around QGraphicsView.

    Why do i need to use QStackedWidget for this?
    I suggest you read about graphics view first. Then some things should become clearer.
    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. The following user says thank you to wysota for this useful post:

    montylee (20th November 2009)

  8. #7
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Query about animation in QTabBar/QTabWidget

    okie...let me read about it first and i'll get back, thanks for your help

Similar Threads

  1. Regerding execution of query
    By sudheer168 in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2009, 04:29
  2. problem while executing SQL query
    By sosanjay in forum Qt Programming
    Replies: 3
    Last Post: 9th October 2009, 12:52
  3. Error executing SELECT query with QSQLITE
    By garfield85 in forum Qt Programming
    Replies: 6
    Last Post: 25th May 2009, 18:05
  4. Animation and QGraphics
    By PrimeCP in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2009, 00:31
  5. How to realize multi-threaded database query?
    By bangqianchen in forum Qt Programming
    Replies: 2
    Last Post: 14th November 2008, 07:15

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.