Customize dialog shape like padlock - qt

I want to ask, how i can change the standard rectangular form of QDialog.I have got padlock as background image, but how i can make the dialog to accept this form, like on some online games starting menu.
Example image - > http://postimg.org/image/6tjxr8jqj/

There's an example of this for QT called Shaped Clock Example.
You can search for it or try this link for the 4.7 version.

Related

Qt Screenshot sharing app - How to select the area of a screen

I am trying to code an app in Qt for capturing and then sharing the screenshots. For now my application captures the screenshot, shows a preview and saves it. I am yet to do the upload part. but before that I would like to be able to select the area of the screen of which the screenshot needs to be captured.
I tried searching and I couldn't find any helpful articles or documents in Qt. So can anyone help me?
PS: The idea is to create a similar app like lightshot and several other similar tools.
Thanks in advance
There are two methods that you can use for this: -
1) Capture an image of the screen and then display that, full screen to the user, essentially allowing the user to crop the image.
2) A more commonly used method is to create a full-screen, topmost window that has no title bar and is transparent. This allows the user to drag out an area, which you can draw an outline to represent the area the user requires.
I recommend the 2nd method and creating a transparent window is simply a matter of changing the window flags, as you can see here.

Use a Rubber Band like the one displayed at Windows Desktop

Is there a class that lets me use the same rubber band used on Windows Desktop? It's something like this:
If you see closely it's when you keep the mouse pressed and drag it over the Windows Desktop to select files.
What i need to do is to display some Buttons on that Widget and then if i want to select them all with the method i shown above.
Your image/video didn't show up. EDIT: That is a very simple image... I thought it didn't show up at first.
Here is something in the direction of what you want:
http://qt-project.org/doc/qt-4.8/qrubberband.html#details

How to create custom softkeys

I would like to create an application similar to the screenshot, using the Qt Widgets framework (not QML like on the screenshot).
Unfortunately I am unable to remove the default CBA area. If I enter full-screen mode with
QApplication::setAttribute(Qt::AA_S60DontConstructApplicationPanes);
the status area on the top is also removed which is not what I need.

Qt switching between views

How do I switch between the two screens on the Qt?
For example, I have a button - static text plus a toolbar. Now I will add it to a frame and set it as a central widget. It works well for one window. What if I move it to the next window? Then I need to show some other stuff like another button, some images etc... and what if I come back to the first view again?
How do I show my old widgets back?
I'm not sure I got your problem right but, you could have different scenarios :
You could simply use groupboxes... Some widgets in groupbox1, otherWidget in groupbox2, and you display the groupbox you want to use, hiding the others...
You could use stackedWidget, which simulates "pages" of widgets stacked on top of eachothers... more informations here : http://qt.nokia.com/doc/4.6/qstackedwidget.html.
You could use other way like using tabs : http://doc.trolltech.com/4.6/qtabwidget.html
Maybe this example would be useful to you : http://qt.nokia.com/doc/4.6/dialogs-configdialog.html
Hope it helps a bit !
I'd recommend checking out Animation/States example (should be in /qt/examples/animation/states/ subdirectory of your Qt installation). It shows how to combine state machine representing application logic with presentation layer and get cool animation effects for free (of course if you don't need eye candy, you can set widgets properties without any animation).

Custom Application Icon for processing app

I've written a small Processing App which I'm planning to release soon. What's still missing is a sweet custom icon for Titlebar/Taskbar (Win) and Dock (Mac). Any suggestions how to do this?
Thx!
Meanwhile I figured it out on my own:
Obviously this works for Mac OS by replacing the sketch.icns file within the exported app, for win & liunx is done by adding this line to your setup method:
frame.setIconImage( getToolkit().getImage("sketch.ico") );
It depends if you have any artistic ability or not.
If not, then you can hire an icon designer to do one, or search the web for free icons - there are billions.
If you have a modicum of artisticness, then you could grab a free icon that is almost what you want and then tweak it. IcoFX is a great free application for doing this sort of thing.
If you think you have what it takes to draw an icon from scratch, then a good plan is to use a vector art package. This allows you to export the same graphic at multiple resolutions so you can get top quality at every icons size you need (from 16x16 to 256x256). Alternatively, draw a large (512x512) verison in a bitmap editor and then downscale it as required. As long as you start big and downscale, you shouldn't have any problems (although to get a good icon at 16x16 and 32x32 you will still need a good eye and a lot of manual tweaking).
In your code, just type this line:
frame.setIconImage( getToolkit().getImage("sketch.ico") );
For Windows/Linux, this will do it. For Mac/OSX, follow these steps:
Find your sketch in Finder
Right click > info, or CmdI
Find your icon and open it in Preview
In Preview, click on your icon and press CmdA or right click > select all
In Preview, press CmdC, or right click > copy
Go back to Finder. Click on the current icon of your sketch. You'll know you've selected it when a blue outline appears. Press CmdV, or right click > paste
Tips:
The standard icon size is 512x512
When making your icon, make sure that your transparencies are working

Resources