Undocumented ProcessEventsFlag enums in QT - qt

I noticed that modal dialogs on QT uses a local QEventLoop with the ProcessEventFlags set as "DialogExec"
eventLoop.exec(QEventLoop::DialogExec);
The QT assistant has no information on what this enum means. There is another one called EventLoopExec. Anyone has any idea what they actually mean and why aren't they documented?
Thanks

I did some poking around and this is what I found:
This enum is intentionally omitted from the documentation, along with several other QEventLoop::ProcessEventsFlag enum values (X11ExcludeTimers, ExcludeUserInput, WaitForMore, EventLoopExec) as there is an \omitvalue in front of each one in the comments that generate the docs.
There is only one place in all of Qt that actually uses it, in qeventdispatcher_mac.mm in which it appears to be some kind of mac-specific optimization according to the in-line comments
The intentional omission of these values from the docs leads me to conclude that they're for internal Qt use only, and that you shouldn't need to use them or worry about them.

Related

What is WaylandView?

I read https://doc.qt.io/qt-5/qml-qtwayland-compositor-waylandview.html#details but still cannot understand what is WaylandView.
I tried to see how WaylandView works, but which type cannot be found.
WaylandView is not a type
I also tried WaylandQuickItem which looks like the wrapper class of WaylandView. but cannot understand the difference, why make WaylandView registered in QML but cannot create the instance? What it is used for?
WaylandView is mostly used if you are implementing a compositor in C++. In QML it's mostly an implementation detail, and WaylandQuickItem and ShellSurfaceItem wraps and uses it internally.
If you need to do something really specific that's incompatible with ShellSurfaceItem and WaylandQuickItem it could probably be useful, but otherwise it's safe to ignore it.
The QML cocumentation could probably have been better for that type ;)

Quartz 2D substitude for graphicsPort in SDK 10.10

The scenario:
I'm editing some CGImages and strangely enough until now I was first creating NSImages from those CGImages before drawing them. So I tried to change the code so that I would draw the CGImages directly in into NSGraphicsContext.currentContext().graphicsPort. As you see I'm using Swing here but the same problem goes for Objective-C I presume.
Having a look into the documentation I saw that graphicsPort will be deprecated in 10.10, but I couldn't find another way to the current CGContext from NSGraphicsContext nor is there a way to create the CGContext from an NSGraphicsContext.
The Question:
Does anybody know what the proper way to retrieve the context would be? If not - Is there a way to cast the graphicsPort's COpaquePointer, which apparently is an initialized NSPipeObject, to a CGContextRef? Although using code that has already been marked deprecated would be quite unsatisfactory I would consider it until there is a better solution.
After spending a half hour digging around for information on this, I realized I should just check out the header file for NSGraphicsContext. Turns out there's a new property on NSGraphicsContext that's apparently not documented yet: CGContext. The header also notes that this should be used instead of graphicsPort.

GNAT GPS on the fly syntax checking and getting the best out of the IDE

