Results 1 to 1 of 1

Thread: QTabWidget. Moving tabs outside visible area.

  1. #1
    Join Date
    Jan 2021
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QTabWidget. Moving tabs outside visible area.

    QTabWidget has an opportunity to move tabs via setMovable(true) function.
    I would like to reimplement some logic to have an ability of scrolling while user moves tab outside visible area.
    For example in FireFox when user move tab on left or right arrow of tabbar it scrolles so that user could place it on the right of non visible previously area.

    I tried to override mouseMoveEvent from QTabBar like this:
    It's qtjambi, but i guess the main idea could be caught

    Qt Code:
    1. @Override
    2. protected void mouseMoveEvent(final QMouseEvent event) {
    3. if (!event.button().equals(EStandardButton.NoButton)) {
    4. if (event.pos().x() >= this.pos().x() + this.width()) {
    5. if (rightBtn.isEnabled() && !rightBtn.isDown()) { //rightButton is a triangle button for scroll right which was found earlier
    6. rightBtn.setDown(true);
    7. }
    8. } else if (event.pos().x() <= 0) {
    9. if (rightBtn.isDown()) {
    10. rightBtn.setDown(false);
    11. }
    12. if (leftBtn.isEnabled() && !leftBtn.isDown()) {
    13. leftBtn.setDown(true);
    14. }
    15. } else { //in the middle
    16. if (rightBtn.isDown()) {
    17. rightBtn.setDown(false);
    18. }
    19. if (leftBtn.isDown()) {
    20. leftBtn.setDown(false);
    21. }
    22. super.mouseMoveEvent(event);
    23. }
    24. } else {
    25. super.mouseMoveEvent(event);
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 

    The main problem that during the scroll event there is no mouseMoveEvent, so movable tab stay on it's start position when start scrolling.
    In the end of scrolling tab which was moved could not be seen.
    I would like to implement FF behaviour.
    Last edited by daosist92; 27th January 2021 at 14:03.

Similar Threads

  1. Replies: 1
    Last Post: 12th June 2014, 08:27
  2. QTabWidget vertical tabs ???
    By jesse_mark in forum Newbie
    Replies: 3
    Last Post: 12th July 2013, 22:20
  3. Replies: 2
    Last Post: 10th May 2013, 11:20
  4. QTabWidget with same tabs
    By Djony in forum Qt Programming
    Replies: 20
    Last Post: 24th December 2011, 13:20
  5. Qt Designer How to set a QTabWidget with two rows of tabs?
    By lmfgy123 in forum Qt Tools
    Replies: 1
    Last Post: 17th November 2010, 07:49

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.