Update QToolButton texts and add more stylesheets to test with
Adapt QToolButton texts to descriptive versions. Add dummy stylesheet that will be used for all test functions, and a specific style sheet to test rendering of QToolButton with a menu button. Task-number: QTBUG-100401 Change-Id: I5440407ddb3ea5b45124e77a6f0d1013362b4398 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 43b25286ced04e95e666a552bbe757e4fbeeba67) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bc62e7865d
commit
817b4acbd9
31
tests/baseline/stylesheet/qss/dummy.qss
Normal file
31
tests/baseline/stylesheet/qss/dummy.qss
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* dummy stylesheet to reproduce QTBUG-100433 for QToolButton
|
||||||
|
QDummyView {
|
||||||
|
alternate-background-color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView {
|
||||||
|
show-decoration-selected: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView::item {
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-top-color: transparent;
|
||||||
|
border-bottom-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView::item:hover {
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
|
||||||
|
border: 1px solid #bfcde4;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView::item:selected {
|
||||||
|
border: 1px solid #567dbc;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView::item:selected:active{
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDummyView::item:selected:!active {
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
QToolButton::menu-button { border: none }
|
@ -98,7 +98,7 @@ void tst_Stylesheet::tst_QToolButton_data()
|
|||||||
|
|
||||||
void tst_Stylesheet::tst_QToolButton()
|
void tst_Stylesheet::tst_QToolButton()
|
||||||
{
|
{
|
||||||
const QIcon fileIcon = QApplication::style()->standardIcon(QStyle::SP_FileIcon);
|
const QIcon trashIcon = QApplication::style()->standardIcon(QStyle::SP_TrashIcon);
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
QVBoxLayout *vbox = new QVBoxLayout;
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ void tst_Stylesheet::tst_QToolButton()
|
|||||||
Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon}) {
|
Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon}) {
|
||||||
QToolButton *normal = new QToolButton;
|
QToolButton *normal = new QToolButton;
|
||||||
normal->setToolButtonStyle(buttonStyle);
|
normal->setToolButtonStyle(buttonStyle);
|
||||||
normal->setText("Text");
|
normal->setText("Norm");
|
||||||
normal->setIcon(fileIcon);
|
normal->setIcon(trashIcon);
|
||||||
normalButtons->addWidget(normal);
|
normalButtons->addWidget(normal);
|
||||||
}
|
}
|
||||||
vbox->addLayout(normalButtons);
|
vbox->addLayout(normalButtons);
|
||||||
@ -116,7 +116,7 @@ void tst_Stylesheet::tst_QToolButton()
|
|||||||
QHBoxLayout *arrowButtons = new QHBoxLayout;
|
QHBoxLayout *arrowButtons = new QHBoxLayout;
|
||||||
for (const auto &arrowType : {Qt::LeftArrow, Qt::RightArrow, Qt::UpArrow, Qt::DownArrow}) {
|
for (const auto &arrowType : {Qt::LeftArrow, Qt::RightArrow, Qt::UpArrow, Qt::DownArrow}) {
|
||||||
QToolButton *arrow = new QToolButton;
|
QToolButton *arrow = new QToolButton;
|
||||||
arrow->setText("Text");
|
arrow->setText("Arrs");
|
||||||
arrow->setArrowType(arrowType);
|
arrow->setArrowType(arrowType);
|
||||||
arrowButtons->addWidget(arrow);
|
arrowButtons->addWidget(arrow);
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ void tst_Stylesheet::tst_QToolButton()
|
|||||||
for (const auto &buttonStyle : {Qt::ToolButtonTextOnly,
|
for (const auto &buttonStyle : {Qt::ToolButtonTextOnly,
|
||||||
Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon}) {
|
Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon}) {
|
||||||
QToolButton *arrow = new QToolButton;
|
QToolButton *arrow = new QToolButton;
|
||||||
arrow->setText("Text");
|
arrow->setText("ArrTxt");
|
||||||
arrow->setArrowType(Qt::UpArrow);
|
arrow->setArrowType(Qt::UpArrow);
|
||||||
arrow->setToolButtonStyle(buttonStyle);
|
arrow->setToolButtonStyle(buttonStyle);
|
||||||
arrowWithTextButtons->addWidget(arrow);
|
arrowWithTextButtons->addWidget(arrow);
|
||||||
@ -137,8 +137,8 @@ void tst_Stylesheet::tst_QToolButton()
|
|||||||
for (const auto &popupMode : {QToolButton::InstantPopup, QToolButton::MenuButtonPopup,
|
for (const auto &popupMode : {QToolButton::InstantPopup, QToolButton::MenuButtonPopup,
|
||||||
QToolButton::DelayedPopup}) {
|
QToolButton::DelayedPopup}) {
|
||||||
QToolButton *menuButton = new QToolButton;
|
QToolButton *menuButton = new QToolButton;
|
||||||
menuButton->setText("Text");
|
menuButton->setText("PppMd");
|
||||||
menuButton->setIcon(fileIcon);
|
menuButton->setIcon(trashIcon);
|
||||||
QMenu *menuButtonMenu = new QMenu;
|
QMenu *menuButtonMenu = new QMenu;
|
||||||
menuButtonMenu->addAction(QIcon(":/icons/align-left.png"), "Left");
|
menuButtonMenu->addAction(QIcon(":/icons/align-left.png"), "Left");
|
||||||
menuButtonMenu->addAction(QIcon(":/icons/align-right.png"), "Right");
|
menuButtonMenu->addAction(QIcon(":/icons/align-right.png"), "Right");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user