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]Get text of a button
Forum Updated to NodeBB v4.3 + New Features

[Solved]Get text of a button

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 6.6k 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.
  • G Offline
    G Offline
    Godknows
    wrote on last edited by
    #1

    Hi guys,

    I wonder if there is a way to get the text of a button.
    E.g. some functions like:
    @QPushButton *button = new QPushButton("Test");
    QString temp = button->getName();@

    Thanks a lot in advance!

    BR

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Faema
      wrote on last edited by
      #2

      Hi,

      what about:
      @
      QPushButton* btn = new QPushButton("MyButton");
      qDebug() << "Text:" << btn->text();
      @

      BR

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KashiKyrios
        wrote on last edited by
        #3

        Hi,

        You can retrieve the button's text via QPushButton::text(), as such:
        @button->text();@

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

          Hi,

          very kind of you! Many thanks!

          BR

          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