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. [SOLVED]switch columns in a QSqlRelationalTableModel
QtWS25 Last Chance

[SOLVED]switch columns in a QSqlRelationalTableModel

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.5k Views
  • 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.
  • F Offline
    F Offline
    fluca1978
    wrote on last edited by
    #1

    Hi,
    is it possible to change the order of columns into a QSqlRelationalTableModel without having to manually specify a query? For instance, if I've got a table with (surname, name) and I want to display it as (name, surname), is there an easy and handy way?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      You can do it on the view level.

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        void QHeaderView::moveSection ( int from, int to )

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fluca1978
          wrote on last edited by
          #4

          [quote author="Eddy" date="1318272331"]void QHeaderView::moveSection ( int from, int to )[/quote]

          Thanks, this is perfect!

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            Great!

            Could you edit your title and add [solved] in front of it? Thanks.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0

            • Login

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