Results 1 to 3 of 3

Thread: Content not refreshed after QTabBar::moveTab()

  1. #1
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Content not refreshed after QTabBar::moveTab()

    Hi,

    I have a class that inherits from QTabBar. Tabs in this tab bar may embed a window handler or a qml page. After I have moved a tab from left (index 0 for instance) to right (last index), the content of the moved tab (now at the last index) is in now the content of the tab at index 0 (after the move).

    The move is done by QTabBar::moveTab().
    Qt Code:
    1. tabbar->moveTab(tabbar->tabAt(m_dragStartPos), tabbar->tabAt (m_dragDropedPos));
    To copy to clipboard, switch view to plain text mode 
    So I thinked of a
    Qt Code:
    1. setCurrentIndex(tabbar->tabAt (m_dragDropedPos))
    To copy to clipboard, switch view to plain text mode 
    but it did not work.

    But when I do a removeTab(), addTab() and setCurrentIndex(), the result is good but the tab is always moved at the end of the TabBar.

    Thanks for your help

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Content not refreshed after QTabBar::moveTab()

    QTabBar does not have a content area, it is just a set of labelled tabs. It therefore cannot move any content you may have associated with the tab bar events: that is up to you. If you want that sort of behaviour QTabWidget is likely a better choice.

    If you do not want the new tab to be the last in the bar then use insertTab()

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

    clousque (26th February 2014)

  4. #3
    Join Date
    Feb 2014
    Location
    Paris
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Content not refreshed after QTabBar::moveTab()

    Thanks for your reply,

    It works, I misunderstood the use of QTabWidget and QTabBar. The move operation has to be done in QTabWidget.

    Thanks again

Similar Threads

  1. image not getting refreshed in Qlabel
    By prkhr4u in forum Qt Programming
    Replies: 40
    Last Post: 26th December 2013, 12:17
  2. Replies: 8
    Last Post: 6th November 2013, 04:36
  3. Replies: 0
    Last Post: 17th November 2011, 12:51
  4. Checkboxes in Treeview do not get refreshed
    By mesch.t in forum Newbie
    Replies: 5
    Last Post: 13th April 2011, 21:53
  5. QTableView is not refreshed
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 13th October 2009, 22:23

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.