Compare commits
2 Commits
87c11a384a
...
56f21299f0
Author | SHA1 | Date |
---|---|---|
|
56f21299f0 | |
|
6419045f0e |
|
@ -5,12 +5,17 @@ import org.wangwenx190.FramelessHelper
|
|||
Window {
|
||||
id:window
|
||||
minimumWidth: title_bar.minimumWidth
|
||||
enum Status {
|
||||
Stardard,
|
||||
SingleTask,
|
||||
SingleInstance
|
||||
}
|
||||
default property alias content: container.data
|
||||
property int windowStatus: RibbonWindow.Status.Stardard
|
||||
property alias window_items: window_items
|
||||
property alias title_bar: titleBar
|
||||
property alias popup: pop
|
||||
property bool comfirmed_quit: false
|
||||
property var sub_windows: ({})
|
||||
visible: false
|
||||
color: {
|
||||
if (FramelessHelper.blurBehindWindowEnabled) {
|
||||
|
@ -114,29 +119,46 @@ Window {
|
|||
}
|
||||
|
||||
function show_window(window_url, args){
|
||||
if (sub_windows.hasOwnProperty(window_url))
|
||||
let sub_windows = RibbonUI.windowsSet
|
||||
if (sub_windows.hasOwnProperty(window_url)&&sub_windows[window_url]['windowStatus'] !== RibbonWindow.Status.Stardard)
|
||||
{
|
||||
if (args && Object.keys(args).length)
|
||||
if (sub_windows[window_url]['windowStatus'] === RibbonWindow.Status.SingleInstance)
|
||||
{
|
||||
for (let arg in args){
|
||||
sub_windows[window_url][arg] = args[arg]
|
||||
if (args && Object.keys(args).length)
|
||||
{
|
||||
for (let arg in args){
|
||||
sub_windows[window_url][arg] = args[arg]
|
||||
}
|
||||
}
|
||||
if (!sub_windows[window_url].visible)
|
||||
{
|
||||
sub_windows[window_url].show()
|
||||
}
|
||||
sub_windows[window_url].raise()
|
||||
sub_windows[window_url].requestActivate()
|
||||
RibbonUI.windowsSet = sub_windows
|
||||
return
|
||||
}
|
||||
if (!sub_windows[window_url].visible)
|
||||
else
|
||||
{
|
||||
sub_windows[window_url].show()
|
||||
sub_windows[window_url].close()
|
||||
}
|
||||
sub_windows[window_url].raise()
|
||||
sub_windows[window_url].requestActivate()
|
||||
return
|
||||
}
|
||||
var component = Qt.createComponent(window_url, Component.PreferSynchronous, undefined);
|
||||
if (component.status === Component.Ready) {
|
||||
var window = component.createObject(undefined, args);
|
||||
var window = component.createObject(undefined, args)
|
||||
if (!(window instanceof Window))
|
||||
{
|
||||
console.error("RibbonWindow: Error loading Window: Instance is not Window.")
|
||||
return
|
||||
}
|
||||
sub_windows[window_url] = window
|
||||
RibbonUI.windowsSet = sub_windows
|
||||
window.onClosing.connect(function() {
|
||||
window.destroy()
|
||||
let sub_windows = RibbonUI.windowsSet
|
||||
delete sub_windows[window_url]
|
||||
RibbonUI.windowsSet = sub_windows
|
||||
});
|
||||
window.raise()
|
||||
window.requestActivate()
|
||||
|
|
|
@ -16,6 +16,7 @@ class RibbonUI : public QQuickItem
|
|||
Q_PROPERTY_R(QString, version)
|
||||
Q_PROPERTY_R(int, qt_version)
|
||||
Q_PROPERTY_R(int, is_win11)
|
||||
Q_PROPERTY_RW(QVariantMap, windowsSet)
|
||||
public:
|
||||
static RibbonUI* instance();
|
||||
static RibbonUI* create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return instance();}
|
||||
|
|
Loading…
Reference in New Issue