Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. setBuddy in QFormLayout() doesn't work - why?
Forum Updated to NodeBB v4.3 + New Features

setBuddy in QFormLayout() doesn't work - why?

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 2 Posters 478 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.
  • P Offline
    P Offline
    PythonQTMarlem
    wrote on last edited by
    #1

    Hello,
    I want to link a QLabel with a QTextEdit() and I tried this:

    layout = QFormLayout()
            label_commando = QLabel("Command:")
            self.text_edit = QTextEdit()
            label_commando.setBuddy(self.text_edit)
    

    When I click on the QLabel with the computer mouse, the QTextEdit() doesn't get the input focus, why?

    F 1 Reply Last reply
    0
    • P PythonQTMarlem

      Hello,
      I want to link a QLabel with a QTextEdit() and I tried this:

      layout = QFormLayout()
              label_commando = QLabel("Command:")
              self.text_edit = QTextEdit()
              label_commando.setBuddy(self.text_edit)
      

      When I click on the QLabel with the computer mouse, the QTextEdit() doesn't get the input focus, why?

      F Offline
      F Offline
      friedemannkleint
      wrote on last edited by
      #2

      The buddy mechanism is intended for keyboard shortcuts; see https://doc.qt.io/qt-6/qlabel.html#setBuddy .

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PythonQTMarlem
        wrote on last edited by PythonQTMarlem
        #3

        Thank you. Here there is a big difference between web programming and Qt programming. Thats how it works:

        label_command = QLabel("&command:")
        self.text_edit = QTextEdit()
        label_commando.setBuddy(self.text_edit)
        
        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