Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to convert String to Qpushbutton type
Forum Updated to NodeBB v4.3 + New Features

How to convert String to Qpushbutton type

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 2 Posters 2.1k Views 1 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.
  • M Offline
    M Offline
    mvenkat061
    wrote on last edited by
    #1

    Hi all,

    I could like to pass all widget Id's to the code dynamically i.e. through .txt file so that i can make code as configurable,
    while read .txt file it reads in string data type but i need in Qpushboot type.

    So how to convert string data type to QpushButton data type in Qt.

    Thank you

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean like a Designer based UI ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mvenkat061
        wrote on last edited by
        #3

        hi,
        Ya I have designed Ui file in designer and included in creator.

        my Ui have 100 buttons. and i want to set color and text on each button.
        so way to do the same is i have to write obj1.settext() and obj1.setcolor(),
        obj2.settext(),obj2.setcolor().....so on 100 times.

        but i want to make like x.settext(), x.setcolor()
        x will be configurable data. Reading from .txt file.

        but .txt read in string or char data type. how to convert string/char to Qpushbutton type.

        How can i make configurable design.

        Please suggest alternative way to achieve the same.

        Thank you

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Give an object name to all your buttons and then search them using this name to update their content from your file data.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mvenkat061
            wrote on last edited by
            #5

            HI SGaist,

            How can i get signal sender properties like id, state ..etc in slot?

            Example:

            if signal generated on click on push button then it called some slot. Now how can get this button properties like Id of button, text on button..etc in slot..

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can use e.g. sender()

              Why do you need all these information ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mvenkat061
                wrote on last edited by
                #7

                Hi SGaist,
                Thank you for reply..
                I am making GUI application in which i have a requirements like 1. I have to handle events from Ui and 2. update processed on Ui.

                so i am making GUI module for my requirements with some conditions
                like Module should be configurable.
                so all events and its actions will be defined in config, code should excite the events as per configurations.

                for this i should know who is the sender of signals so that i can find sender/ event in config file and excite action as per config.

                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