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