What is the default width of .grid-container on large screen? How can I change it and make it bigger? What is the proper way of doing it?
The default width of .grid-container is defined in _settings.css file. Check it in the Xy Grid section:
// 56. Xy Grid
$grid-container: $global-width;
So, the default width is $global-width. Then you can change it in the Global section:
// 1. Global
$global-width: rem-calc(1200);
For example: 1440px :
$global-width: rem-calc(1440);
This is a quicker solution without messing up with the settings:
/**
* Change container size on xxlarge screen.
*/
#media screen and (min-width: 90em) {
.grid-container {
max-width: 85rem;
}
}
Simply open your "_settings.scss" file, run down to Section 2 "Breakpoints" (line 103) and edit the pixel values there as you prefer.
// 2. Breakpoints
// --------------
$breakpoints: (
small: 0,
medium: 640px,
large: 1024px,
xlarge: 1200px,
xxlarge: 1440px,
);
Related
I have a grid container of dynamic width, with an unknown number of children. These children will have a varying and unknown amount of text within them.
I know it's possible to make the number of columns dynamic:
grid-template-columns: repeat(auto-fill, minmax(100px, 150px));
However the CSS above sets the minimum width of each column to be 100px and the maximum to be 150px. Is it possible to have no maximum and instead let this be defined by the child elements text content?
I tried this but it actually makes the columns smaller:
grid-template-columns: repeat(auto-fill, minmax(100px, auto));
Okay, I have tried grid and it isn't working as expected, you can use flex instead,
.wrapper{
display: flex;
flex-wrap: wrap;
}
/*
you can add some max-width to the children elements
*/
.wrapper > div {
max-width: 50%; /*Any other with will work*/
width: 100px; /* the min width of the div */
}
I would like to change the colors of a QTableWidget. I am almost getting the result I like, but two areas in the vertical header remain white:
Before writing this post I actually managed to color also the upper left corner, but not the other area. Here is the stylesheet I am using:
QTableCornerButton::section {
background-color: #8b8d8e;
}
QHeaderView::section {
color: white;
background-color: #747678;
gridline-color: #747678;
}
Finally found the answer myself:
/*The top-left area is actually a button:*/
QTableCornerButton::section {
background-color: #8b8d8e;
}
/*The lower part of the vertical header:*/
QHeaderView {
background-color: #8b8d8e;
}
The original css I posted (QHeaderView::section) referred only to the header entries, not the header itself.
I have sub-classed QTabWidget and have two tabs in there. I have overridden ::resizeEvent() of QTabWidget to change the width of tabs, so they can take half of the width of QTabWidget. In TAB1 (left tab), I have a horizontal splitter (QSplitter), which divides the tab in two equal parts, in each of them displaying a different QWidget. It all works fine, except that QTabBar's top left X offset is a few pixel to the right. I think QTabBar itself is shifter a few pixels to the right. How do I fix this?
Here's the code:
void WelcomeTabWidget::resizeEvent(QResizeEvent *event) {
tabBar()->setMinimumWidth(event->size().width());
tabBar()->setContentsMargins(0, 0, 0, 0);
_splitter->setSizes({event->size().width() / 2, event->size().width() / 2});
//The line below does not have any effect, so might as well remove it.
QTabWidget::resizeEvent(event);
}
Here's what it visually looks like (the offset is marked at two places in red):
How do I fix this?
This was happening due to style sheets that were set for the overall application:
QTabWidget::tab-bar {
left: 5px; /* move to the right by 5px */
}
So, it's fine:)
How do I move a rectangle component in Qml using c++ program, it has to progress from minimum to maximum value like a progress bar with color gradient. i have tried to use number animation and it is working fine,but how do i change the color as it progresses.
It's hard to give a specific answer as you've not provided much detail or a code sample. However it seems like you want to set the color property of your progress bar rectangle to be dependent on it's width or position, so that it changes depending on how much 'progress' has been made.
In addition, you may be able to use a ColorAnimation class to animate this, along with a Behaviour, for example:
Rectangle {
id: progressBar
width: 0
height: 20
color: (width < 30) ? "red" : (width < 60) ? "yellow" : "green"
Behavior {
ColorAnimation { target: progressBar; duration: 500 }
}
}
I don't know how to change the color of the text partially in the progress bar when its value becomes nearly 50%. This effect comes automatically in the fusion style progress bar (picture below). Does anyone know how this is done ?
Too lazy to write working example code, much less making a screenshot. Not even for 50 reps. :-)
However, the question was somewhat interesting. I had no idea how such a two colored text could be done. So I checked:
http://qt.gitorious.org/qt/qtbase/blobs/stable/src/widgets/styles/qfusionstyle.cpp
Line 1450ff (http://qt.gitorious.org/qt/qtbase/blobs/stable/src/widgets/styles/qfusionstyle.cpp#line1450).
QRegion rightRect = rect;
rightRect = rightRect.subtracted(leftRect);
painter->setClipRegion(rightRect);
painter->setPen(flip ? alternateTextColor : textColor);
painter->drawText(rect,
bar->text,
QTextOption(Qt::AlignAbsolute|
Qt::AlignHCenter|
Qt::AlignVCenter));
if (!leftRect.isNull())
{
painter->setPen(flip ? textColor : alternateTextColor);
painter->setClipRect(leftRect);
painter->drawText(rect,
bar->text,
QTextOption(Qt::AlignAbsolute|
Qt::AlignHCenter|
Qt::AlignVCenter));
}
Basically the text is drawn two times into the same rectangle. Each time with an appropriate clipping. Easy if you know how. :-)
From my point of view the best, and probably the easiest, way to do this is to change the pallet for the QProgressBar widget:
QPalette palette = progressBar->palette()
palette.setColor(QPalette::Text, textColor)
palette.setColor(QPalette::HighlightedText, textColor)
progressBar->setPalette(palette)
"The setBackgroundRole method let you use a color role for the background, which means one of the predefined color of the style applied to the widget. So your are basically limited to the style and its colors."
Background solution:
value = 65
self.progressBar.setProperty("value", value)
if value < 50:
self.progressBar.setStyleSheet("QProgressBar::chunk { background-color: black; }")
else:
self.progressBar.setStyleSheet("QProgressBar::chunk { background-color: black; } QProgressBar { color: white; }")
You can use stylesheet on the Container Widget :
myMainWidget.setStyleSheet(QString("QProgressBar {color: red}"));