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. It's a combo box question linked to the database
Forum Updated to NodeBB v4.3 + New Features

It's a combo box question linked to the database

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 733 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.
  • M Offline
    M Offline
    meria0503
    wrote on last edited by
    #1

    Hello, I'm a beginner developer. It's nothing but

    It's a Q combo box that is linked to SQL. There is a separate name for the row in the DB, what should I do if I want to put it as a different name in Qcombobox?

    Is this possible?

    ex)

    The value stored in DB hi. -> The value I want to retrieve from QCombo hello.

    Can I change it using the ini file like this? Or is there another way?

    jsulmJ JonBJ 2 Replies Last reply
    0
    • M meria0503

      Hello, I'm a beginner developer. It's nothing but

      It's a Q combo box that is linked to SQL. There is a separate name for the row in the DB, what should I do if I want to put it as a different name in Qcombobox?

      Is this possible?

      ex)

      The value stored in DB hi. -> The value I want to retrieve from QCombo hello.

      Can I change it using the ini file like this? Or is there another way?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @meria0503 Your description is really unclear.
      Do you want to translate text in QComboBox?
      Please explain more clearly.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      1
      • M meria0503

        Hello, I'm a beginner developer. It's nothing but

        It's a Q combo box that is linked to SQL. There is a separate name for the row in the DB, what should I do if I want to put it as a different name in Qcombobox?

        Is this possible?

        ex)

        The value stored in DB hi. -> The value I want to retrieve from QCombo hello.

        Can I change it using the ini file like this? Or is there another way?

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

        @meria0503
        If you mean you have entries in a SQL table which you are displaying in a QComboBox bound to a QSqlQueryModel and you want to change their text, one way would be to interpose a QAbstractProxyModel-derived class with your "translations".

        But you may mean something quite different! No idea what your "change it using the ini file" might mean.

        JonBJ 1 Reply Last reply
        0
        • jsulmJ jsulm

          @meria0503 Your description is really unclear.
          Do you want to translate text in QComboBox?
          Please explain more clearly.

          M Offline
          M Offline
          meria0503
          wrote on last edited by meria0503
          #4

          @jsulm @JonB

          I'm sorry for my poor translation.

          To give you more explanation,

          In the DB column,

          If there are 1, 2, and 3 lines,

          I'm going to put the row in QCombox.

          But the language in line 1, line 2, line 3 is English

          I want to print it out in Korean.

          jsulmJ 1 Reply Last reply
          0
          • M meria0503

            @jsulm @JonB

            I'm sorry for my poor translation.

            To give you more explanation,

            In the DB column,

            If there are 1, 2, and 3 lines,

            I'm going to put the row in QCombox.

            But the language in line 1, line 2, line 3 is English

            I want to print it out in Korean.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @meria0503 said in It's a combo box question linked to the database:

            I want to print it out in Korean.

            Do you already have the translations somewhere?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply
            0
            • jsulmJ jsulm

              @meria0503 said in It's a combo box question linked to the database:

              I want to print it out in Korean.

              Do you already have the translations somewhere?

              M Offline
              M Offline
              meria0503
              wrote on last edited by
              #6

              @jsulm

              There is no separate translation.

              You have information about the row.

              ex)

              JJ0101= 중앙101블록

              There's a list in this format.

              1 Reply Last reply
              0
              • JonBJ JonB

                @meria0503
                If you mean you have entries in a SQL table which you are displaying in a QComboBox bound to a QSqlQueryModel and you want to change their text, one way would be to interpose a QAbstractProxyModel-derived class with your "translations".

                But you may mean something quite different! No idea what your "change it using the ini file" might mean.

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

                @meria0503

                @JonB said in It's a combo box question linked to the database:

                and you want to change their text, one way would be to interpose a QAbstractProxyModel-derived class with your "translations".

                M 1 Reply Last reply
                0
                • JonBJ JonB

                  @meria0503

                  @JonB said in It's a combo box question linked to the database:

                  and you want to change their text, one way would be to interpose a QAbstractProxyModel-derived class with your "translations".

                  M Offline
                  M Offline
                  meria0503
                  wrote on last edited by
                  #8

                  @JonB said in It's a combo box question linked to the database:

                  QAbstractProxyModel

                  Are you saying that it is possible to use the QAbstract proxy model?

                  JonBJ 1 Reply Last reply
                  0
                  • M meria0503

                    @JonB said in It's a combo box question linked to the database:

                    QAbstractProxyModel

                    Are you saying that it is possible to use the QAbstract proxy model?

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

                    @meria0503
                    Yes, I don't know how to be much clearer!

                    There you could override the data() method and "translate" strings retrieved from the database into strings you want shown in the combo box. It's one way, without too much disruption. You might write your own QAbstractProxyModel, or you might derive from QIdentityProxyModel as the starting point:

                    Because it does no sorting or filtering, this class is most suitable to proxy models which transform the data() of the source model

                    M 1 Reply Last reply
                    3
                    • JonBJ JonB

                      @meria0503
                      Yes, I don't know how to be much clearer!

                      There you could override the data() method and "translate" strings retrieved from the database into strings you want shown in the combo box. It's one way, without too much disruption. You might write your own QAbstractProxyModel, or you might derive from QIdentityProxyModel as the starting point:

                      Because it does no sorting or filtering, this class is most suitable to proxy models which transform the data() of the source model

                      M Offline
                      M Offline
                      meria0503
                      wrote on last edited by
                      #10

                      @JonB

                      Thank you for your advice.

                      I'll give it a try.

                      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