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. Unintuitive behavior when trying to use QPushButtons default feature
Forum Updated to NodeBB v4.3 + New Features

Unintuitive behavior when trying to use QPushButtons default feature

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpushbutton
2 Posts 2 Posters 783 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.
  • J Offline
    J Offline
    Justin Sayne
    wrote on 1 Nov 2016, 19:04 last edited by
    #1

    I have designed a custom QWidget with some QPushButtons on it which I'm using as sort of a dialog window, so I'd like to be able to let the user enter things and then hit enter to click what I define as the default button. It doesn't work however and I can reproduce some pretty weird and counter-intuitive behavior in QtDesigner alone:

    I created an empty widget, pulled over a QPushButton and connected its clicked signal to the widget's close slot. Previewing the widget, everything works fine and as expected. I can also add a second button, everything still works fine. If I now put a layout on the widget, the default feature won't work anymore, meaning I can't hit enter to close the widget anymore. If I now remove the 2nd button but keep the default button in the widget layout, it goes back to working again. Wtf

    Summary:

    • no layout, 1 default button: works
    • no layout, 2 buttons (exactly 1 default button): works
    • any layout, 1 default button: works
    • any layout, multiple buttons (exactly 1 default): doesn't work

    Can anyone else reproduce this or - even better - tell me what's going on?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 1 Nov 2016, 19:34 last edited by
      #2

      Hi! This works only with widgets that inherit from QDialog.

      1 Reply Last reply
      1

      1/2

      1 Nov 2016, 19:04

      • Login

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