[Interest] A ScrollBar needed in GridLayout

Eckhard Jokisch qt at eckhard-jokisch.de
Wed Apr 18 12:16:55 CEST 2012


On 04/18/12 11:10, Sujan Dasmahapatra wrote:
> I have implemented a  QGridLayout where one by one textedits are
> appended in multiple rows and 2 columns as below
> 
>  
> 
> QList <QTextEdit *> plotWidgets;
> 
>  
> 
> plotWidgets.append(new QTextEdit(this));
> 
> layout->addWidget(plotWidgets.last(), row, column);
> 
First of all in my opinion the scrollbar is not part of the gridlayout
but from the plotWidgets.
>  
> 
> I want a scrollbar should come if the row is more than or equal to
> 2(index is 2, means 3rd row). Means my MinimumRowHeight should be
> maintained as for when there are two  rows, I don't want the rowheight
> be reduced than that but a scrollbar should come.
> 
>  
> 
> Please give me some suggestions how can I make a scrollbar active when
> the rows are more than 2.
> 
My imagination tells me that you do not want a gridlayout but a
QListView or QTableView that have QTextEdits as custom ItemDelegates.
The view than manages it's scrollbar accordung to the number of rows and
the sizeHint()s from the ItemDelegates


When you subclass from QStyledItemDelegate it is rather easy to
calculate the height and return it in the reimplemented sizeHint method.
>  
> 
> Thanks for any help...Sujan
> 
> 
> 
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

--
Eckhard




More information about the Interest mailing list