Qt QGraphicsProxyWidget hiding other QGraphicsProxyWidgets - qt

I'm working on a Slotmachine with QGraphicsScene and -View and I'm close to the end of that project. But now I want to add a small rect to the winning-lines that shows the amount of won credits in that line. The rect is a QLabel in a QGraphicsProxyWidget. I don't know if thats the best way to solve this problem but I'm not able to find a better solution at the moment. I'm setting the proxyWidget to not visible in the constructor of the label but when I'm setting this proxyWidget to visible other proxyWidgets in the scene disappear. And I just dont understand why. It's not hiding every proxyWidgets.
As you can see on the picture there's a red rect in the middle of the first square of the winning line. This is causing the problem. It is hiding the lower white border which is a QGraphicsPixmapItem and the first of the normally three QGraphicsProxyWidgets at the bottom, stake(this is not visible), last gain(letzter Gewinn), credit(Guthaben). I don't know why its not hiding the other Widgets on the bottom because they are all equal. As you can see its not hiding the complete lower border. I just don't know why this happens and why it just happens to the lower border and the left widget on the bottom and not to any other elements. I just don't know how to fix a problem like that.
It's a bit long to read but I don't know how to really describe the problem or how I could show you in the Code. I hope someone could help me.

Solved it by using an QGraphicsTextItem. totally forgot that it is existing. Thanks to the QT Forum.

Related

Qt Designer - this file contains top level spacers

I use Vertical Spacer separation lable and button
but I get this feedback
So I find the solution, than I set mainwindow layout, but still get same feedback
How can I solve this problem, Thanks.

Rounded buttons in cocos2d-x

With the normal Button class in cocos2d-x, we can create round buttons by using images having the edges rounded off. However the hit testing still "works" on the invisible edges because there is likely just no such feature to ignore the touches that occur on the invisible parts and/or the edges. Does anyone know a fix/workaround for this?
The purpose is to not have the button be tapped if the tap is on an area within the rectangle and on a 0 opacity point.
You should definitely check this IrregularButton class made by Shuai Yuan.

QGraphicsScene too wide

I've got a problem with my layout and I can't find any solution. Below are two images. The first one is from the Qt Designer, where everything looks great (but there is no QGraphicsScene, so it's expectable). The second one is real app, where the left bottom scene is too wide. As scene rect I'm taking this->ui->juliaMandelbrot->geometry(), which means geometry of the QGraphicsView. But this returns 640x150 instead of 225x150. What am I doing wrong?
Thank you.
although I don't like it, I set maximum width of graphics view and it solved my problem.
I don't like it, because the grandparent of my graphics view has already set maximum width, so I thought, that children inherit this property :-(.

Init QListWidget to show its all content (with no scroll bars)

I was playing with the Config Dialog Example, all was fine. Then I changed something in the right part of the dialog.
Then I found the contentsWidget (QListWidget) in the left part of the dialog became smaller and showed the scroll bars (both Horizontal and Vertical).
I want the QListWidget to show all its content so that no scroll bars are needed.
All items are added at the beginning and fixed. No dynamic.
I guess there is a simply method to let the QListWidget expand to show all its content at the beginning.
Could anyone help me and tell me the magic word?
Here is the code:
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128);
contentsWidget->setSpacing(12);
//contentsWidget->setMinimumWidth(contentsWidget->sizeHintForColumn(0));
//contentsWidget->setMaximumWidth(contentsWidget->sizeHintForColumn(0));
//contentsWidget->adjustSize();
//qDebug()<<contentsWidget->sizeHintForColumn(0);
createIcons();
contentsWidget->setCurrentRow(0);
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(contentsWidget);
horizontalLayout->addWidget(pagesWidget, 1);
I tried contentsWidget->sizeHintForColumn(0), but it didn't work. It was 0. I tried some other methods but nothing worked.
I think you should try:
contentsWidget->setMinimumWidth(128);
This will ensure that no matters what, the size of contentsWidget will always be at least 128, hence large enough to contains the icons.

Flex 3 - Rounded bottom corners on a window?

I'm making a flex 3.5a/air2 application and I've made a popup window but I can't seem to get its bottom corners rounded. Setting cornerRadius seems to only affect the top corners.
There doesn't seem to be a roundedBottomCorners property like there is for panels, and adding a controlbar with a cornerRadius also has no effect.
I'm sure this is a very simple problem but would really appreciate any help as I can't find the answer on google or after searching on here!
If you can give up window header (and paint it yourself), try to make transparent window (with transparent background) and construct it from controls you need. I'm sure you can get window of any shape this way.
Ended up making the window transparent and setting showFlexChrome to false. Then using a container I was able to get rounded corners.
It didn't help my other problem which was trying to get a glow effect around the window and still being able to resize it.. for that I had to override the mouseDownHandler from the window class so I could modify the drag locations to the container canvas. What a pain!

Resources