just like the title described, when i redraw the scrollbar in QTreeView which has a header(QHeaderView), but the scrollbar's height is the entire height of QTreeView, and i want to let the scrollbar's height equals the QTreeView's height minus the header's height.just like the pic below:

how to specify the height of scrollbar in QTreeView
1k Views Asked by Lomuto At
1
There are 1 best solutions below
Related Questions in QT
- C++ template using pointer and non pointer arguments in a QVector
- Using QPointer and QObject::connect with C++11
- qt How to style a QToolBar > QToolButton overflow button?
- Qt - Repeatedly write at beginning of file
- C++ Mongodb driver, not working
- deletion and cleanup of worker thread in Qt crashes
- How to drap item from QTableView to QPushButton?
- get image type from qimage
- C++ QT Getting part from QString
- How to connect a destroyed signal of C++ object from QML?
- How to get shader version from QOpenGLShader?
- Size of Qt QRadioButton able to get smaller, but not larger than default
- error WinSock.h has already been included Boost Windows Qt
- How to call a non-class member function with pointers as parameters with QtConcurrent::run?
- What is the difference between MinGW SEH and MinGW SJLJ?
Related Questions in SCROLLBAR
- Scrollbar for Message Widget in Tkinter
- Adding a listener to a VerticalScrollBar in flex
- enabling horizontal scrollBar in textView - Swift
- Listview on android, scroll only with scrollbar
- Lag in scrolling behavior on IE 10 and IE Edge modes
- How to make the horizontal scrollbar visible in DT::datatable
- SAPUI5: Disable scrollbar for sap.ui.unified.ShellLayout
- Wpf datagrid scrollbar freezes
- JavaFX TextArea - unwanted ScrollBars when resizing
- Primefaces datatable header alignment with scrollbar
- How to have scroll when zooming canvas stage
- WPF change ListView scroll speed
- Add a vertical scrollbar to a wxFrame accross multiple wxPanels
- Implementing scroll bar along x-axis
- angular-perfect-scrollbar | update, scroll to bottom, or alternative
Related Questions in QTREEVIEW
- Multiple columns in a QTree / QStandardItemModel
- QTreeView closes immediately
- what is the signal for qtreeview changed
- Changing QTreeview checkbox to icon without using stylesheets
- python emit signal on clicked QTreeview item checkbox changed
- PyQT which tree view to display changing data
- how to specify the height of scrollbar in QTreeView
- pyside checkboxes editable
- Make QTreeview's Column Editable in Pyside
- setData for second column of QstandardItem
- Add child with multiple columns to qtreeview in pyside
- How to use a QTreeView Model to display a list of files/folders get through mtp stack
- QTreeView merge some cells
- How to get the selected item in a QTreeView?
- How to save PySide tree view model structure
Related Questions in REDRAW
- Openlayers-3 Force a map refresh
- how to specify the height of scrollbar in QTreeView
- Photoshop redraw issue in JSX modal window when adding dynamic text fields
- Vim - zt will redraw the window with the cursor at the top. Can you redraw with it say, 4 lines down?
- Highcharts redraw not working with alignTicks
- How to navigate page with Vaadin menubar?
- Redraw issue with UITableView using Objective C and Xcode 6
- How can I increase the speed of redraw in AutoCAD like app
- Redraw and resize canvas, on mouse drawing
- Android - How to find a Rect after a zoom
- Blackberry scrolling doesn't redraw fields
- Stop JScrollPane from redraw JPanel
- Items not drawing on Resize of Viewbox, Silverlight
- Redraw Drawable by timer using invalidateSelf() not working
- Cocoa: CALayer: continuous redraw of a view continuously increases allocated memory
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A solution for your problem might be setting the location of the vertical scrollbar to a
constant_offsetvalue acquired from theQHeaderView(on the y axis).This could be done by subclassing the
QTreeViewlike so:Depending on the
sizePolicytheupdateVertScrollBarmethod could be called just after data is filled or as presented in the sample implementation the update can occur for eachresizeEvent- which should cover various resizing performed to the widget.EDIT
Additionally removing the blank space left from the shrunk scrollbar would be tricky. First denote that the
QTreeViewis built from a viewport widget and scrollbars (among others). The issue you now see comes from the fact that viewport plus vertical scrollbar widths (if visible) should match and this is calculated internally.I stated that it's tricky since there is a load of stuff happening when you try to force the size of these components. Some updates are called in-place some are called through the event loop. You can check this to get more detaile info about the concept. Similar approach is probably applied to
QTreeView.Basically what you would need to do is to stretch the viewport width. This should be probably done during the
resizeEventbut calling from there methods likeviewport()->setGeometry()might not end well - you might get caught into a loop. You might tryblockSignalsbut I'm not sure this would help. In general if you want to mess with the internals of a givenQtwidget you should go through it's implementation at least briefly.