+ Reply to Thread
Results 1 to 1 of 1

Thread: Custom QScrollBar problem

  1. #1
    Join Date
    Oct 2015
    Posts
    13
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Custom QScrollBar problem

    Hi everyone.

    I have my own QStyle class that initially was responsible only to visualize the slider, not the movement arrows (up, down, left and right). These were not being drawn.
    Now I have to modify it to display those arrows. I have managed to make them look but I have a problem with the area where the slider is deployed. It seems that the area is still the innicial, without arrows, so if I move the slider, it slides the arrows.
    What I have done and I do not understand why it does not work is in the QStyle :: subControlRect method, the QStyle :: SC_ScrollBarGroove subcontrol, modify the rectangle so that it takes into account the squares of the arrows.
    After this change the slider continues to cover the arrows, the only thing that has changed is that the slider, being in the minimum value, if I move with the mouse, it takes just the size of the square of the arrow.

    My code in QStyle :: subControlRect method (rectangle of the arrows buttons is 16x16):
    Qt Code:
    1. case SC_ScrollBarGroove:
    2. if (scrollbar->orientation == Qt::Horizontal)
    3. result.setRect(16, 0, scrollbar->rect.width()-32, scrollbar->rect.height());
    4. else
    5. result.setRect(0, 16, scrollbar->rect.width(), scrollbar->rect.height()-32);
    6. break;
    To copy to clipboard, switch view to plain text mode 
    Any ideas?
    Last edited by PinTxO; 17th March 2017 at 15:40.

+ Reply to Thread

Similar Threads

  1. QScrollbar bottom problem
    By Alundra in forum Qt Programming
    Replies: 4
    Last Post: 6th June 2014, 14:35
  2. Problem styling QScrollBar::handle
    By kerchen in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2012, 18:06
  3. QScrollbar handle stretch problem
    By Beppe in forum Qt Programming
    Replies: 4
    Last Post: 30th July 2009, 12:58
  4. Custom (pixmap) slider handle for QScrollBar
    By Antrax in forum Qt Programming
    Replies: 1
    Last Post: 17th October 2006, 11:04
  5. QScrollBar: custom slider's size ?
    By deweyjew in forum Qt Programming
    Replies: 1
    Last Post: 9th May 2006, 09:57

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