This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
We were previously relying on the DB progress hook to cause the
progress window to display.
Qt's progress dialogs do have built in support for automatically
showing, but it's easier to add a timer than change the existing
code to use it.
Instead, set the busy cursor immediately to give the user feedback,
but defer popup for at least 500ms. This will hopefully address the
white flash in night mode on Windows, and prevent progress dialogs
from rapidly appearing and disappearing for short operations.