Qt - QTreeView starts behaving strangely over time of running the application - c++

I have a weird problem.
After the application starts, everything works normally.
However after some time, QTreeViews in my application start behaving weird. The selection is no longer system-blue. Instead, it looks like
click to see pictures 1), 2), 3)
I.e, there's a slight dim over the icon and dotted lines to the left and to the right, as on picture 1). The "expand" triangle in Windows 8.1 turns into a +/- button, as on picture 2). And when i hover mouse over this expand button, I am getting an empty white square instead of a "highlighted expansion triangle", as on picture 3).
Normally, the selection and the expansion triangle should look like this (which it does after the application start) as shown on picture 1) below
click to see pictures 1), 2)
And the mouse hovered expansion triangle should look like on picture 2) (which it does after app start).
The application is launched with administrator privileges on Windows 8.1.
Interestingly the QtCreator 4.0.0 for Qt 5.6.0 (which I am using) sometimes starts having the same problem in its file tree view (where the project files are listed). I run it with administrator privileges as well (because I need to debug my app that requires admin privileges).
What can be causing this?

I think this is a known bug and that it is fixed in Qt5.6.1 release. See here for details of the bug - it looks like what you are seeing (or very similar).
So try to updating to Qt5.6.1 and see if this resolves it.

Related

GTK3: version 3.20 to 3.22 update issues (with window decoration)

I recently updated the GTK3 lib I am using, both on windows and linux,
from version 3.20 to 3.22, and I noticed some bugs in my application (GTK3 + OpenGL using the GtkGLArea widget) appearing after the update.
The bug, namely the disappearance of window decoration appears after a precise, yet simple, succession of events:
1) screen shot before the bug:
2) Exporting an image from this window (using a framebuffer for off-screen rendering)
3) After saving, going back to the main window by closing the dialog box, note that the upper menu bar now appears like if de-activated (grey) but sill works:
4) ... and when re-sizing / hiding / showing again 'ie. configuring' the window the decoration disappear:
5) The menu bar still seems to be there and works fine:
Obviously I looked carefully to the code after the saving action, but what happens remain elusive to me and I do not know what to look for.
The program does not stop and keeps working fine.
There was absolutely no problem with GTK3 3.20, and the bug appears both on windows and Linux.
What can I do to correct this situation ?
In the Gtk-3 series there have been many changes to the CSS system. If you are not using the default Adwaita theme, then probably you have to search for an updated version of the theme you do have installed. It might even be possible that the Adwaita theme wasn't update correctly during your upgrade.
Anyway, nearly all appearance problems are due to changes in the CSS system - Gtk doesn't really occupy itself with the aesthetics anymore.

qt form fullscreen sometimes goes over the ubuntu top pane and sometimes not

I am writing an QT application that embeds Mplayer on Ubuntu unity. I want to project videos on a projector in a dance show. I therefore have created a second form, which I move to the second screen and make it fullscreen.
Here is how I did it:
void MainWindow::on_testdialog()
{
QScreen *secondscreen = QApplication::screens()[1];
outputform->move(secondscreen->geometry().x(),secondscreen->geometry().y());
outputform->resize(secondscreen->geometry().width(),secondscreen->geometry().height());
outputform->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
outputform->setWindowState(Qt::WindowFullScreen);
outputform->show();
}
Then I redirect the Mplayer output to this form.
This works, however sometimes the second form is true fullscreen and sits on top of the Ubuntu unity menu pane (the one on top) and sometimes the Ubuntu unity menu pane is on top.
It seems to me that it is randomly doing this.
I would like my form to be always on top, because I don't want the menu pane to show up on stage.
Is there a way to do this?
Is there a reason for this, seamingly, random behavior? maybe a bug in Ubuntu?
Kind regards,
Bart.
This sounds like a problem of the window manager which makes it out of reach for Qt to solve. Qt is only setting the corresponding WM hints on the window and hopes for the window manager to do the right thing.
For your application I suggest you install a lightweight window manager like Openbox or Fluxbox that will more likely stay out of the way. After installation you can choose it in the login screen.

