First Drag-Drop operation in PyQt application is very slow - performance

I have a very basic PyQt application (Qt 4.8) that allows me to drag an item from a QListWidget to another QListWidget. The GUI was developed in Qt Designer for convenience. The problem I'm seeing is when I try to drag an item for the first time, it seems to take 5 to 10 seconds for the application to recognize that I'm trying to drag something.
For subsequent drag events, the drag happens pretty much instantaneously.
I have experimented with other widgets (QTreeWidget, QTableWidget etc.) and they all show the same type of initial delay.
I have changed QApplication.startDragDistance and QApplication.startDragTime but it hasn't had any sort of beneficial effect.
Has anyone seen this before? Any idea how to fix it?
Thanks.

Related

"Auto Layout before OS X 10.7"

I have an app in the app store, FractalWorks, which is based on a very old code-base. It's a big app, with quite a few screens. It was created in Objective-C before auto-synthesized properties were a thing, to give you an idea of how long ago it was created.
I wrote the app when I had a full-time gig as an independent software developer. I've since taken a day job, and support my apps in my spare time.
It still sells fairly well, and I recently used to add a section to the Wikipedia article on the Mandelbrot set on 3D images: https://en.wikipedia.org/wiki/Mandelbrot_set#3D_images_of_Mandelbrot_and_Julia_sets
I'm fluent in Auto-Layout now, but haven't taken the time to update the app's XIB files from "struts and springs" style to Auto-Layout - nor do I want to invest the time to do so if I can possibly help it.
I want to add a minor enhancement to the app that involves adding some UI elements and making one of the windows slightly taller. The minute I try to use Interface Builder to edit my XIB, it apparently silently changes it to Auto-Layout, and then complains about "Auto Layout before OS X 10.7". (It was released to the app store for OS X version 10.4, if memory serves, and I've moved the OS version up to the lowest version I could get away with in order to support legacy customers. It currently supports ≥10.6. The original, pre app-store version used even older OS versions.)
Googling this error suggests I use the file inspector on my XIB file to un-check a "Use AutoLayout" checkbox, but I don't see any such checkbox.
What am I missing?
If I use Xcode's code review button to compare the XIB file before and after editing it, various "tool version" values are changed, as well as it gaining a setting useAutolayout="YES". Editing that to read useAutolayout="NO" does not solve the problem.
All the credit goes to matt and his comment.
1. In the Navigator (left panel) go to issue navigator and click on the error.
2. In the Inspectors panel (right panel) the Size inspector will be automatically selected. Switch Layout from Automatic to Translates Mask Into Constraints.
Update: It's called Autoresizing Mask now.
3. Repeat for every occurrence of this error.
You may end up with an error not in the Illegal Configuration group like the following which opens the All Messages view in the middle and doesn't open the Size inspector.
This is a compile time error, just build/run your app again.
And also from the previously mentioned comment:
Be careful not to make any constraints, as that will cause an incoherent situation.
If you have multiple auto layout errors, which in all likelihood you will have, select all the controls in a window and perform the operation once rather than for each individual control. Repeat for each window.

customKeyboard in Swift is very slow to load when called into an application

I've create an iOS 8 custom Keyboard in Swift language and it's doing what I ask it to do, but when i click on a TextField into an App to write the keyboard take a lot to load (2/3 second from when I tap to when it shows) and it's a very annoying problem. How can I solve this?
I also want to ask you: How can I show the accent windows near the button which it refers to when I do a long press on that UIButton? Is there something which can do it propgrammatically (not adding one view per view inside my xib file and hide/not ride them)?
Thank you very much for your help!

How do I anchor controls to one side in Xcode?

Ok, so I come from programming in Visual Basic on PCs, and now I'm trying to remake my programs on OS X with Xcode, and so far I have been successful. One thing I have noticed, however, is that when I try to resize the window, controls either stay in the same place or stick to one side. In Visual Basic, I used the "anchor" or "dock" properties to decide whether controls would stretch as the window resized or if the stayed to one side. I was just wondering if there is an easy way to do this in Interface Builder. I am using Xcode 4.5.1 and any help I could get would be great.
Thanks in advance!
In IB, click on the file inspector (The first icon), then make sure auto layout is not checked. Then go to the size inspector (The 5th icon) and make your changes.
(source: fredandrandall.com)

Minimize-in-place - Do I need a custom framework

I want to create a system wide minimize-in-place feature that occurs when double-clicking the title bar of any visible window in layer 0.
It seems that this would be a really simple feature to re-implement... When a title-bar is double-clicked, just draw the title bar only. That's it. The problem is implimenting it in all applications. I think it requires writting a custom framework to override the behavior in AppKit? Maybe NSApplication, NSWindow or NSView?
How can I recreate minimize-in-place?
Is a framework my only choice? If I create a framework, can I replace the behavior of minimize in 3rd party apps?
Which framework do I need to override in order to intercept and recreate the default behavior of the minimize button?
More about minimize-in-place:
I am familiar with WindowShade by Unsanity, this is exactly what I want to create. Supposedly unsanity is working on a Lion version, but their track record is bismal. Minimize-in-place was a system feature way back in the days of OS 7 or 8. I have tried other utilities that try to replace this feature, and there aren't any that do minimize-in-place at a core system level like it needs to be done. Please don't offer utitlity suggestions, I am going to build my own.
I have built an Application that recreates minimize-in-place, but it's not good enough.
My Application semi-successfully recreates minimize-in-place by putting "placeholder" windows (belonging to my app) in place of the 3rd party windows when they get minimized to dock. When my window (title bar only) gets double-clicked, I close my window and restore the real window from the dock.
My custom app works perfectly, but there is a lot of application switching going on. I have optimized the switching between apps to be nearly seamless, but the fact remains that there is application switching going on every time a window title bar is double-clicked. The result of application switching is that menu bars switch back and forth, pallets of 3rd party apps hide themselves when my app takes focus, and the list goes on.
So, although I've built a concept app, this method isn't going to work as I'd like it to. Minimize-in-place needs to be implemented using some other method than building an Application, and I need help understanding how to do it.
What I know think I need to do. Suggestions and assistance welcome.
I think I need to write a custom framework that replaces AppKit? This seems overwhelming even though I only need a super-tiny portion of the code to be overridden? i.e. the core _minimize function whatever that may be.
When a title-bar of 3rd party window is double-clicked, just clip to the title bar and let the rest of the system function as normal. On un-minimize (double click 2nd time), set clip back to full window.
Simple right?
Thanks for any assistance/suggestions,
Chris

Moving graphical components with the mouse in Visual Studio

I have just installed Visual Studio.NET. In the Design area I have added some graphical components (button, textbox) but I can't move these within the specified area, as their position remains unchanged. I would like to move these graphical components with the mouse cursor, I know it's possible, does anyone know how?
It sounds like you have created a WPF project. WPF works a lot differently than WinForms which you are probably used to. So try creating a WinForms project, or get yourself acquainted with WPF.
I came here looking for the answer to the same question. OP is probably no longer interested and it was quite easy to Google it up, but in case somebody comes here as I did, here is the solution:
In WPF, place a Grid component on your form (or in your container, like Tab), and reset it (set both Height and Width to auto). Then you can place other controls and position them with your mouse normally.

Resources