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] assign button ID
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] assign button ID

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 931 Views 2 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
    Marty
    wrote on last edited by Marty
    #1

    hello,

    I need to assign some buttons an ID. I created my buttons in QtDesigner and it doesn't seem it is possible with QtDesigner to assign IDs (correct me if i am wrong).

    So i am doing this into the code.

    I am assigning an ID :

    ui->outputGroup->setId(ui->out1, 1);

    but when i grab this ID the application crashes :

    ui->inputGroup->button(1)->setChecked(true);

    It seems i am doing it wrong

    qDebug() << "button pressed : " << ui->inputGroup->button(1) << endl;

    This always returns

    button pressed : QObject(0x0)

    whatever the button is : button(1), button(2), button(3) etc...

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

      Hi,

      Unless it's a typo here, you are assigning IDs to the outputGroup and request the button from the inputGroup

      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
        Marty
        wrote on last edited by
        #3

        ok. The problem stands between the keyboard and the chair...
        apologies.
        thanks !

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

          Don't worry, it happens to all of us ;)

          Happy coding !

          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

          • Login

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