Change selection in explorer window?

I have a "Show in folder" button which executes the following:
explorer.exe /select,"C:\dir\somefile.txt"
In Win7 this works great, a new window is always opened, but in XP, if "C:\dir" is already open, this window is reused but the selection is not changed to "somefile.txt".
This is not the expected behaviour from the point of view of the user, he expects to see "somefile.txt", but instead sees another file, and that might confuse him. At worst, he might assume that something went wrong and the file was not created.
So I need to somehow force Explorer in XP to always select the file I give it in the cmd line, or not to reuse the window.
Can anyone suggest a way to do this (different cmd parameters, maybe COM automation)?
As I don't have Windows 7, I can't confirm if this works the way you expect on subsequent Windows versions. But on my XP machine:
explorer.exe /e,/select,"C:\dir\somefile.txt"
Works exactly the way I think you'd want by opening a new explorer window each time with the right selection and avoids that confusing behavior you described.

Silverlight printing on a Mac (non-letter format)

I have having a bit of a problem that may be an issue with my code or it might be an issue with the client not realizing something he needs to do. I am developing a Silverlight5 app that prints and is used by both Windows machines and Mac Machines. The problem is that our printouts will not be on the standard letter (8.5" x 11") paper size. On Windows I get a print dialog that let's me set up the size and orientation (Landscape/Portrait) of the document I have loaded. The client gets a dialog, but that dialog does not let him specify landscape orientation (it's a different dialog than his normal Safari dialog).
So the question is there something I need to do in my code to enable Landscape printing on a Mac OR is my client missing something in the Mac print dialog for Silverlight?
Ok, here's the specific answer that I have turned up.
Direct Landscape printing is not possible. You have to turn your printed visual manually (well, with code).
I wrote a blog post on this here -- http://www.jaykimble.net/forced-landscape-printing-in-silverlight-on-a-mac.aspx

Simulating mouse clicks on Mac OS X does not work for some applications

I'm writing an application for Mac OS X 10.6 and later in C++. One part of the application needs to simulate mouse movement and mouse clicks. I do this currently by posting CGEvent objects using CGEventPost(kCGHIDEventTap, event);.
This works, for the most part - I can simulate mouse movement and clicks just fine, but it seems to fail in some areas. For example:
In Mozilla Firefox and Safari, I can click on all the menus, but cannot click on a link within a website. When I try, the link is highlighted, but the browser never follows the link. However, I can right-click on a link, select "open link in new tab", and everything works as expected. Solved - creating the mouse event using CGEventCreateMouseEvent(...) makes the event work within web browser.
I can click on the "Dashboard" icon to brink up the dashboard, but I cannot click on the "i" button on any of the dashboard widgets. Similarly, clicking on any of the search results from the spotlight search widget doesn't work either.
This inconsistency is along application boundaries. What might be the cause?
What you need to do to convince these applications that you have in fact generated a click is to explicitly set the value of the "click state" field on the mouse up event to 1 (it defaults to 0). The following code will do it:
CGEventSetIntegerValueField(event, kCGMouseEventClickState, 1);
It also has to be set to 1 for the mouse down, but by using CGEventCreateMouseEvent() rather than CGEventCreate() that gets done for you.
I have tested this and it works in the 'i' buttons in the dashboard and the Spotlight search results.
(As an aside, if you were simulating a double click you would need to set the click state to 2 for both the mouse down and mouse up events of the second click.)
Most menus are activated with the mouseDown event. Hyperlinks are followed after the mouseUp event. The "i" button only works when the mouse has been clicked but not a long time.
All this seem to show that you have a timing problem, try several pressed timing.
Use OSXVnc. I see they use CGPostMouseEvent() instead of CGPostEvent().
I have written how to do it in the blog post Python Mouse Click and Move Mouse on Apple Mac OS X Snow Leopard 10.6.x.