{
public:
MyButton
(std
::string aText,
QWidget *aParent
);
};
{
this->setFixedHeight(30);
this->setCursor(Qt::PointingHandCursor);
this->setCheckable(false);
this->setStyleSheet("background: rgb(74,89,98); color: black; border-radius: 0px; text-align: left; padding-left: 5px; border-bottom: 1px solid black;");
}
this->setGeometry(x,y,width,160);
this->setStyleSheet("border-radius: 5px; background:red;");
dd->setGeometry(0,10,width,140);
dd->setStyleSheet("background: blue;");
dd->setLayout(layout);
for (int i = 0; i < fValues.size(); i++)
{
MyButton *button = new MyButton(fValues[i],dd);
layout->addWidget(button);
}
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setWidget(dd);
class MyButton: public QPushButton
{
public:
MyButton(std::string aText, QWidget *aParent);
};
MyButton::MyButton(std::string aText, QWidget *aParent): QPushButton(QString::fromStdString(aText), aParent)
{
this->setFixedHeight(30);
this->setCursor(Qt::PointingHandCursor);
this->setCheckable(false);
this->setStyleSheet("background: rgb(74,89,98); color: black; border-radius: 0px; text-align: left; padding-left: 5px; border-bottom: 1px solid black;");
}
this->setGeometry(x,y,width,160);
this->setStyleSheet("border-radius: 5px; background:red;");
QWidget *dd = new QWidget(this);
dd->setGeometry(0,10,width,140);
dd->setStyleSheet("background: blue;");
QVBoxLayout *layout = new QVBoxLayout();
dd->setLayout(layout);
for (int i = 0; i < fValues.size(); i++)
{
MyButton *button = new MyButton(fValues[i],dd);
layout->addWidget(button);
}
QScrollArea *scroll = new QScrollArea(this);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setWidget(dd);
To copy to clipboard, switch view to plain text mode
Bookmarks