The proper way would not be to check the objectName, which can change at any time, but rather to check if the widget is an instance of QMainWindow. Take advantage of what Qt makes available by using a foreach.
Provided how much you can do with Qt Widgets, or Qt in general, it’s no surprise that such “specialized” function is not present (the QApplication::activeWindow() does not make it, as the window might not be active).
QWidgetList widgets = qApp->topLevelWidgets();
for (QWidgetList::iterator i = widgets.begin(); i != widgets.end(); ++i)
if ((*i)->objectName() == "MainWindow")
return (QMainWindow*) (*i);
If, for whatever reason, you changed the “objectName” property of the main window, update the above if with this name.
This post is more of a mocking than serious advice, provided that a) STL includes <fstream> header with std::ifstream and std::ofstream classes, that do the same without any additional effort, and b) mixing templates and libC is just plain weird in my book. Continue reading →
OpenVPN’s installer allows for command-line based (silent) installation, but this feature is not actually documented explicitly anywhere. Here’s all I could find – hope this list will help someone in the same situation I was in.
I really like FireFox 13+, it’s converging more and more towards Chrome(ium), with some neat details that will get into future versions of Chrome(ium).
Yet, there are two things I don’t like (just as I didn’t like them in Chrome) – the “new tab page” (“most visited”) and “smooth scrolling”.
“Smooth scroll” has been round for some time, but off by default. Now it’s on.
To get rid of both:
Open a new tab.
Type in about:config as URL. This will open FireFox’s geeky configuration. Accept responsibility for editing this stuff when opening for the first time.
Type newtabpage under “Search”, and double-click the “browser.newtabpage.enabled“; it will turn bold and it’s value (on the far right) will change to “false“. This will disable the “new tab page” – you can immediately check this by opening a new tab – it should be again charmingly empty.
Type smooth under “Search”, and double-click the “general.smoothScroll“; this will disable the smooth scrolling. Again, you can immediately check it out.
There are literally hundreds of settings under about:config that can change all of FireFox’s behaviour, up to breaking it inadvertently. Feel free to click around! 😉
Final rant – what the hell is going on with the version numbers? There are no more v4.5, or v4.5.2… FireFox and Chrome just switched to single digit versioning… AFAIC, they can call it “whatever is current version”, or just vInfinity…
IMO, it lowers the meaning of versioning per se – there is a reason for the minor (and subminor, …) versions – it means it’s essentially the same thing, with some improvements.
E.g. Chrome’s v16 – “multiple profiles on by default” is the major change… Or “style editor” in FireFox v11… that’s like saying that “cup holder made of aluminium instead of plastic” makes it a new model of a car!
I’m not a big fan of FB (don’t even have an account), but needed this to be set…
They hid it quite well, both in settings, and in the help section, under a cryptic name “public search” (which makes sense once you know it, but until then…).
So, to make you profile visible even to people who do not have FB account and/or are not logged in, go to Edit Profile, and then Privacy Settings > Apps and Websites > Public search > Enable public search.