C++ Resize QScrollBar up-arrow - c++

auto bar = ui->verticalScrollBar();
bar->setStyleSheet("QScrollBar:vertical { width: 20px; }"
"QScrollBar::up-arrow:vertical, QScrollbar::down-arrow:vertical { width: 15px; height: 15px; }");
I cannot resize the arrows. scrollbar
Already checked stylesheet example here http://doc.qt.io/qt-5.6/stylesheet-examples.html
Any idea would be appreciated.

Try to use min-width, max-width (the same value), min-height, max-height (the same value) instead of width and height.

Related

Qt TabWidget corner widget size

Have some problem with corner widget due using non-standard font size in app, screenshot to be clear:
code:
QToolButton* m_exit = new QToolButton(m_tab);
m_exit->setIcon(QIcon(":/Resources/exit.png"));
m_exit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
m_tab->setCornerWidget(m_exit, Qt::TopRightCorner);
font changing via
QApplication::setFont(...);
How can i do corner button same size as tab-buttons size?
P.S. using setStyleSheet( "QTabBar::tab { min-height: 120px; }" ); not allowed
You can use the ::right-corner sub-control in your stylesheet. There you can set the height of the corner button (you'd probably have to adjust the bottom too). Set both heights (corner button and tab) to the same value.
QTabWidget::right-corner {
height: 30px;
bottom: 10px;
}
QTabBar::tab {
height: 30px;
}

CSS Background image not showing with height auto

I have a div with a background image in it. I have to specify a height in px for it to show. But I want it to show with height auto as the width resizes. I am stuck.
When I have height auto it just does not show the image at all...
#slider-shadow1 {
z-index: 9999;
margin: 0 auto;
width: 100%;
height: auto;
background: url(images/layouts/shadow2.png) center no-repeat;
background-size: 100% 100%;
position:relative;
display: inline-block;
background-size:cover;
overflow: hidden;
}
Height: auto means the height of element is exactly the same as elements content. If you have empty element, its height is zero. And you can't see background image (you see exactly 0px of them).

Susy gallery breaks height for display table and table-cell

I'm trying to get equal height columns on my responsive grid using the gallery mixin for SUSY. To do that, I set the container "display: table" and the column "display: table-cell". This works for me if I do not use the mixin, but fails as soon as I turn on the mixin. The mixin works if I have set the height in pixels, but not if I set the height using 100%;
I'm using:
susy (2.1.3) and
sass (~> 3.3)
This works with or without SUSY:
.ttable {
#include container;
padding: gutter();
#include clearfix;
.ttd {
#include gallery(3 of 12);
}
}
.ttable {
display: table;
height: 500px;
border: 1px solid #BF0D3E;;
}
.ttd {
display: table-cell;
background-color: #eee;
height: 500px;
}
This doesn't work with SUSY, but works with the mixin turned off:
.ttable {
display: table;
height: 100%;
border: 1px solid $fuschia;
}
.ttd {
display: table-cell;
background-color: #eee;
height: 100%;
}
The gallery mixin uses floats and margins to position elements, which won't work with table display. The first one works because the table styles are ignored, and the items are floated with a set height. If you want to use table styles to get equal-heights, you should leave out the gallery mixin, and use individual mixins/functions to set width/gutters instead (I think only inside and inside-static gutters will work with table display).
.ttd {
#include gutters;
display: table-cell;
background-color: #eee;
width: span(3 of 12);
}

How can I set a background image for the QTabWidget in Qt

How can I set a background image for the QTabWidget in Qt?
I've already tried the following code, but it doesn't work:
ui->tabWidget->setStyleSheet("background-image: url(:/images/img.jpg);");
And can I set a background image for the specific tab of the QTabWIdget?
This is the code to set the style of QTabWidget Tab and set Image on to it:
QString category = "QTabBar::tab:first { height: 30px; width: 100px;border-image: url(/home/vx/Downloads/Images/category.png); }";
QString counter= "QTabBar::tab:middle { height: 30px; width: 100px;border-image: url(/home/vx/Downloads/Images/counter.png); }";
QString user="QTabBar::tab:last { height: 30px; width: 100px;border-image: url(/home/vx/Downloads/Images/user.png); }";
ui->TB_main->tabBar()->setStyleSheet(category+counter+user);

QTPushbutton:hover only working on click

I am using a stlyesheet to style my qt pushbutton when the mouse moves over it. However, the hover event only fires when I CLICK on the button, nothing happens when I hover my mouse over it
Trackbox { background: #FFFFFF;}
QPushButton {
position: fixed;
top: 2px;
right: 2px;
width: 20px;
height: 20px;
}
QPushButton:hover { background: #c0ffff}
Any help is appreciated. Thanks
This was a very simple fix. I needed to add a boarder, o px, for hover to work correctly. Thanks for all the help.