Results 1 to 3 of 3

Thread: Which event/signal to intercept on QTableView column resize

  1. #1
    Join Date
    Oct 2010
    Location
    Opole, PL
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Which event/signal to intercept on QTableView column resize

    Hello,

    this is my first post here, so hello to everyone.

    I googled considerable amount of time for a solution to my problem, but was unable to find, so I decided to post here.

    My application uses QTableView subclass (called VideoTableView), where columns should have proportional width:
    first 50%, second 20%, etc.

    I've reimplemented resizeEvent in my subclass, so when I resize widget containing my VideoTableView, columns width is updated (code below).

    What I need, is to somehow intercept event or signal, when columns (not whole widget) in VideoTableView get resized. I found there is a slot QTableView::columnResized(), but I don't know, what event/signal triggers itd.

    Code below is triggered in resizeEvent reimplemented in VideoTableView.

    Qt Code:
    1. int tableWidth = width();
    2.  
    3. setColumnWidth(FilmTag::FileName, tableWidth*columnsWidth[FileName]/100);
    4. setColumnWidth(FilmTag::TagList, tableWidth*columnsWidth[Tags]/100);
    5. setColumnWidth(FilmTag::Size, tableWidth*columnsWidth[Size]/100);
    To copy to clipboard, switch view to plain text mode 

    columnsWidth is an array, which stores width of each column as a percentage of total width of VideoTableView. I'd like it to update when someone manually changes width of a column. If I don't, on another widget resize it would resize it's columns to predefined values.

    Thank you upfront for any help.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Which event/signal to intercept on QTableView column resize

    Last edited by ChrisW67; 18th October 2010 at 05:35. Reason: spelling corrections

  3. The following user says thank you to ChrisW67 for this useful post:

    nephre (18th October 2010)

  4. #3
    Join Date
    Oct 2010
    Location
    Opole, PL
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Which event/signal to intercept on QTableView column resize

    That's it, thanks very much
    In the 1960's people took LSD to make the world weird.
    Now the world is weird and people take Prozac to make it normal.

Similar Threads

  1. Replies: 1
    Last Post: 1st May 2010, 23:03
  2. Intercept minimize window event
    By vereteran in forum Newbie
    Replies: 8
    Last Post: 17th October 2009, 06:33
  3. resize event
    By wirasto in forum Qt Programming
    Replies: 6
    Last Post: 16th July 2009, 10:01
  4. Intercept ShowDesktop event
    By Lele in forum Qt Programming
    Replies: 4
    Last Post: 20th December 2007, 20:05
  5. Resize event
    By boss_bhat in forum Qt Programming
    Replies: 5
    Last Post: 19th July 2006, 15:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.