How to resize the Bottom Dock Area - qt

I have a Qt app with the following layout, where the bottom dock-area extends under the right dock-area. This is the default when adding Dock widgets to both side and bottom areas.
+-----------------+-----+
| | DW1 |
| CW +-----+
| | DW2 |
+-----------------+-----+
| DW3 |
+-----------------------+
I would like to instead have the right dock-area extend down to the bottom beside the bottom dock area as such:
+-----------------+-----+
| | DW1 |
| CW +-----+
| | DW2 |
+-----------------+ |
| DW3 | |
+-----------------------+
This should be simple, but I have searched the documentation and asked almighty Google, without success. I am not adding a code sample, since this is more of a general API question.

I think you can use QMainWindow::setCorner...
QMainWindow main_window;
main_window.setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
That should associate the bottom right corner with the right hand dock area -- haven't tested though.

Related

QGraphicsItem under cursor at leaving object while over another item

I have a QGraphicsScene, QGraphicsView and some QGraphicsItems subclassed.
I want to track which item is under the cursor topmost visible.
It works fine using hoverEnterEvent in most situations, but if I have two Objects where one is on top of another it does work on entering both but not on leaving the inner object (and re-entering the outer, since it never left the outer in the first place).
+-------------------------------------+
outside | |
| outer |
| |
| |
| +-------------+ | +-------------+
| | | | | |
| | | | | another |
| | inner | | | |
| | | | | |
| | | | +-------------+
| +-------------+ |
| |
| |
| |
| |
+-------------------------------------+
outside -> outer : works, outer is selected
outside -> outer -> outside -> another : works, first outside is selected, than nothing, than another
outer -> inner : works, inner is seletected
outside -> outer -> inner -> outer: does not work, first outside is selected, than inner, but than nothing (should be outer again)
What can I do, besides looping trough all graphicitems triggered via a slight delayed singleshot on hoverLeaveEvent?
Edit:
I found a temporary solution:
I added a global QList < MyQGraphicsItem *> where on MyQGraphicsItem::hoverEnterEvent I add "this", and on MyGraphicsItem::hoverLeaveEvent I remove the last item in the List. So the myGlobalQList.last() always contains the topmost item visible under the cursor.
I assume this is not the best solution since QList is not threadsafe, therefor I am still interested in other solutions.
Your QGraphicsItems live in a QGraphicsScene which can be displayed by one or more QGraphicsViews.
I know that the model-view mapping usually is 1:1.
Still I suggest to implement mouse handling like this in your view, not in the scene:
Install an eventFilter on your graphicsView->viewport().
Override the eventFilter() function in your filter class.
Watch for QEvent::MousePress, MouseMove, MouseRelease, maybe Enter and Leave, depending on what you need.
Probably you need to setMouseTracking(true) on the viewport.
Then, in the event filter function, use QGraphicsView::mapToScene() and QGraphicsScene::itemAt() to find the topmost item, or ::items() to find all items under the cursor.
I recently used this to decorate the topmost item with a border by painting over the view (QGraphicsView::drawForeground()).

Xamarin.Forms - device-independent way to make a bar at bottom slide up to cover full screen height

I'm working on a mobile app in Xamarin.Forms, with a "new messages" bar at the bottom of the screen, like this:
----------------------
| |
| |
| |
| |
| |
| |
| |
|--------------------|
| 4 New Messages ^ |
----------------------
When the user clicks on the bar at the bottom ("4 New Messages"), I want that bar to slide all the way to the top of the screen along with the list of message titles below it (that are initially hidden out of view), so that the whole messages area ("4 New Messages" title, plus the list of message title below it) should take up the full screen, like this:
----------------------
| 4 New Messages X |
|--------------------|
| - Tomorrow Night |
| - New product in...|
| - Outing cancelled |
| - Please call me |
| |
| |
| |
----------------------
I can make the whole message area an absolute layout that takes up the full screen (parentElement.Children.Add(messagesArea, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);) and make it initially mostly hidden off the screen (except for the "4 New Messages" bar) using TranslateY; and then I can use TranslateTo(0, 0) to get it to slide back up to the full screen height.
BUT that assumes I know the height of the device. What's the best way to accomplish this in a device-independent way? And should I be using a Grid layout to begin with?

Cropping an animation in a way this is compatible with column-count

