I'm trying to customize the style of the Webix ui.list widget, but there're two questions that I can't solve by myself:
is there a way to set the autoheight for items?
if no, which class will allow to set `text-overflow:ellipsis?
Here's a sample and the code of the current implementation:
CSS:
.webix_list_item{
border: 1px solid #ebebeb;
border-radius: 5px;
margin:15px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
background: #fafafa;
}
.webix_list_item:hover{
box-shadow: 0 0 10px rgba(177,44,99,0.6);
border: 1px solid #efefef;
background: #efefef;
}
.webix_list_item.webix_selected {
color: #fff;
background: #cac1c5;
border: 1px solid #bfb8bb !important;
}
JS (pretty simple):
webix.ui({
view:"list",
data:list_data,
width:230, scroll:false,
select:true
});
In addition to the CSS solution, Webix list has a type property which can handle the height of the items. Particularly:
type:{
height:"auto"
}
http://webix.com/snippet/c01714d0
Trivial, is this what you are expecting?
http://webix.com/snippet/0e340ea4
I have added the below css:
.webix_list_item {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
if you want to set autoheight:
.webix_list_item {
white-space: normal;
overflow: visible !important;
height: auto !important;
}
Related
I am trying to create a gui application to control the volume level of my machine using Qt5 and C++.
This is what I kind of want to achieve.
So, I created the basic layouts and added the QSlider, and then used the following stylesheet to style it:
QSlider::groove:horizontal
{
height: 16px;
background: yellow;
margin: 2px;
}
QSlider::handle:horizontal
{
background: blue;
width: 16px;
height: 16px;
margin: -5px 6px -5px 6px;
border-radius:11px;
border: 3px solid #ffffff;
}
I got the following result:
First the handle is an eclipse, and not a circle. But I wanted to reduce the height of the groove, so I modified the above stylesheet:
QSlider::groove:horizontal
{
height: 10px; // modified here
background: yellow;
margin: 2px;
}
QSlider::handle:horizontal
{
background: blue;
width: 16px;
height: 16px;
margin: -5px 6px -5px 6px;
border-radius:11px;
border: 3px solid #ffffff;
}
And now, the handle of the slider became a rectangle.
Can anyone please answer what's causing it to behave like this, or point me to some docs.
your border-radius should be proportional to the length and width to become a circle.
Try this style :
QSlider::groove:horizontal {
border-radius: 1px;
height: 3px;
margin: 0px;
background-color: rgb(52, 59, 72);
}
QSlider::groove:horizontal:hover {
background-color: rgb(55, 62, 76);
}
QSlider::handle:horizontal {
background-color: rgb(85, 170, 255);
border: none;
height: 40px;
width: 40px;
margin: -20px 0;
border-radius: 20px;
padding: -20px 0px;
}
QSlider::handle:horizontal:hover {
background-color: rgb(155, 180, 255);
}
QSlider::handle:horizontal:pressed {
background-color: rgb(65, 255, 195);
}
And This is for your style (I change margin and padding)
QSlider::groove:horizontal
{
height: 16px;
background: yellow;
margin: 2px;
}
QSlider::handle:horizontal
{
background: blue;
width: 16px;
height: 16px;
margin: -4px 0;
padding: -4px 0px;
border-radius:11px;
border: 3px solid #ffffff;
}
This question already has an answer here:
QTabBar strange line doesn't disappear
(1 answer)
Closed 2 years ago.
here's is the style sheet I used for a modified version Qt Mainwindow example:
QWidget { background: #757575 }
QTabWidget { padding: 0px; border: 0px; background-color: #757575; }
QTabWidget::pane { border: 0px solid #C2C7CB; top: -3px; background: #757575; }
QTabWidget::tab-bar {
subcontrol-position: top left;
subcontrol-origin: margin;
padding: 0px 0px 0px 0px;
border: 0px;
background: transparent;
}
QTabBar { background-color : #757575; }
QTabBar::close-button {
subcontrol-position: right;
}
QTabBar::tab {
color: white;
background: #757575;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
min-width: 8ex;
padding: 10px;
min-width: 100px;
}
QTabBar::tab::selected{ border-bottom: 0px solid #757575; background-color: darkgrey; }
The pic below shows the output of the above stylesheet on QDockWidget example
Here's a link for the Project
https://drive.google.com/open?id=0B6cx8jGbgXo7Z0xucXBaSEljMGc
QTabBar::setDrawBase(false); this function can solve the problem.hope this may help you.
This is a default border that was not redefined. Although I cannot reproduce the problem with your style sheets (things show up correctly to me), the solution is to redefine the border property, probably from the QToolBar
QToolBar {
border: 0;
background-color: #757575;
}
I would like to display table in Qt with specific style. I want to draw all grid lines with same color and same width.
Problem is, that it is hard to style QHeaderView. All the time, I get 2px grid width or no grid at all.
I Have folowing window with one QTableWIdget
and asociated styleSheet
QWidget {
background-color: #333333;
color: #fffff8;
}
QHeaderView::section {
background-color: #646464;
padding: 4px;
border: 1px solid #fffff8;
font-size: 14pt;
}
QTableWidget {
gridline-color: #fffff8;
font-size: 12pt;
}
QTableWidget QTableCornerButton::section {
background-color: #646464;
border: 1px solid #fffff8;
}
Are there any tricks to have all grid lines 1px width? I'm using 4.8.5 and I can't upgrade to version 5.x.
The trick is border-style: none; in QHeaderView::section after witch border-left, border-right, border-top and border-bottom starts working. Correct style for QHeaderView::section should be
QHeaderView::section {
background-color: #646464;
padding: 4px;
font-size: 14pt;
border-style: none;
border-bottom: 1px solid #fffff8;
border-right: 1px solid #fffff8;
}
QHeaderView::section:horizontal
{
border-top: 1px solid #fffff8;
}
QHeaderView::section:vertical
{
border-left: 1px solid #fffff8;
}
I think what you did is you added additional border for section cells, and the section properties should look like that ( although I did not try this solution )
QHeaderView::section {
background-color: #646464;
padding: 4px;
border: 0px;
font-size: 14pt;
}
For more information how to style your headers, see:
http://pastebin.com/svReqHr3
HowTo draw correct CSS border in header?
Using a stylesheet I manage to set the background for the title element as shown in the image above (1.) using:
QGroupBox::title
{
background-color: rgb(255, 255, 0);
subcontrol-origin: margin;
subcontrol-position: bottom center;
}
Now I want the title to expand to the maximum size of the hosting QGroupBox as shown in image 2.. How do I accomplish this?
Thanks!
Edit: I wish to do this using style sheets only.
It turns out my efforts to find a solution on Google failed due to incorrect search terms...
http://www.qtcentre.org/threads/43232-customizing-QGroupbox-title purposed setting
QGroupBox::title
{
padding-left: 2000px;
padding-right: 2000px;
}
Not very pretty but at least It could be done using stylesheets only.
You can set background-image to expand the title.
QGroupBox {
border: 1px solid #90c6dd;
border-radius: 0px;
margin: 8px 8px 7px 7px;
padding: 56px 10px 10px 10px;
background-image: url(:/res/svg/group-bg.svg);
background-repeat: repeat-x;
background-position: top left;
}
QGroupBox::title {
font-size: 24px;
font-weight: bold;
subcontrol-origin: padding;
subcontrol-position: top left;
min-height: 39px;
padding: 0 10px 0 10px;
}
if you can get pointer on the QGroupBox parent you can get its width and knowing its parameter do the following:
this->setWidth(pOnParent->width());
padding-left: 100%;
padding-right: 100%;
I'm trying to use the CSS3 pseudo :after on li elements. The issue is that the content of :after is immediately following the li content - as if :after uses text-align:left; But since my li elements use display:block; shouldn't using text-align:right; on :after move the :after content all the way to the right? It doesn't anyway.
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
}
.container ul li:after {
content: ">";
text-align: right;
}
This is a screen shot of the issue:
I want the > to be all the way at the right, and since the content of the li changes, I can't set a width on the :after content.
How would I get the :after content to align to the right, if not with text-align?
Try float :
.container ul li:after {
content: ">";
text-align: right;
float:right;
}
Demo http://jsfiddle.net/surN2/
Hey now you can used position properties as like this:
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
position:relative;
}
.container ul li:after {
content: ">";
position:absolute;
left:20px;
top:5px;
}
and change to css properties according your design.
Live demo: http://tinkerbin.com/yXzOyDNg
If you want to right align than change left into right
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
}
.container ul li:after {
content: ">";
position:absolute;
right:20px;
top:5px;
}
Live demo: http://tinkerbin.com/rSWKxLwX
Use float:right and special line-height for vertical alignment.
.container ul li {
display: block;
border-bottom: 1px solid rgb(60,60,60);
border-top: 1px solid rgb(255,255,255);
padding: 5px 5px 5px 30px;
font-size: 12px;
width: 100%;
}
.container ul li:after {
content: ">";
float: right;
line-height: 12px;
}
Use display:flex and justify-content:space-between with align-items:center;
.container ul li {
display:flex;
justify-content:space-between;
align-items:center;
}
.container ul li:after {
content: ">";
}