Qt QMainWindow Control Dropshadow and its Color - c++

I was just wondering, is there any way at all to control the drop-shadow effect around an active QMainWindow? Here is a picture:
I would like to be able to control the color of that shadow, and possibly even change the size of it, too. Is there any way to do this? I am adding CSS as a tag because i'm pretty sure this might require using their skinning system.

Related

How to automatically zoom buttons and everything in Qt on qWidget.showFullScreen()?

I want to resize everything when i show it in full screen automatically keeping aspect ratio. How can i do it. i use PyQt4 but if you know of C++ then also please tell me.
Hope the code will be not more than 2-3 lines.
Thanks
I suppose you've implemented static layouts with fixed widget sizes and positions in your dialogs/windows. In order to resize the widgets with the window, what you need to do is using dynamic layouts. You best use Qt Designer for the dialog design, else setting up any non-trivial layout can get rather toilsome.

RectangularGlow with Qt 4.7 without QML

I'm working on some Qt GUI application with shiny glossy design.
I have a list view customized with my QItemDeleagte subclass. I draw items in paint virtual method. Selected items need to be drawn with glow effect on the border. Normal items must be without glow effect
That's RectangularGlow QML Type which is exactly what I need my view items border to look like. Unfortunately the app was written in Qt 4.7 and there is no way to port the app and all its dependencies to Qt 5.
QGraphicsDropShadowEffect is not sutable since shadow gradient has one direction and an offset. QLinearGradient doesn't help too or I don't know how to use it.
I consider drawing some kind of border image.
Is there any proper and elegant way to implement this using gradients or graphics effects?
EDIT:
As cmannett85 pointed out QGraphicsDropShadowEffect seems to be ok. However graphics effect may be installed on a whole paintdevice and for view item i cant just draw only selected item border rectangle with glow effect and leave other elements in a normal state. Instead all drawing on a list view affected
EDIT2:
I found a solution in an answer for another question. So I think this question may be closed

Overdrawing on the toolbar? Alternative idea?

Main aim is wanting to draw Tab's within the draw area of the Toolbar of the Applicaiton for a NoteBook or Tab's to use the above space instead of being bellow the toolbar.
The frame work we're using is WxWidgets, C++/C. I have looked around but have not been able to find a solution or if anyone has done a similar approach with drawing tab's actually inside the toolbar itself.
I read some Microsoft MSDN articles and they recommend against controls drawing over controls.
I did some test's today, and think I've come up with a solution. My solution is to draw the window like normal, but have the NoteBook on the right in a child window that is dynamically resized and repositioned so that it's tab's are overlay on-top of the toolbar to make the most effective use of the area. I would have to deal with on focus and lose focus window messages, but this is the most elegant way I can think about achieving the task.
Any Idea's you can recommend or problem's I may face with following this approach.
I would be concerned about using overlapping widgets like this. Although it may not look quite the same visually I would suggest looking at wxToolBook which puts tabs in a toolbar and would solve your problem, you could use the GetToolBar method to insert your own toolbar items.
If that wasn't close enough visually to what you are looking to achieve I would suggest deriving a new control from wxBookCtrlBase and then creating a tab control with custom drawn tabs which you could add to the toolbar using wxToolBar::AddControl.

what's the best way to display images in qt? also I would like to zoom in to particular areas as well

I've been using label to display images. I'd like to be able to click and create a bounding box then be able to drag the cursor to move around in the image. What would I need to do this? Thanks.
I'm not 100% sure I understand what you are trying to do, but I think the QGraphicsScene is what you are looking for. You can (among many other things):
Render images (QGraphicsPixmapItem, for example)
Change the zoom level when rendering the scene on a QGraphicsView.
Select things using a "rubber band"
Move items around with the mouse (see QGraphicsItem::ItemIsMovable)
etc.
You may need to get familiar with Qt's graphics view framework.

How to make a QT widget update modified properties from its parent widget?

I've got a QWidget that contains several QLineEdits. When I tell the parent QWidget to change its background color
dynamically, I'd like the children (i.e. QLineEdits) to inherit this modification.
Is there an easy (read: one function call) to do this?
If nothing pops up, I think I'll just loop through the children of the QWidget, but when doing this properly I expect to end up with a recursive function with a lot of overhead, that's why I'm asking.
EDITs in Bold face.
Generally speaking you don't need to worry about "overhead" in dialogs. Unless you're doing some sort of massive draw operation, UI applications simply don't need a lot of optimizations. Digging down to all children and changing their background is a relatively fast operation compared to the Qt system itself actually doing the change.
That said, I'd assume there is a way to get what you want but I don't know what it is. My bet is that it will do exactly what you would anyway.
How are you going about telling it to "change color" btw? Qt doesn't seem to have operations to do that. You can assign a background role or change the pallete. As to the latter:
http://doc.qt.nokia.com/4.7/qwidget.html#palette-prop
If you set the background color using a style sheet assigned to that widget and don't specify any selectors in the CSS, all child widgets will inherit any properties that apply to them.
I found it useful to use a selector that allowed me to target specific widgets for a certain style.
QWidget[objectName|="special_color"]
{
color: rgb(255, 255, 255);
}
If I used this in a style sheet assigned to a container widget, it would apply the specified color to any child widgets whose name started with "special_color" like "special_colorEditBox1" no matter how they are nested or contained.