The third-party tracker for Roblox API things has it written up here: https://robloxapi.github.io/ref/class/Plugin.html#member-CreateQWidgetPluginGui
I am exploring, and I encountered CreateQWidgetPluginGui
. A function used by Built-In Plugins.
It is in the RobloxScriptSecurity
though, but I learned good reasons why, and I believe that eventually it will change one day, as it isn’t completely finished.
But there’s CreateDockWidgetPluginGui
I haven’t found space in the creator-docs, and exploring these Options was fun so I’d just put them in this Resource post.
Here is a comparison to the Widgets. Left one is from CreateDockWidgetPluginGui. And the right one is from CreateQWidgetPluginGui
.
DockWidget | QWidget |
---|---|
How it works
Code
local plugin = plugin :: Plugin
function WidgetTest(_id)
local widget = plugin:CreateQWidgetPluginGui(_id, {
Id = _id;
Size = Vector2.new(300, 300);
Modal = false;
InitialEnabled = true,
})
widget:BindToClose(function()
print("Hello")
widget.Enabled = false
end)
script.TextLabel:Clone().Parent = widget
end
WidgetTest("Test1")
The point of this thread, is to collect pluginGuiOptions
which is the second argument of the CreateQWidgetPluginGui
function. But I noticed there weren’t many options.
There’s a few references, so I started to check. [FLog::StudioPluginRelay]
and PluginDockWidgetRelay
were useful for this. But they didn’t point out to many Options.
Known “pluginGuiOptions” and Properties
CreateWidgetImmediately
Unsure if this exists. Shouldn’t be used probably.
Id
Unsure, if this does anything, as that’s already provided in the first function argument.
InitialEnabled
Whether the Widget shows up right after the execution of the function.
Size
Vector2
Size of the dialog. Changing this value between renders will resize the currently existing QWidgetPluginGui
MinSize
Vector2
Minimum constraints for resizing.
Modal
boolean
Whether the dialog stays on top of Studio and blocks input to the application
Resizable
A boolean
which determines whether you can resize the Widget or not.
Image of quickly resizing it, and capturing a screenshot.
Popup
boolean
- ActionId - String
- SelfAnchorPoint - Vector2
- TargetAnchorPoint - Vector2
Properties
Not all are listed
Title
string
Changes the Title at the top.
Enabled
If false
the Widget is closed. But eventually still exists.
Methods
Only essential ones.
BindToClose
Similar to all the other BindToClose. Except that this one has currently an issue.
You need to use QWidgetPluginGui.Enabled = false
or the Widget will not close and you will be stuck. That’s a reason why it’s RobloxScriptSecurity.
Discovered pluginGuiOptions
These are more options discovered through logs and other stuff.
Panel
boolean
If true
creates a Widget without movable windows.
PopupTarget
Needs to be a PluginToolbarButton.
The Widget cannot be Enabled
before the PluginToolbarButton was initialized, or issues will occur.
Attempted to create Popup QWidget with an invalid target. Popup targets must be PluginToolbarButtons for now.
If used :BindToClose
must include QWidgetPluginGui.Enabled = false
and QWidgetPluginGui:Destroy()
or Studio will crash.
GrabsMouse
Unsure. But there’s a thingy, which seems to be able to tell whether it can capture Mouse stuff.
https://doc.qt.io/qt-6/qwidget.html#grabMouse
AddToParentLayout
boolean
Unsure.
Others
I thought that there was more, but there wasn’t.
- A plugin, can only re-use the same ID once per Plugin.
- Using Title in the Options, doesn’t change the Title, because the Title is a Property. Very important to note.
DockWidget and QWidget differences
DockWidget is custom and officially given to PluginSecurity and QWidgetPluginGui is a hook to Qt and cannot be used.
Both work the same way, you Parent things to it, just like ScreenGui.
CreateQWidgetPluginGui is not ready and has issues like, :BindToClose
not binding, but overwriting the “Close” behavior.
-
The
Size
property could get used to make the Widget too big to even close it. Combining this withModal
prevents input back into Studio. -
Panels can cover the UI of Studio, and you wouldn’t even be able to move them. But you could add custom logic, eventually. Giving you the ability to create your own Widgets, just not dockable.
-
PopupTarget can crash Studio if targeted onto a non-existing button. It also breaks when you re-click the button or Right Click, before the Popup goes
Enabled = false
. Therefore, see above to prevent that.
It would be interesting to be able to convert DockWidget into QWidget and vice-versa.
If I find anything new I’d update this Resource.