Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. SLOT 'setEnable(true)' nicht gefunden
Qt 6.11 is out! See what's new in the release blog

SLOT 'setEnable(true)' nicht gefunden

Scheduled Pinned Locked Moved Unsolved German
4 Posts 3 Posters 1.3k 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.
  • D Offline
    D Offline
    deleted369
    wrote on last edited by
    #1

    Hallo,

    ich möchte bei Klick auf Btn1 den Btn2 anzeigen.

    QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));
    

    aber ich bekomme hier die Fehlermeldung:
    QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));

    Wieso?

    JonBJ Gojir4G 2 Replies Last reply
    0
    • D deleted369

      Hallo,

      ich möchte bei Klick auf Btn1 den Btn2 anzeigen.

      QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));
      

      aber ich bekomme hier die Fehlermeldung:
      QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));

      Wieso?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @getit
      Wenn Sie mein Schuele-Deutsch verstehen koennen ;)

      You cannot pass a parameter to the function in your SLOT declaration. You could only write SLOT(setEnabled(bool)). To pass your value of true, you either need to write it as a lambda or write a dedicated function to call the btn2.setEnabled(true).

      1 Reply Last reply
      3
      • D deleted369

        Hallo,

        ich möchte bei Klick auf Btn1 den Btn2 anzeigen.

        QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));
        

        aber ich bekomme hier die Fehlermeldung:
        QObject::connect(btn1, SIGNAL(clicked()), btn2, SLOT(setEnabled(true)));

        Wieso?

        Gojir4G Offline
        Gojir4G Offline
        Gojir4
        wrote on last edited by Gojir4
        #3

        @getit Sorry I don't speak German.
        You can try using a lambda.

        QObject::connect(btn1, QPushButton::clicked, [this](){
            btn2->setEnabled(true)
        }
        
        • You cannot use parameter in signal-slot connection
        • QPushButton::clicked() and `QWidget::setEnabled(bool) are not compatible
        D 1 Reply Last reply
        3
        • Gojir4G Gojir4

          @getit Sorry I don't speak German.
          You can try using a lambda.

          QObject::connect(btn1, QPushButton::clicked, [this](){
              btn2->setEnabled(true)
          }
          
          • You cannot use parameter in signal-slot connection
          • QPushButton::clicked() and `QWidget::setEnabled(bool) are not compatible
          D Offline
          D Offline
          deleted369
          wrote on last edited by
          #4

          @Gojir4 said in SLOT 'setEnable(true)' nicht gefunden:

          @getit Sorry I don't speak German.
          You can try using a lambda.

          QObject::connect(btn1, QPushButton::clicked, [this](){
              btn2->setEnabled(true)
          }
          
          • You cannot use parameter in signal-slot connection
          • QPushButton::clicked() and `QWidget::setEnabled(bool) are not compatible

          Vielen Dank!!

          QObject::connect(btn1, &QPushButton::clicked, [btn2]() {
                  btn2->setEnabled(true);
              });
          
          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