This is related to Creating a peek in effect with animate.css which was answered via using overflow:hidden, but does not work with column-count:
I am using the excellent animate.css library for animations. I was wondering if its possible to create a "peek in" and "peek out" effect that is similar to the SlideIn/SlideOut but with the following difference:
slideOutRight
+-------------+ +-------------+
| | | |
| | | |
| +---------+ | +---+----+
| | anim | | | anim |
| +---------+ | +---+----+
| | | |
+-------------+ +-------------+
peekOutRight
+-------------+ +--------------+
| | | |
| | | |
| +---------+ | +----+
| | anim | | | an|
| +---------+ | +----+
| | | |
+-------------+ +--------------+
In other words, the difference is that peek does not go out of the parent object boundaries. I've tried adding clip/clip-path to the anim element but it does not look like translate3d takes that into account.
The slideInRight/OutRight code of animate.css is pretty straighforward -
It's moving X by 100% - I'd like to make sure it gets cropped as it moves out of the parent frame.
I've setup a codepen to illustrate this in action - would appreciate any advice
http://codepen.io/pliablepixels/pen/pgxqOX
The caveat is that it must work with -column-count. as you see in the codepen, the moment you use column-count, the 2nd column does not show the header
Added Clarification on why I need it to work with columns:
I need to pack the frames so that odd sized frames are not arranged by row. This codepen illustrates the issue of using flex-row vs. column-count -http://codepen.io/pliablepixels/pen/MKPLBp
If you switch to byrow you'll see images are aligned in a way that the row takes up the height of the largest image, which means if you reduce the browser width,"D" goes to row 3 instead of going under "C". Switch to column mode and it packs in better.

How to extend side dock widgets vertically even when top/bottom docks are present?

Currently if I have QDockWidgets at the top, bottom and on the sides of my QMainWindow, they are arranged like this:
_____________________
| |
|_____________________|
| | | |
| | | |
| | | |
|___|_____________|___|
| |
|_____________________|
I'd like to have one of the side docks more extended vertically, like this:
_____________________
| | |
|_________________| |
| | | |
| | | |
| | | |
|___|_____________| |
| | |
|_________________|___|
How can I do this with QDockWidget? I've tried looking at the various options in Designer, looked through all the documentation of QDockWidget and QMainWindow multiple times, but haven't found anything relevant. Do I have to create my own layout for this, or maybe subclass QMainWindow?
void QMainWindow::setCorner(Qt::Corner corner, Qt::DockWidgetArea area)
Elaborating on #Tomas's answer. Qt documentation says:
void QMainWindow::setCorner ( Qt::Corner corner, Qt::DockWidgetArea area )
Sets the given dock widget area to occupy the specified corner.
It is in fact misleading: the area won't occupy just the specified corner. Rather this corner will belong to the area, i.e. you can set multiple corners to a single area, so you'd get e.g. side area at right with bottom-right corner, or with top corner, or with both.

Creating a Static Drawing Whose dimensions get changed based on the parameters supplied

I want to create an static drawing (say any animals like giraffe) using some points, lines, drawing etc. Now i want to update the drawing by passing the parameters say height of his legs, its width or its color.
The parameters are supplied from the web page. The image will be a 2D image
I am searching on which technology should i implement this for more than 10 hours but cannot find any perfect solution.
Right now i am thinking i can use Adobe flash in which i can do some programming to create an drawing and change the drawing by passing the parameters to a Flash file, i think we can pass it when we embed an flv.
Whether i am right? Or there is any other solution. I have no knowledge of any thing except asp.net
Please help.
Any help is appreciated
I'd like to build on the previous post - you could also incorporate svg graphics into the mix. This would allow you control over color, width, and height. You can manipulate SVG files with javascript (Dynamic SVG). You'll probably get that going faster than learning action script.
If you just want to be able to stretch or recolor parts of an image, you could do that using ordinary HTML parameters. Just create a giraffe image, break it into the chunks that you want to be able to resize independently, and use CSS layout or tables to assemble them. Here's an artistic rendering:
___________________________
|image 1 V__ <<|
|head |oo | <<| <--- delicious acacia leaves
| | < <<<|
---------------------------
|image 2 | | |
|neck |o| |
| | | |
---------------------------
|image 3 / | |
|body /------/ \ |
| | \ |
---------------------------
|image 4| | | | | | | | |
|legs | | | | | | | | |
| \_/ \_/ \_/ \_/ | <--- I do not know what giraffe feet look like
---------------------------
If you want to give your giraffe a short neck without changing anything else about it, you can just alter the height attribute of the second image, like so:
___________________________
|image 1 V__ <<|
|head |oo | <<|
| | < <<<|
---------------------------
|image 2 | | |
---------------------------
|image 3 / | |
|body /------/ \ |
| | \ |
---------------------------
|image 4| | | | | | | | |
|legs | | | | | | | | |
| \_/ \_/ \_/ \_/ |
---------------------------
Obviously, changing the width of just one image would cause the boundaries to no longer match up, so you'd need to change them all to the same value.
To handle color changes, you can make use of image transparency. Each image would be white, with a transparent region representing the giraffe. Then, you'd set the background color of the div or table cell to the color you want the giraffe to appear. Again, this is clunky, but it would let you do what you want without needing anything other than static GIF / PNG images and basic HTML.

Resources