PDA

View Full Version : QToolButton and scrollarea transparency



Sashabn
27th January 2016, 13:19
Hi i have scrollarea and i add object of QToolButton class in that area. When i try to set background color and transparency of QToolButton object in that scrollArea i got button with only solid color.
.
.
.
gridLayout = new QGridLayout;
QWidget *viewport=new QWidget;

viewport->setProperty("viewport",true);
viewport->setStyleSheet("QWidget[viewport=true]{ background-color:rgba(255,0,0,0);border-image: url(:/icons/logo.png)0 0 0 0 stretch stretch }");
viewport->setLayout(gridLayout);
scrollArea = new QScrollArea;
scrollArea->setStyleSheet("background-color:rgba(0,0,255,70)");
scrollArea->setWidget(viewport);
ui->proizvodL->addWidget(scrollArea);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
scrollArea->setMinimumWidth(cScrollAreaSize);

scrollArea->setMaximumWidth(900);
scrollArea->setWidgetResizable(true);
scrollArea->sizePolicy().setHorizontalStretch(1);
scrollArea->sizePolicy().setVerticalStretch(1);

.
.
.

Proizvod *newProizvod=new Proizvod(query->value(2).toString(),query->value(2).toString(),query->value(2).toString(),false,query->value(3).toString(),
query->value(0).toInt(),query->value(1).toInt(),query->value(5).toFloat());

connect(newProizvod,SIGNAL(kliknuto(Proizvod*)),th is,SLOT(prikaziSveIzKategorije(Proizvod*)));

proizvodi.insert(lastProizvodId,newProizvod);


//ui->proizvodL->addWidget(newProizvod,lastProizvodId/6,lastProizvodId%6);
gridLayout->addWidget(newProizvod,lastProizvodId/(scrollArea->size().width()/80),lastProizvodId%(scrollArea->size().width()/80));

lastProizvodId++;

newProizvod->setStyleSheet("background-color:rgba(0,0,255,30)");


Why my button are not transparent ?
How can i fix this?

Thanks a lot

Sashabn
27th January 2016, 16:46
I was solve my problem, fusion style was make trouble...