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. How to set ctk.ctkPopupWidget auto pinned?
Forum Updated to NodeBB v4.3 + New Features

How to set ctk.ctkPopupWidget auto pinned?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 826 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.
  • J Offline
    J Offline
    joanne
    wrote on last edited by joanne
    #1

    What I did is adding a PopupWidget as a QToolButton child which is set up to be pinPopup. Now, I wish the QToolButton can be auto clicked so the PopupWidget can be seen as long as the UI is loaded.
    Which means now the inital interface is showed as the image below.

    a82cf7fa-0d8d-4ca5-b899-b61ffb0c0a82-image.png
    However, what I want is to see the inital interface showed as the image below.
    f4ffd3f6-e72e-433b-9f8d-277d7b7df325-image.png

    Appreciate any suggestions, thank you.

    M JonBJ 2 Replies Last reply
    0
    • J joanne

      What I did is adding a PopupWidget as a QToolButton child which is set up to be pinPopup. Now, I wish the QToolButton can be auto clicked so the PopupWidget can be seen as long as the UI is loaded.
      Which means now the inital interface is showed as the image below.

      a82cf7fa-0d8d-4ca5-b899-b61ffb0c0a82-image.png
      However, what I want is to see the inital interface showed as the image below.
      f4ffd3f6-e72e-433b-9f8d-277d7b7df325-image.png

      Appreciate any suggestions, thank you.

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      @joanne
      [slot] void QAbstractButton::click()
      Performs a click.
      All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.
      This function does nothing if the button is disabled.

      J 1 Reply Last reply
      2
      • M mpergand

        @joanne
        [slot] void QAbstractButton::click()
        Performs a click.
        All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.
        This function does nothing if the button is disabled.

        J Offline
        J Offline
        joanne
        wrote on last edited by
        #3

        @mpergand
        Thanks for your reply!
        However, I'm not sure how to connect QToolButton with QAbstractButton.
        I put the popupWidget under QToolButton by the code below.

        PopupWidget = ctk.ctkPopupWidget(self.ui.RtoolButton)
        ControllerLayout.insertWidget(0,self.ui.RtoolButton)
        
        rlayout = qt.QVBoxLayout(PopupWidget)
        rlayout.addWidget(self.ui.SliceDown)
        rlayout.addWidget(self.ui.SliceUp)
        rlayout.addWidget(self.ui.translateXPos)
        rlayout.addWidget(self.ui.translateXNeg)
        rlayout.addWidget(self.ui.translateYPos)
        rlayout.addWidget(self.ui.translateYNeg)
        rlayout.addWidget(self.ui.zoomInRbut)
        rlayout.addWidget(self.ui.zoomOutRbut)
        #self.ui.RtoolButton.setOn(True)
        PopupWidget.pinPopup(True)
        

        However, the point is still that I dont know how to connect QToolButton with QAbstractButton.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4

          QToolButton inherits QAbstractButton.
          To perform a click just call click() :)

          1 Reply Last reply
          1
          • J Offline
            J Offline
            joanne
            wrote on last edited by joanne
            #5

            @mpergand
            Hello, Thank you so much. I tried what you suggested.
            When I did not perform a click, the interface is shown as the image below.
            84d3e7f2-0e3e-46e2-9e20-6f30f4e34377-image.png

            However when I perform the command you suggest which is
            self.ui.RtoolButton.click()
            the UI is shown as follow however the menu under the QToolBar is not clicked to open.
            e0a8ba98-1262-45ea-ac50-9cf4b9b13558-image.png

            1 Reply Last reply
            0
            • J joanne

              What I did is adding a PopupWidget as a QToolButton child which is set up to be pinPopup. Now, I wish the QToolButton can be auto clicked so the PopupWidget can be seen as long as the UI is loaded.
              Which means now the inital interface is showed as the image below.

              a82cf7fa-0d8d-4ca5-b899-b61ffb0c0a82-image.png
              However, what I want is to see the inital interface showed as the image below.
              f4ffd3f6-e72e-433b-9f8d-277d7b7df325-image.png

              Appreciate any suggestions, thank you.

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

              @joanne said in How to set QToolButton auto clicked?:

              What I did is adding a PopupWidget as a QToolButton child which is set up to be pinPopup

              For me at least to try to help, what is this PopupWidget class? And never heard of "pinPopup"? Please show what/how you create a "popup" window/widget/whatever.

              J 1 Reply Last reply
              0
              • JonBJ JonB

                @joanne said in How to set QToolButton auto clicked?:

                What I did is adding a PopupWidget as a QToolButton child which is set up to be pinPopup

                For me at least to try to help, what is this PopupWidget class? And never heard of "pinPopup"? Please show what/how you create a "popup" window/widget/whatever.

                J Offline
                J Offline
                joanne
                wrote on last edited by
                #7

                @JonB
                Hello, I did it for a popUp menu which can stayed on the interface. However, since I use the 3D slicer platform, there is some issues so that I can only try to use this method.
                However, now I found out that my problem is not to perform a click to QToolButton but to pin the ctk.ctkPopupWidget. I still can not find the way to set the PopupWidget to be pin by default.
                Here is the information for ctk.ctkPopupWidget.
                https://itom.bitbucket.io/v3-0-0/doxygen/class_popup_widget.html

                Thank you.

                JonBJ 1 Reply Last reply
                0
                • J joanne

                  @JonB
                  Hello, I did it for a popUp menu which can stayed on the interface. However, since I use the 3D slicer platform, there is some issues so that I can only try to use this method.
                  However, now I found out that my problem is not to perform a click to QToolButton but to pin the ctk.ctkPopupWidget. I still can not find the way to set the PopupWidget to be pin by default.
                  Here is the information for ctk.ctkPopupWidget.
                  https://itom.bitbucket.io/v3-0-0/doxygen/class_popup_widget.html

                  Thank you.

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

                  @joanne
                  Then I have no idea, you need to read its documentation/follow its behaviour.

                  At a glance one would have thought pinPopup(true) would have done the job:

                  Convenient function that calls setAutoHide(!pin) and opens the popup if pin is true regardless of the value of AutoShow.

                  J 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @joanne
                    Then I have no idea, you need to read its documentation/follow its behaviour.

                    At a glance one would have thought pinPopup(true) would have done the job:

                    Convenient function that calls setAutoHide(!pin) and opens the popup if pin is true regardless of the value of AutoShow.

                    J Offline
                    J Offline
                    joanne
                    wrote on last edited by
                    #9

                    @JonB
                    Thank you so much, I'd just figure it out.

                    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