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. Qt QSqlQueryModel::setQuery control what display in in the column

Qt QSqlQueryModel::setQuery control what display in in the column

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 4.4k 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.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    Im using :
    @QString query = "SELECT foo,n1,n2 FROM play_list";
    QSqlQueryModel::setQuery(query, queryDB);@

    in QSqlQueryModel subclass , but i dont want to display all the results that i getting from the select , i want to use the data and display only foo in the display and others results in others things . how can it be done?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dridk
      wrote on last edited by
      #2

      Hide column in the view, not in the model.
      For exemple :
      @QTableView::setColumnHidden ( int column, bool hide )@

      Nothing in Biology Makes Sense Except in the Light of Evolution

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        but i like to use the data from the other columns

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Subclassing [[Doc:QSortFilterProxyModel]] and reimplementing method filterAcceptsColumn() should do the trick.

          http://www.catb.org/~esr/faqs/smart-questions.html

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

            Hiding the data from the view does not stop you from using the data in other contexts...

            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