Page 3 of 3
Re: Messing with userwindows
Posted: Sat Oct 29, 2016 12:00 am
by dicene
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?
Re: Messing with userwindows
Posted: Sat Oct 29, 2016 3:28 am
by Vadi
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
Posted: Sat Oct 29, 2016 4:25 am
by dicene
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?
Re: Messing with userwindows
Posted: Sat Oct 29, 2016 5:24 am
by SlySven
@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!
![Smile :)](./images/smilies/icon_e_smile.gif)
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 try
ing to use QStrings which <del>we</del>
will be convert
ed 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
Posted: Sat Oct 29, 2016 7:08 am
by dicene
@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.
Re: Messing with userwindows
Posted: Wed Feb 22, 2017 11:13 pm
by etermini1988
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!
Re: Messing with userwindows
Posted: Sun Feb 26, 2017 6:32 am
by Vadi
It's not in a Mudlet release yet, this is R&D stuff.