Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, November 2007
Resizing TableView based on Window Width


Message 1 in thread

What would the most appropriate approach be to set the width of a 
tableview, actually the columns with the view) to resize or pin 
themselves to the size of the window? Is this a matter or hooking up 
some signals/slots between the window and the TableView? I basically 
want the last column to size itself according to the size of the window.


Thanks for any help
Mike Jackson
IMTS.us

--
 [ signature omitted ] 

Message 2 in thread

On 2007-11-05 10:57:30 -0500, Mike Jackson <imikejackson@xxxxxxxxx> said:

> What would the most appropriate approach be to set the width of a 
> tableview, actually the columns with the view) to resize or pin 
> themselves to the size of the window? Is this a matter or hooking up 
> some signals/slots between the window and the TableView? I basically 
> want the last column to size itself according to the size of the window.
> 
> 
> Thanks for any help
> Mike Jackson
> IMTS.us

Replying to my own message..

myTableView->horizontalHeader->setResizeMode(QHeaderView::Stretch);

--
 [ signature omitted ] 

Message 3 in thread

QTableView::horizontalHeader()
QHeaderView::setStrecthLastSection(bool stretch)

Combination of those two functions should do the trick:

myTableView->horizontalHeader()->setStrecthLastSection(true);

chris burke
phone: 617-621-0060 x195
email: cburke@xxxxxxx
skype: chris.burke0



Mike Jackson wrote:
> What would the most appropriate approach be to set the width of a 
> tableview, actually the columns with the view) to resize or pin 
> themselves to the size of the window? Is this a matter or hooking up 
> some signals/slots between the window and the TableView? I basically 
> want the last column to size itself according to the size of the window.
>
>
> Thanks for any help
> Mike Jackson
> IMTS.us
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 4 in thread

On 2007-11-05 11:03:39 -0500, Chris Burke <cburke@xxxxxxx> said:

> QTableView::horizontalHeader()
> QHeaderView::setStrecthLastSection(bool stretch)
> 
> Combination of those two functions should do the trick:
> 
> myTableView->horizontalHeader()->setStrecthLastSection(true);
> 
> chris burke
> phone: 617-621-0060 x195
> email: cburke@xxxxxxx
> skype: chris.burke0
> 
> 
> 
> Mike Jackson wrote:
>> What would the most appropriate approach be to set the width of a 
>> tableview, actually the columns with the view) to resize or pin 
>> themselves to the size of the window? Is this a matter or hooking up 
>> some signals/slots between the window and the TableView? I basically 
>> want the last column to size itself according to the size of the window.
>> 
>> 
>> Thanks for any help
>> Mike Jackson
>> IMTS.us
>> 
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/

That function must be in a newer Qt. I have 4.2.3. I guess I will have 
to code it up myself.

Mike

--
 [ signature omitted ] 

Message 5 in thread

On 2007-11-05 11:35:48 -0500, Mike Jackson <imikejackson@xxxxxxxxx> said:

> On 2007-11-05 11:03:39 -0500, Chris Burke <cburke@xxxxxxx> said:
> 
>> QTableView::horizontalHeader()
>> QHeaderView::setStrecthLastSection(bool stretch)
>> 
>> Combination of those two functions should do the trick:
>> 
>> myTableView->horizontalHeader()->setStrecthLastSection(true);
>> 
>> chris burke
>> phone: 617-621-0060 x195
>> email: cburke@xxxxxxx
>> skype: chris.burke0
>> 
>> 
>> 
>> Mike Jackson wrote:
>>> What would the most appropriate approach be to set the width of a 
>>> tableview, actually the columns with the view) to resize or pin 
>>> themselves to the size of the window? Is this a matter or hooking up 
>>> some signals/slots between the window and the TableView? I basically 
>>> want the last column to size itself according to the size of the window.
>>> 
>>> 
>>> Thanks for any help
>>> Mike Jackson
>>> IMTS.us
>>> 
>>> 
> 
> That function must be in a newer Qt. I have 4.2.3. I guess I will have 
> to code it up myself.
> 
> Mike


Ah.. copy and paste burns me again:

setStretchLastSection not

>> setStrecthLastSection

Thanks, that did what I wanted.

Mike

--
 [ signature omitted ]