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. Is there a better way to schedule?
Qt 6.11 is out! See what's new in the release blog

Is there a better way to schedule?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 324 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I have a slot that when checkboxes are clicked sets the visibility of widgets on a form, I then get the geometry to adjust the geometry of the form, however I've found this will only work if I allow the widgets visibility to take effect which isn't instant after calling setVisible, I've now got a one shot timer triggering 20 milliseconds after calling the setVisible on the widgets and this works, but I feel its a bit hacky...is there a better way to achieve this?

    Kind Regards,
    Sy

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

      Hi
      Well there is the showEvent which is often used for such cases.
      If you already subclassed the widgets its good but if thats not an option then
      an event filter can be used to know when they are ready.

      SPlattenS 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        Well there is the showEvent which is often used for such cases.
        If you already subclassed the widgets its good but if thats not an option then
        an event filter can be used to know when they are ready.

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @mrjj , thank you, is there an example I can look at?

        Kind Regards,
        Sy

        1 Reply Last reply
        0
        • JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          add show event to your widget
          protected:
          void showEvent(QShowEvent *) override;

          when show event arrives, do your stuff. This func will be called when the widget is set visible(true).

          Sure there is hide event as well for setVisible( false ).
          protected:
          void hideEvent(QHideEvent *) override;

          This will be clean.

          1 Reply Last reply
          2

          • Login

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