Disable horizontal scroll bar in QWebView Qt5 - c++

I'm having a problem with the scroll bar in Qt5.4. Right now, I'm trying to display a webpage in a Qt Application, and I do this by adding a Qwebview widget inside a Qdialog, everything works fine, except that I would like to disable the horizontal scroll bar in the Qdialog. A picture is attached below.
Thank you very much for any help!

this issue happened because of width of a html element.
one of the html element (image, div,...) width are more than the width of dialog you declared. the html elements can not be scaled automatically!
you can set css to overflow:hidden for the body of the html or the second way is to set wider width for the dialog.

Related

Is there a way to attach or anchor two QWidgets together?

I'm getting started with Qt and decided to build a full-screen text editor. I want to have a button (button with arrow in screenshot) attached to a QDockWidget which opens and closes it so the button is always visible to the right side of the screen and stay anchored to it when dock is visible or resized.
My current app is a simple fullscreen textEdit set to centeralwidget in Mainwindow.
I haven't found a way to do this yet with layouts or existing addAnchor() functions so any help or direction is appreciated.
You can achieve what you want by using a container for your text edit and the button. A QWidget instance can be used as an "invisible"*** container for other widgets.
So in Qt Designer you add a widget as a central widget of the main-window, inside this widget you add the text edit and the button, then you set a vertical layout for this container widget.
Don't forget to restrict the docking widget to only dock to the right side, you can do that with: dock->setAllowedAreas(Qt::DockWidgetArea::RightDockWidgetArea); //assuming dock is the pointer to your QDockWidget.
In case you want the dockWidget to be able to dock to any side and the button to follow, you can do that too, but it get a little bit more complicated. Basically you need to connect a slot to dockLocationChanged of your dockWidget and based on where it's docked you need to set-up a new layout for the container widget to be vertical or horizontal and the order of the textEdit and the button based on the side the dock happened.
LE:*** you will most likely need to set the margins you want, since both the widget and it's layout can have them and the actual content might have higher spacing than you want.

QT Designer: how to align a button to the right (in resizable form)

Usign QTDesigner it's not clear to me how to keep a button aligned to the right also when the form is resized..
Button is placed inside a tab widget that is resized correctly.
I try different layout but no one works for me...
Any suggestion ?
Many thanks!
Put the button in a horizontal or grid layout, and then put an expanding horizontal spacer on the left-hand side of the button (so it pushes it to the right):

Qt Show Half of Widget

I have a QGroupBox widget that I am animating off the screen. The problem is that I only want to show certain parts of the group box. For example if the widget is 200 pixels in width how do I only show the first 100 pixels with out changing the size of the widget and making the layout go funny?
Thanks in advance
I have come up with a solution. By placing the widget inside of another group box and animating it to move out side the bounds of the group box produces the desired result.

How to make the position of Widget fix?

I am creating a widget on click the button. The widget is appearing at center of the screen. I want to show that widget at a proper predefined position of the screen. And when ever I open that widget it should show at that point only. How to do this not able to understand.
Use QWidget::move() function before you show it.

Qt: Dragging a widget to scroll the widget's parent QScrollArea?

I've got a long horizontal QLabel displaying a png (the image shows a signal/time graph). Under that, I've got a QTableWidget. Both of these are in a QScrollArea because I want them to stay vertically aligned (the cells in the table correspond with the signal seen directly above them). I'm trying to add a handler to the QLabel such that the user can use the picture itself to scroll the scrollarea, rather than having to use the scrollbar. Is there a tried-and-tested way to do this? Directly setting the scrollarea's sliderPosition inside the QLabel's dragMoveEvent doesn't seem smart, because when the scrollarea scrolls it also leads to another dragMoveEvent on the (moving) QLabel.
I would suggest wrapping the combination (including the scroll area) in their own widget, and overriding the dragMoveEvent() on that widget. The dragMoveEvent() shouldn't be triggered when you change the scroll position if you are doing it this way, I wouldn't think, although I haven't actually tested it.