Results 1 to 7 of 7

Thread: How to keep Qtablewidget last row always visible

  1. #1
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default How to keep Qtablewidget last row always visible

    Hi ,
    I have Qtablewidget inside a QDialog,when my dialog is resized the tablewidget also gets resized and that i what the behavior i.e needed.

    But when i resize my table widget or scroll the vertical ScrollBar .The last row Item is not completely visible so when user click's on that last row QT internally emit the valuechanged() to make it visible and the row is most 1 step up.

    SO how can i keep my last row of tablewidget always visible irrespective of whether it is resized or it is scrolled so as to avoid the above behavior

    Any help would be appreciated thanks......

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to keep Qtablewidget last row always visible

    I'm not sure I understand what you want but if I understand correctly that you want your view always showing the last item regardless of everything, then attach a custom signal to the vertical scrollbar's valueChanged() signal to a custom slot that will reset the scrollbar to its maximum value.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to keep Qtablewidget last row always visible

    Setting the scroll bar to maximum value will bring it to it's Max position(Bottom).
    But in my case even when the scroll bar is scrolled midway the last Item is partially visible, which i want to be completely visible so as to avoid valueChanged() signal when user clicks on that Item.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to keep Qtablewidget last row always visible

    Quote Originally Posted by vaibhav View Post
    But in my case even when the scroll bar is scrolled midway the last Item is partially visible, which i want to be completely visible
    That's why I suggest scrolling it to the end. Obviously you will get a value changed signal since the slider moves as a result of resizing the widget. If you want something different, then I'm sorry but you'll have to explain more because I can't understand you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to keep Qtablewidget last row always visible

    Or maybe use QAbstractItemView::scrollToBottom () on mouserelease/resize?

    Btw what's the problem with valueChanged() signal being emitted?
    I didn't understand what you're saying.

  6. #6
    Join Date
    Aug 2012
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to keep Qtablewidget last row always visible

    Hi .
    I to have such kind of problem.

    I need to insert a row to my qtablewidget when i click the INSERT button.

    I have done like this.

    ui->mytblwdgt->insertrow(ui->mutblwgt->currentrow() + 1);
    but no row is added.
    Can any one tell me how to fix it.



    Thanks

  7. #7
    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: How to keep Qtablewidget last row always visible

    Firstly, this is not the same problem. This thread was about keeping the bottommost row of the table visible... nothing at all to do with new rows.

    Secondly, adding a new row to a table widget, mytblwdgt, based on the current index of another table widget, mutblwgt, is probably going to work sometimes and not others. I am going to assume that you did not copy and paste your actual code and that this is a typo. If there is no current row in the table then you will probably get a new row 0, otherwise you should get a new row where requested. If you are not getting a new row then we cannot see where the error is based on one line of trivial code in isolation and no description of where you looked for the row. Post a small, self-contained demonstration (in [code][/code] tags as you've been advised before) of the problem in the other thread you have asked this question in.
    Last edited by ChrisW67; 21st September 2012 at 06:38.

Similar Threads

  1. QTableWidget first column always visible
    By topino in forum Qt Programming
    Replies: 13
    Last Post: 30th December 2014, 08:06
  2. How do I determine if a QTableWidget's scrollbar is visible?
    By fuzzywuzzy01 in forum Qt Programming
    Replies: 3
    Last Post: 23rd February 2012, 16:42
  3. QTableWidget select only visible cells
    By Qiieha in forum Qt Programming
    Replies: 6
    Last Post: 23rd December 2011, 16:38
  4. Replies: 1
    Last Post: 6th January 2011, 04:19
  5. QT help is not visible
    By ganeshrgaikwad in forum Installation and Deployment
    Replies: 0
    Last Post: 12th January 2010, 11:30

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.