Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableView sort indicator not shows
Forum Updated to NodeBB v4.3 + New Features

QTableView sort indicator not shows

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 5 Posters 3.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jronaldJ jronald

    @JonB said in QTableView sort indicator not shows:

    @jronald
    Don't know then. https://stackoverflow.com/questions/43535789/how-to-set-sort-indicator-for-qtableview-programatically reports the same as you, but was never answered if the indicators truly do not show for that user. It shows the principle of what you're supposed to write. There seem to be plenty of others for whom indicators are working fine. You're not using any special "skin"/"theme" on your platform (which is what?)? Or some table style or something which might not show the indicators?

    No, a demo simply for testing.

    P.S.
    Last thing: try a setSectionsClickable(true), just in case that influences...?

    Tried, failed.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #8

    @jronald
    OK. At this point: I can't help because I'm not C++, but:

    • Can you produce a 20-liner minimal (2 data rows) complete which compiles? So someone can just paste and try.
    • Tell us what version of Qt and what platform.
    • Request someone kind who fancies compiling. @mrjj is known to be very helpful at trying other people's UI stuff. :) :)
    • Compare their result to yours.
    • If it truly turns out to be inexplicable, make post on Qt bug forum.
    jronaldJ 1 Reply Last reply
    0
    • JonBJ JonB

      @jronald
      OK. At this point: I can't help because I'm not C++, but:

      • Can you produce a 20-liner minimal (2 data rows) complete which compiles? So someone can just paste and try.
      • Tell us what version of Qt and what platform.
      • Request someone kind who fancies compiling. @mrjj is known to be very helpful at trying other people's UI stuff. :) :)
      • Compare their result to yours.
      • If it truly turns out to be inexplicable, make post on Qt bug forum.
      jronaldJ Offline
      jronaldJ Offline
      jronald
      wrote on last edited by jronald
      #9

      @JonB said in QTableView sort indicator not shows:

      • Can you produce a 20-liner minimal (2 data rows) complete which compiles? So someone can just paste and try.

      ![0_1572462658913_TestQt.tar.bz2.png](Uploading 100%)
      PS: rename to TestQt.tar.bz2
      PS: cheating failed, the project can't be downloaded

      • Tell us what version of Qt and what platform.
      • Qt 5.13.1 AMD64
      • OS: Manjaro xfce AMD64
      • Request someone kind who fancies compiling. @mrjj is known to be very helpful at trying other people's UI stuff. :) :)
      • Compare their result to yours.

      I'll try it on Winows later.

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #10

        No need to upload something (it doesn't work) - 10 lines of code are enough:

        #include <QtWidgets>
        int main(int argc, char **argv)
        {
            QApplication app(argc, argv);
            
            QStringListModel model({"A", "B", "C", "D", "E", "F"});
            QTableView tv;
            tv.setModel(&model);
            tv.setSortingEnabled(true);
            tv.horizontalHeader()->setSortIndicatorShown(true);
            tv.show();
            return app.exec();
        }
        

        This is working fine for me.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        jronaldJ 1 Reply Last reply
        4
        • Christian EhrlicherC Christian Ehrlicher

          No need to upload something (it doesn't work) - 10 lines of code are enough:

          #include <QtWidgets>
          int main(int argc, char **argv)
          {
              QApplication app(argc, argv);
              
              QStringListModel model({"A", "B", "C", "D", "E", "F"});
              QTableView tv;
              tv.setModel(&model);
              tv.setSortingEnabled(true);
              tv.horizontalHeader()->setSortIndicatorShown(true);
              tv.show();
              return app.exec();
          }
          

          This is working fine for me.

          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by jronald
          #11

          @Christian-Ehrlicher
          Thank you
          It doesn't work for me.
          ascend.png
          descend.png

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #12

            What style is this? Did you compile Qt by yourself? Please try with fusion style ("-style fusion")

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            jronaldJ 1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #13

              Hi
              Just as a note.
              works on Win 10.
              alt text
              Linux Mint
              alt text

              so it seems related to Arch linux.

              1 Reply Last reply
              4
              • Christian EhrlicherC Christian Ehrlicher

                What style is this? Did you compile Qt by yourself? Please try with fusion style ("-style fusion")

                jronaldJ Offline
                jronaldJ Offline
                jronald
                wrote on last edited by jronald
                #14

                @Christian-Ehrlicher said in QTableView sort indicator not shows:

                What style is this?

                default style of Manjaro xfce

                Did you compile Qt by yourself?

                No, installed by pacman

                Please try with fusion style ("-style fusion")

                Do you mean compile Qt with -style fusion?

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #15

                  @jronald said in QTableView sort indicator not shows:

                  Compile Qt with -style fusion?

                  No, start the app with this parameter.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  jronaldJ 1 Reply Last reply
                  2
                  • Christian EhrlicherC Christian Ehrlicher

                    @jronald said in QTableView sort indicator not shows:

                    Compile Qt with -style fusion?

                    No, start the app with this parameter.

                    jronaldJ Offline
                    jronaldJ Offline
                    jronald
                    wrote on last edited by jronald
                    #16

                    @Christian-Ehrlicher said in QTableView sort indicator not shows:

                    @jronald said in QTableView sort indicator not shows:

                    Compile Qt with -style fusion?

                    No, start the app with this parameter.

                    a.png
                    Nice, any way to built in the style?
                    BTW, "Qt5 Settings (Qt5 Configuration Tool)" can change the style used by the demo.

                    Thanks

                    1 Reply Last reply
                    0
                    • VRoninV Offline
                      VRoninV Offline
                      VRonin
                      wrote on last edited by VRonin
                      #17

                      In your main() put QApplication::setStyle(QStyleFactory::create("Fusion"));

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      1 Reply Last reply
                      5

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved