1 Attachment(s)
Design buttons with custom shapes
Hello everyone!
I am trying to desing a sequence of custom buttons with arrow shape but I could not find the way. I need something like the buttons that you can see in the next picture in order to manage the workflow of my program and guide the user through it.
Attachment 11119
Any help or suggestion is welcome.
Thanks for your help.
Re: Design buttons with custom shapes
Do you want Buttons or Progress Indicators?
Re: Design buttons with custom shapes
Hello Santosh Reddy.
I want buttons. The main idea is that each button will launch a wizard dialog to perform each step. Then, when this step is finished the next button will be enabled. So the buttons should change its color and being enabled sequentially guiding the user throught the workflow.
Thanks
Re: Design buttons with custom shapes
My approach would be to do this as a custom widget.
Either direct painting or with a graphicsview and arrow shaped items.
Cheers,
_
4 Attachment(s)
Re: Design buttons with custom shapes
Here is one approach using QPushButton Button, see if it fits your need
Attachment 11122
Code:
for(int i = 0; i < 4; i++)
{
if((i == 0) or (i == 2))
{
button->setEnabled(true);
}
else
{
button->setEnabled(false);
}
if(i == 0)
{
}
else if(i == 3)
{
}
else
{
}
button->setFixedSize(110,68);
button->setMask(pixmap.mask());
button->setGeometry((110 - 40) * i, 0, 110, 68);
}
widget.show();
Here are the mask files (some quick drawing using GIMP)
Attachment 11123
Attachment 11124
Attachment 11125
Re: Design buttons with custom shapes
Thanks! It looks great but I am having a problem in the line "button->setMask(pixmap.mask());". It is the next error:
error: C2027: use of type 'QBitmap' undefined.
I don't know how to solve it.
Thanks for your help
SOLVED! I need to include QBitMap to use this method.
Thanks for your help!!
Re: Design buttons with custom shapes
I used QPixmap not QBitmap.
Does the sample code work in your setup?
Re: Design buttons with custom shapes
Yes I am using QPixmap too but it seems that you need include QBitmap to use the .mask() method.
It is working fine! I need make some changes but your example was really usefull to understand the use of the masks.
Thanks