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. QPushButton Enter/Return
Forum Updated to NodeBB v4.3 + New Features

QPushButton Enter/Return

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 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.
  • F Offline
    F Offline
    Faema
    wrote on last edited by
    #1

    Hello,

    i have a dialog with 4 buttons on qdialogbuttonbox. I want that the user can switch the focus via tab and can active the buttons with enter/return (similar to space).
    It works if i call setDefault(true) for every button, but i read in some post that only 1 buttons should be the "Default-Button".

    Is there a anthor way to make this work? Sure, i can install a eventfilter, but it sounds strange for me that there is not an easy way similar to setDefault(true).

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

      Hi
      Since enter has other roles, like for dialogs, they made key for press it
      "spacebar".
      So you can activate with keyboard.

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

        yes, i know that.
        But my customers are used to press return for more then 20 years now and not spacebar. So what is the best solution?

        mrjjM 1 Reply Last reply
        0
        • F Faema

          yes, i know that.
          But my customers are used to press return for more then 20 years now and not spacebar. So what is the best solution?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Faema
          well if setDefault works then use it?
          Test with dialog to see if side effects :)

          F 1 Reply Last reply
          0
          • mrjjM mrjj

            @Faema
            well if setDefault works then use it?
            Test with dialog to see if side effects :)

            F Offline
            F Offline
            Faema
            wrote on last edited by
            #5

            @mrjj
            i see no side effects so far, i hope it doesnt change with a qt update.

            mrjjM 1 Reply Last reply
            0
            • F Faema

              @mrjj
              i see no side effects so far, i hope it doesnt change with a qt update.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Faema
              well worst case scenario with change in update
              would be - it would close dialog on first button user hits enter on :)
              But it seems to be clever enough not to do that if more than one "default".

              1 Reply Last reply
              1

              • Login

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