Hi,
I am trying to make the UI similar to modren mobile phones with transparent background.
in the following program the background image is either repeating/or the icons are placed in a box like struture.
I have few questions:
1) is there any way to to display just icons without background/border image and box shape.
2) need to display icons starting from top left position in a gridlayout
3) whenever i select the icon it should be differentiated by making the background dim or box around.
i have attached the screens with both background(backgr.png) and border(bord.png) , but that not is not totally what i want.
MainWindow
::MainWindow(QWidget *parent
){
//neww->setStyleSheet("background-image: url(:/green2.jpeg);background-repeat: none; border: none");
neww->setStyleSheet("border-image: url(:/green2.jpeg);background-repeat: none; border: none");
setCentralWidget(neww);
neww2
->setIcon
(QIcon(":/1.png"));
neww1
->setIcon
(QIcon(":/home.png"));
neww1
->setFixedSize
(QSize(50,
50));
neww2
->setFixedSize
(QSize(50,
50));
hlayout->addWidget(neww1,0, Qt :: AlignTop |Qt :: AlignLeft);
hlayout->addWidget(neww2,Qt :: AlignTop |Qt :: AlignLeft);
//Qt :: AlignHorizontal_Mask|
neww->setLayout(hlayout);
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QWidget *neww = new QWidget(parent);
//neww->setStyleSheet("background-image: url(:/green2.jpeg);background-repeat: none; border: none");
neww->setStyleSheet("border-image: url(:/green2.jpeg);background-repeat: none; border: none");
setCentralWidget(neww);
neww->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
QPushButton *neww1 = new QPushButton;//(neww);
QPushButton *neww2 = new QPushButton;//(neww);
neww2->setIcon(QIcon(":/1.png"));
neww1->setIcon(QIcon(":/home.png"));
neww1->setFixedSize(QSize(50,50));
neww2->setFixedSize(QSize(50,50));
QHBoxLayout *hlayout = new QHBoxLayout;
hlayout->addWidget(neww1,0, Qt :: AlignTop |Qt :: AlignLeft);
hlayout->addWidget(neww2,Qt :: AlignTop |Qt :: AlignLeft);
//Qt :: AlignHorizontal_Mask|
neww->setLayout(hlayout);
}
To copy to clipboard, switch view to plain text mode
Bookmarks