ScrollView clips all its contents to its size. Is it possible to make it work only for top and bottom but allow children to go out of parent's frame on the right and on the left?
How to make ScrollView clip only vertically?
3.1k Views Asked by Rinat Veliakhmedov At
2
There are 2 best solutions below
0
Paul-Sebastian Manole
On
If what you want is to only scroll in one direction, then just set the width/height of the content item to the width/height of the ScrollView, using property bindings (because items inside ScrollView are reparented to ScrollView.contentItem). The below example will scroll only vertically. I've tested it, if you need confirmation that it actually works.
Item {
ScrollView {
id: scrollview1
anchors.fill: parent
anchors.margins: 20
clip: true
ColumnLayout {
width: scrollview1.width
}
}
}
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 QML
- Connecting Signal QML to C++ (Qt5)
- How to connect a destroyed signal of C++ object from QML?
- QML Dialog is broken?
- how to connect the signal to slot in pyqt5 and qml?
- QML Canvas.requestAnimationFrame explodes
- QTimer::singleShot equivalent for QML
- Changing model doesn't affect ComboBox
- setting wrapMode property of Text in ScrollView
- where and what to learn to use Qt5?
- Qt5/QML Displaying a custom route on a map
- Qt application disappears
- QtQuick2 - QML reusable item focus changes when selecting/clicking outside/inside of root item
- QML window resize/move flicker
- QQmlPropertyCache: QQuickItem has FastProperty class info, but has not installed property accessors
- Qt application trying to load platform plugin "xcb" instead of "eglfs"
Related Questions in SCROLLVIEW
- Scroll view mistakes
- Android: EditText in ScrollView goes of the screen when kayboard appears
- How to add scrollview to keyboardView in android
- ScrollView with RelativeLayout
- Scroll view does not work
- Android: scroll down after animation of LinearLayout.addview
- Android setEllipsize not working on class that extends EditText
- scroll bar doesn't scroll to the last view
- How to make a view not to scroll with soft input keyboard?
- How to have buttons scroll with background in Swift?
- Optimize Scroll list on Unity
- Android Blank screen when I add the ScrollView
- Scolling with multiple RecyclerViews in Layout
- How can we scroll parent layout while scrolling recyclerview android
- Dynamic content inside scrollview lost last view
Related Questions in CLIPPING
- Making CSS clip rect responsive
- Masking/Clipping div
- How do I find the part of a NSScrollView's documentView that's not beneath a window's toolbar?
- How to make ScrollView clip only vertically?
- Android image drawn clipped
- Clipping elements in a long vector to +/-threshold
- Clip CCSprite/CCNode with another CCSprite/CCNode - Cocos2D
- Issue with clip-path on an image in Internet Explorer
- Use Bezier Path as Clipping Mask
- Wiew port for group of mesh in threejs
- SVG Clipping on multi Browser
- three js: find intersection between a mesh and a clipping plane
- WPF clipping even when no clipping is desired - how to turn it off?
- iPhone - How to draw something in a view
- Rounded rect on NSView that clips all containing subviews
Related Questions in QT5.5
- QT framework processing gzip payload
- Project ERROR: Unknown module(s) in QT: winextras
- How to make ScrollView clip only vertically?
- 'https' link is not loading in qwebview in qt creator
- Project ERROR: Unknown module(s) in QT: x11extras
- How to create a Qt application using MSVC14?
- Global shortcut in QML
- QVideoWidget stand alone. How to stop video when window closes?
- setting linker options in qt5
- How to handle pressed and released signals in overlapping Mousareas?
- libmediainfo: qt5 project undefined symbol errors
- QT5.5 QSound isFinshed
- Segfault when accessing QApplication::arguments
- Get selected element in QTreeView
- QTreeView usage example - how to add a subnode to an existing item?
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?
I can only imagine one reason, why you don't set the
ScrollView's width to a higher value (thecontentItem's width).To be able to do so, while not constraining the
ScrollViewin it's width, you can use a simple trick:You'll wrap it in the
Item, anchor to this, and you'll be good. Alternatively you could use masks, but this would be... more complicated.Per se it is not possible to clip only horizontal or vertical, as the clipping is done using the
Item's bounding box.