Как в qdateTimeEdit сделать смещение кнопки по вертикали?
Написал вот такой код:
QDateTimeEdit {
padding-top: 20px;
padding-bottom: 20px;
border-image: url("/home/image/next.png");
border-width: 0px;
background-clip: content;
}
QDateTimeEdit::up-button {
subcontrol-origin: border;
subcontrol-position: top center;
width: 16px;
height:16px;
border-image: url("/home/image/next_.png");
}
QDateTimeEdit::down-button {
subcontrol-origin: border;
subcontrol-position: bottom center;
width: 16px;
height:16px;
}
Хочу перенести кнопку по вертикали вниз на определенное количество пикселей. Как это можно сделать с применением stylesheets?
Ответы (1 шт):
Автор решения: Sergey Tatarincev
→ Ссылка
UPD.
https://doc.qt.io/qt-5/stylesheet-reference.html
например для right
If position is relative (the default), moves a subcontrol by a certain offset to the left; specifying right: x is then equivalent to specifying left: -x. If position is absolute, the right property specifies the subcontrol's right edge in relation to the parent's right edge (see also subcontrol-origin).
QDateTimeEdit {
padding-top: 40px;
padding-bottom: 40px;
border-image: url("/home/image/next_.png");
border-width: 0px;
background-clip: content;
}
QDateTimeEdit::up-button {
subcontrol-origin: border;
subcontrol-position: top center;
top: 15px; /*If position is relative (the default), moves a subcontrol by a certain offset down.*/
width: 16px;
height:16px;
}
QDateTimeEdit::down-button {
subcontrol-origin: border;
subcontrol-position: bottom center;
bottom: 15px;
width: 16px;
height:16px;
}
