was setViewportMargins - only at bottom of viewport ? source of "view port " in QT ?
-
EDITED
Can anybody point me to QT document explaining QT "viewport " and associated "stuff"?
Especially when it comes to using QTextEdit .
I found and lost a picture of QTextEdit describing the actual parts of QTextEdit...
I do not need class doc - it does not contains the info am looking for.
I am NOT asking for help editing the actual text, I need to learn the terminology QT is using about the "viewpoort".For example - as of now it is hit and miss - I can setMaximumHeight(150); of "viewport" but I do not know how to move it....
Maybe the terminology is not "move Viewport " , maybe in is buried in the QTextEdit class hierarchy...It would help me to know how QT manipulates "viewport" - in general terms.
ThanksHow do I set setViewportMargins - only at the bottom of viewprort ?
void setViewportMargins(int left, int top, int right, int bottom);
The attached code gives this result - margins on left and right of the viewport.
I need a space / margin of height 10 at the bottom of the viewport only.
'
setViewportMargins(sz.height()-10,0,sz.height()-10,0); -
Maybe this is the diagram you are thinking of. I do not know of any scroll area specific one.
The view port is the visible area inside any QAbstractScrollArea that you can see some or all of the internal widget through. If the view port is smaller than the contained widget then you get scroll bars by default. QTextEdit is derived from QAbstractScrollArea and its viewport shows some or all of the render text.
The view port is whatever size it is, driven entirely by the QAbstractScrollArea-derived widget it is part of. You do not "move it", which is probably why you cannot find it. You can change what portion of the content shows in the viewport with QScrollArea::ensureVisible(). or QScrollArea::scrollContentsBy().
How do I set setViewportMargins - only at the bottom of viewprort ?
void setViewportMargins(int left, int top, int right, int bottom);The attached code gives this result - margins on left and right of the viewport.
setViewportMargins(sz.height()-10,0,sz.height()-10,0);Yes. You have set a margin of zero for top and bottom, and non-zero value for left and right, so that is what you got.
If you want a margin at the bottom then set a number of pixels for that parameter. -
Maybe this is the diagram you are thinking of. I do not know of any scroll area specific one.
The view port is the visible area inside any QAbstractScrollArea that you can see some or all of the internal widget through. If the view port is smaller than the contained widget then you get scroll bars by default. QTextEdit is derived from QAbstractScrollArea and its viewport shows some or all of the render text.
The view port is whatever size it is, driven entirely by the QAbstractScrollArea-derived widget it is part of. You do not "move it", which is probably why you cannot find it. You can change what portion of the content shows in the viewport with QScrollArea::ensureVisible(). or QScrollArea::scrollContentsBy().
How do I set setViewportMargins - only at the bottom of viewprort ?
void setViewportMargins(int left, int top, int right, int bottom);The attached code gives this result - margins on left and right of the viewport.
setViewportMargins(sz.height()-10,0,sz.height()-10,0);Yes. You have set a margin of zero for top and bottom, and non-zero value for left and right, so that is what you got.
If you want a margin at the bottom then set a number of pixels for that parameter.@ChrisW67 said in was setViewportMargins - only at bottom of viewport ? source of "view port " in QT ?:
If you want a margin at the bottom then set a number of pixels for that parameter.
and that is what I was asking for .
Can you write an actual code for that ?
It looks as "margin" can be only in pairs - left - right or top = bottom.
-
I believe my problem is in numbering the points.
Here is the result of my current code:qDebug()<< "\nTRACE_MDI_XTERM sz.height()\n" << QString::number(sz.height());
qDebug()<< "\nTRACE_MDI_XTERM sz.width() \n" << QString::number(sz.width());
setViewportMargins(0,0,65,100);
and the viewport dimensions
TRACE_MDI_XTERM sz.height()
"68"TRACE_MDI_XTERM sz.width()
"102"BTW I do appreciate the link, that is not the one I had before.
And of course - it is missing which way QT aligns x.y coordinates .It appears that only upper left corner is for sure x = 0 and y =- 0.
I think "normal windows " would put y at the bottom right y as minus and x as plus....
In that case
i really could use QT coordinates designation / conventions etc. -
More resources
https://doc.qt.io/qt-6/coordsys.html
time for refresher course about "coordinates transform "....
-
@ChrisW67 said in was setViewportMargins - only at bottom of viewport ? source of "view port " in QT ?:
If you want a margin at the bottom then set a number of pixels for that parameter.
and that is what I was asking for .
Can you write an actual code for that ?
It looks as "margin" can be only in pairs - left - right or top = bottom.
@AnneRanch said in was setViewportMargins - only at bottom of viewport ? source of "view port " in QT ?:
Can you write an actual code for that ?
Seriously?
setViewportMargins(0, 0, 0, 10);i really could use QT coordinates designation / conventions etc.
-
@AnneRanch said in was setViewportMargins - only at bottom of viewport ? source of "view port " in QT ?:
Can you write an actual code for that ?
Seriously?
setViewportMargins(0, 0, 0, 10);i really could use QT coordinates designation / conventions etc.