Results 1 to 3 of 3

Thread: Sorting disabled?

  1. #1

    Question Sorting disabled?

    Hi,
    im relatively new to QT and am clueless right now.
    I have a QTablewidget, that i populate with "table->setCellWidget(row, column, new QLabel(somestuff))" while populating setSortingEnabled is disabled and after the populating is finished re enabled.
    The sortIndicator seems to work somehow. By clicking the Columns the indicator changes, but nothing else. The order of the table stays the way it was before. Nothing changes at all in the table.
    What could i have done to disable sorting all together, or are additional steps needed for the sorting to work at all?

    Edit: sortByColumn and sortItems also have no effect on the Table.

    I'd love to hear some answers. And have a great day.
    Random Guy

  2. #2
    Join Date
    Jul 2012
    Posts
    191
    Thanks
    9
    Thanked 14 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sorting disabled?

    You should use a model instead of setting widgets directly.

    https://doc.qt.io/qt-5/model-view-pr...sing-reference


    Also why are you using a QLabel? If you just want to show a string, that's total overkill.

    Sorting doesnt work because Qt wont look into the label to find your string and sort by that. It cant sort widgets.

  3. #3

    Default Re: Sorting disabled?

    Thanks.
    Tried with all kinds of other Types for Strings and numbers. The only one that worked at that time were Labels then i just kept them.
    Edit: Topic can be closed.
    TL;DR: CellWidgets will not be sorted.

Similar Threads

  1. QwtPlot rendering when disabled
    By ChrisW67 in forum Qwt
    Replies: 0
    Last Post: 11th April 2013, 02:20
  2. QPushButton when disabled becomes grayed out
    By alenn.masic in forum Qt Programming
    Replies: 9
    Last Post: 19th February 2013, 03:25
  3. Shorcuts for disabled QActions
    By Michiel in forum Qt Programming
    Replies: 2
    Last Post: 23rd May 2007, 17:49
  4. Why the system buttons are disabled on Mac OS?
    By gtthang in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2007, 10:50

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.