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.2k 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.
  • J jronald
    30 Oct 2019, 18:27

    @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.

    J Online
    J Online
    JonB
    wrote on 30 Oct 2019, 18:35 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.
    J 1 Reply Last reply 30 Oct 2019, 19:11
    0
    • J JonB
      30 Oct 2019, 18:35

      @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.
      J Offline
      J Offline
      jronald
      wrote on 30 Oct 2019, 19:11 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
      • C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 30 Oct 2019, 19:22 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

        J 1 Reply Last reply 30 Oct 2019, 19:29
        4
        • C Christian Ehrlicher
          30 Oct 2019, 19:22

          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.

          J Offline
          J Offline
          jronald
          wrote on 30 Oct 2019, 19:29 last edited by jronald
          #11

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

          1 Reply Last reply
          0
          • C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 30 Oct 2019, 20:22 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

            J 1 Reply Last reply 31 Oct 2019, 03:09
            0
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 30 Oct 2019, 21:23 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
              • C Christian Ehrlicher
                30 Oct 2019, 20:22

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

                J Offline
                J Offline
                jronald
                wrote on 31 Oct 2019, 03:09 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
                • C Online
                  C Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 31 Oct 2019, 07:10 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

                  J 1 Reply Last reply 31 Oct 2019, 07:14
                  2
                  • C Christian Ehrlicher
                    31 Oct 2019, 07:10

                    @jronald said in QTableView sort indicator not shows:

                    Compile Qt with -style fusion?

                    No, start the app with this parameter.

                    J Offline
                    J Offline
                    jronald
                    wrote on 31 Oct 2019, 07:14 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
                    • V Offline
                      V Offline
                      VRonin
                      wrote on 31 Oct 2019, 09:24 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

                      17/17

                      31 Oct 2019, 09:24

                      • Login

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