So, from looking around a bit what I think I've found is: basically controlling z-order manually is limited to the following objects (QGraphicsEllipseItem, QGraphicsLineItem, QGraphicsPathItem, QGraphicsPixmapItem, QGraphicsPolygonItem, QGraphicsRectItem, QGraphicsSimpleTextItem, QGraphicsTextItem) with the setZOrder() function. Everything else seems to have to be moved via the raise() and lower() functions built into QWidgets and the like?
If my understanding of those things is right, proper z-ordering for labels would involve like, doing raise to each label in the order you want them to show up or something silly like that?
Messing with userwindows
Re: Messing with userwindows
The only way to z-order labels at the moment is to create them in the order you'd like them to be in - there's no way to change it after that.
Re: Messing with userwindows
Well, if I'm not misunderstanding things, a label in Mudlet is a QLabel, which inherits QFrame, which inherits QWidget, which means it should have access to QWidget's functions which include:
raise()
lower()
stackUnder()
It'd be a little weird trying to build a proper z-order system with nothing but those, but it seems like it'd certainly be possible. At the very least, you could use it to force a label above the others when you use show() or something on it. I might try adding in raise() tonight or tomorrow to see if it functions like I'm hoping.
Edit: So yeah, raise() is working. Basically just copied the code from TConsole's showWindow() and replaced "show()" with "raise()" and got this test working: https://vimeo.com/189410946
Here are the different chunks that make it work: http://hastebin.com/pihajijahu.php
Also, it looks like TLuaInterpreter is using the showWindow function from TConsole.cpp/.h instead of mudlet.cpp/.h, and even using a find function through all the source files, I can't find a reference to the mudlet.cpp/.h one anywhere. Probably safe to remove at this point?
raise()
lower()
stackUnder()
It'd be a little weird trying to build a proper z-order system with nothing but those, but it seems like it'd certainly be possible. At the very least, you could use it to force a label above the others when you use show() or something on it. I might try adding in raise() tonight or tomorrow to see if it functions like I'm hoping.
Edit: So yeah, raise() is working. Basically just copied the code from TConsole's showWindow() and replaced "show()" with "raise()" and got this test working: https://vimeo.com/189410946
Here are the different chunks that make it work: http://hastebin.com/pihajijahu.php
Also, it looks like TLuaInterpreter is using the showWindow function from TConsole.cpp/.h instead of mudlet.cpp/.h, and even using a find function through all the source files, I can't find a reference to the mudlet.cpp/.h one anywhere. Probably safe to remove at this point?
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Messing with userwindows
@dicene I suggest that to make code contributions you could get yourself signed up onto GitHub, fork the Mudlet repositories and checkout the development branch locally, make your modifications, push them out to your repository and then raise a Pull Request on the Mudlet repository...
Does look interesting... and if you are not sure about the usage comment out the block of code you think is redundant - if the code afterwards fails to link at the end of compilation with a reference not found then you have found that the code was used after all! Mind you the Qt IDE "Qt Creator" has some good search tools where it can find things across the whole project once you open the qmake ./src/src.pro "project" file...
You might want to modernise the TLuaInterpreter functions - take a look at those that use the word "NULL" as part of an error message about having a null-pointer value for a "Host" pointer - those are the ones that I've cleaned up - and note that under the hood <del>we</del>I'm now trying to use QStrings which <del>we</del> will be converted to/from UTF-8 from the Lua system that the user accesses (the code you currently have will fail with non ASCII label names...)
Edited slightly!
Does look interesting... and if you are not sure about the usage comment out the block of code you think is redundant - if the code afterwards fails to link at the end of compilation with a reference not found then you have found that the code was used after all! Mind you the Qt IDE "Qt Creator" has some good search tools where it can find things across the whole project once you open the qmake ./src/src.pro "project" file...
You might want to modernise the TLuaInterpreter functions - take a look at those that use the word "NULL" as part of an error message about having a null-pointer value for a "Host" pointer - those are the ones that I've cleaned up - and note that under the hood <del>we</del>I'm now trying to use QStrings which <del>we</del> will be converted to/from UTF-8 from the Lua system that the user accesses (the code you currently have will fail with non ASCII label names...)
Edited slightly!
Re: Messing with userwindows
@SlySven Yeah. I've put it off long enough. Gonna make it a project this weekend to transition from using an old custom copy of Mudlet's source locally to actually utilizing git properly.
-
- Posts: 1
- Joined: Wed Feb 22, 2017 11:09 pm
Re: Messing with userwindows
Can you guys give a basic idea how to use these? I am on Mudlet 3.0 iota and I am getting "nil"errors and a few other problems along the way :/
I really would like to use this!!! Thanks guys!
I really would like to use this!!! Thanks guys!
Re: Messing with userwindows
It's not in a Mudlet release yet, this is R&D stuff.