How to set ctk.ctkPopupWidget auto pinned?
-
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.
However, what I want is to see the inital interface showed as the image below.
Appreciate any suggestions, thank you.
-
@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. -
@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.
-
@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.
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.
-
@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. -
@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.htmlThank you.
-
@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.