I've started using GPS for coding Ada at work - does anyone have any tips for getting the best out of the IDE? or any plugins I should be aware of?
For example is there a way to enable on the fly syntax/type checking - of the sorts you get in eclipse/visual studio where errors are underlined as you go?
Also what are people's general opinions on GNAT Workbench compared to GPS?
thanks
Matt
The GPS does not have a from of background syntax checking and that is by design. The idea behind GPS is that it is the compiler who decides what code is correct and what code is not correct. It means that if you want to know if your code is correct or not you have to compile it. On a Windows computer the short cut key for that is SHIFT+F4 and will only compile the specification or body file you are currently editing. Pressing F4 will compile your whole project. You will save time by using SHIFT+F4.
Another interesting feature is that the GPS uses cross-reference (XREF) information when navigation through the code. For example, let's say you would like to find all the places in your code where a specific subprogram is called. In GPS (GNAT PRO), right click on the subprogram you are interested in a press Find references. In the GPS GNAT Libre version you don't have a menu when right clicking in your code. In this case go to the Navigate menu and click on Find references there. If the GPS does not find any references and you know that the subprogram is used in the application it means that the XREF information needs to be updated. You may compile the whole application by F4 since the XREF information will be generated along with the binary that is produced. If you go to Edit and click on Key shortcuts you can set up a short cut key to generate the XREF information only. You may also find several interesting features there that you can set up a short cut key for.
The cross-reference information (XREF) is also used for refactoring (GNAT PRO specific functionality). It often works well for changing variable and subprogram names. Just make sure the cross-reference information is up to date!
Code snippets in GPS are also useful. You use them by writing a keyword followed by CTRL+O (not zero, O as in Orwell). To see the code snippets you can choose between go to Edit and click on Aliases. You can also create your own Aliases and code snippets to become a more productive Ada Software Engineer.
Good luck!
I do not think that GPS has a form of background syntax checking like Eclipse does, at least I haven't found it.
I wrote a small sized terminal program in GPS as my first Ada program and my opinion of it is generally negative.
The browser is very confusing and it is hard to find items you are looking for.
The editor has the nasty habit of adding a column to the left and removing it dynamically based on the item under your mouse. What that does is when you are trying to select text with the mouse, your text switches right and left by one character as you move which makes precise selection a difficult thing to do
Getting in the debugger involves too many steps and it generally moves your files in the editor to the EOF position when you set breakpoints, so you will do a lot of scrolling to go back to the sections of interest.
The debugger output looks fancy with all the graphical elements but it is also cumbersome to operate.
GPS offers better help features for Ada libraries though, it's generally easier to browse the standard libraries and check them out than in Eclipse.
All in all, if Eclipse works for you, you might want to stick with it or perhaps open both on the same project and switch to GPS for things like help etc.
I had a related question out here which is on hold now (as I expect your question will soon be due to it's broad content) but I did some research and I am generally dissatisfied with what is out there in the Ada field. The language is great but it suffocates under bad tools.
One last tip: You might want to try Slick Edit as it's text editor and browsing features are quite good, although they too have flaws with Ada (for instance the beautifier).
Good luck with your venture

How can I find syntax errors in QML files?

I'm doing development for Blackberry 10 using Cascades, which includes QT and QML. I find that I sometimes make mistakes in my QML file, but they don't get picked up at compilation time. How can I check whether I've made a syntax error, or mis-named a function call, or other typical errors?
QML is a dynamic language that is evaluated at Runtime. There is no compilation step and due to the nature of javascript and the dynamic nature of the global context there is no way for it to tell if what you are writing is correct/incorrect until it is evaluated. QtCreator can help with some of the QML errors you will find, but there is unfortunately no good way to get syntax errors about your javascript until it is evaluated and it explodes.
Personally, I have found good usage of the debugger to be the key to making these sort of fixes easy.
tldr; Keep your javascript clean and to a minimum there is no compile time checking.
open terminal in IDE connect your device or emulator using blackberry-SSH after connecting enter slog2info it show syntax and all typical error JavaScript with description and line NO.
If there are any mistakes it will show those lines in RED marks. It is dynamically checks there is no need to worry about compile.
If you done wrong you will not see the DESIGN CONSOLE correctly.

Documentation of the lesser know AS3 properties

Over the past three weeks, I have lost at least 120 man hours because of some lesser known functionality in ActionScript 3. One of the problems was that, with Internet Explorer, if there are too many messages sent through LocalConnections, it will slow the messages sent through, but in the standalone player and in Firefox, this threshold is significantly higher. Another was that the static values of a class are instantiated even if the member itself is not being used:
import path.to.FooClass;
private function thisIsNeverCalledButItEnsuresThatFooClassIsImported():void
{
var f:FooClass = new FooClass();
}
Since FooClass had a static reference to a Singleton, that Singleton was instantiated so when I loaded a Module which used that Singleton, it would bind to values in an unpredictable way.
Additional cases where things behave in an unexpected way:
MovieClip.addFrameScript
flash.trace.Trace as a class
int is a faster incrementer class, Number is faster for mathematics, and uint is incredibly slow.
PrintDataGrid, if it has only one page, needs to have an empty value appended to the end of its dataProvider
If you use try...catch around two LocalConnections and connect them to the same channel, you will force garbage collection without needing System.gc
So here's the question (and I'm sorry for omitting this in the original post), is there any consolidated documentation for this type of behavior anywhere? Is there any (even non-Adobe) documentation on these issues (websites, forums, books, ANYTHING)? I know that these things are definitely easy enough TO document, but has anyone done so?
If not, am I missing anything? Are there other issues which I should know about?
This kind of useful information is very often not "centralized". Moreover, what you are looking for is something related to the experience of the programmer (more than to official docs).
FYI, there are two other methods for ensuring a class is included.
#1 - This syntax is actually used in the Flex source code:
import path.to.FooClass; FooClass; // note double reference
public class References
{
// No references needed in this class
}
#2 - Use the includes command line argument
-includes path.to.FooClass
You can always submit your experience using the "feedback" section in the help. Unfortunately, this is less obvious than the link that used to be at the bottom of each page in the older help files (which also served the useful function of opening a browser window with the web version of that help page).
Adobe says that it incorporates the comments from previous versions of the help into new versions, but my own observation suggests that there are instances where it does not happen. However, that and the appropriate cookbook are still the best avenue for those who believe that this kind of information should be centralized.
Note that the whole purpose behind modules is to avoid compiling code multiple times, so importing FooClass kind of defeated the purpose. The problems you had in this instance are just one of the many that happen if you use Singletons, and it's unfortunate that the first official Framework, Cairngorm, encouraged their widespread use. Check out http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/ .

Resources