make an pushbutton round shape
hey guys...i have to make my pushbutton in a rounded shape...when i made it in the ui design by using border-radius: 10px; it worked,but i cannot click the rounded button when i run the ui.
the button must be toggled tooo.when i click on one window it must be pressed in the other too..(i.e) the clicked buton must be disabled in the other window..which must signify that i had already clicked the button on the previous screen..
pls help me with a sample code..
Re: make an pushbutton round shape
GOT IT :)
USED THIS ONE
#
ui->pushButton_6->setText("7");
ui->pushButton_7->setText("6");
ui->pushButton_8->setText("5");
ui->pushButton_4->setText("1");
ui->pushButton_5->setText("8");
ui->pushButton_9->setText("4");
ui->pushButton_10->setText("3");
ui->pushButton_11->setText("2");
ui->pushButton_6->setFixedHeight(20);
ui->pushButton_7->setFixedHeight(20);
ui->pushButton_8->setFixedHeight(20);
ui->pushButton_4->setFixedHeight(20);
ui->pushButton_5->setFixedHeight(20);
ui->pushButton_9->setFixedHeight(20);
ui->pushButton_10->setFixedHeight(20);
ui->pushButton_11->setFixedHeight(20);
ui->pushButton_6->setFixedWidth(20);
ui->pushButton_7->setFixedWidth(20);
ui->pushButton_8->setFixedWidth(20);
ui->pushButton_4->setFixedWidth(20);
ui->pushButton_5->setFixedWidth(20);
ui->pushButton_9->setFixedWidth(20);
ui->pushButton_10->setFixedWidth(20);
ui->pushButton_11->setFixedWidth(20);
QRect *rect = new QRect(0,0,20,20);
QRegion* region = new QRegion(*rect,QRegion::Ellipse);
ui->pushButton_6->setMask(*region);
ui->pushButton_7->setMask(*region);
ui->pushButton_8->setMask(*region);
ui->pushButton_4->setMask(*region);
ui->pushButton_5->setMask(*region);
ui->pushButton_9->setMask(*region);
ui->pushButton_10->setMask(*region);
ui->pushButton_11->setMask(*region);
#
Re: make an pushbutton round shape
Don't allocate the rect and region on the heap, or deleted them after you used them.
Otherwise you will leak memory.
Cheers,
_
Re: make an pushbutton round shape
You can try like this:
Code:
QPixmap pixmapLogin
(":/new/prefix1/Resources/login_released.png");
QSize imagesize
= pixmapLogin.
size();
ui->LoginButton->setFixedSize(imagesize);
ui->LoginButton->setMask(pixmapLogin.mask());
ui
->LoginButton
->setCursor
(QCursor(Qt
::PointingHandCursor));
Re: make an pushbutton round shape
Quote:
You can try like this
And how does this answer the OP's question about making round buttons? Please don't post irrelevant answers to old questions. It makes you look bad and gives misleading advice.