Stylesheet for QLineEdit to show without editor area - qt

How to tune QLineEdit view to:
show as label with transparent background for displaying mode.
show as common QLineEdit widget when user clicks on it to editing.

Use this css to apply QLabel-like style when it is not in edit mode:
QLineEdit:!focus
{
border: 1px solid transparent;
background: transparent;
}
QLineEdit:focus
{
background: white;
}

Related

Wordpress: Add border to MC4WP form

I have a MailChimp 4 WordPress signup form embedded in a widget. I am trying to place a border around either the form or the widget on https://www.taastrategies.com/blog/. I used Inspect to identify the form's class as "mc4wp-form mc4wp-form-2449", then added the following to >Appearance >Customize >Additional CSS provided by Generate Press:
/* border around mc4wp form */
.mc4wp-form mc4wp-form-2449 {
border: 2px solid;
}
No border appears ... what am I missing here? Thanks.
You are not hitting the right element. It should be aside#mc4wp_form_widget-2. Try this code below:
aside#mc4wp_form_widget-2 {
border: 1px solid violet;
padding: 29px;
}

How build a custom css button with strip

How can i build this example button, with strip red (when focus) and blue.
button example
Thanks a lot!
.button:hover {
border-left: 3px solid blue;
}

QtreeWidget Border Issue

I have a qtreewidget in my application. I have set the stylesheet like below for it.
setFrameShape(QFrame::NoFrame);
setStyleSheet("QTreeView { border: none; background: transparent; outline:none; }" "QTreeView::item:!selected:hover { border: 1px solid #AAAAAA}" "QTreeView::item:selected { border: 1px solid #0053A6}");
Now the problem is that there is no border around qtreewidget which is correct behaviour but when I click on any item of this widget a black border appears around the widget. Although I have mentioned the border for this widget to none then why it is appearing on clicking any item.
This is a focus rectangle. To completely disable it:
setFocusPolicy(Qt::NoFocus)

CSS Border style combobox or datefield extjs

I would like to "graphically disable" a combobox in extjs by appling a CSS class to remove the borders while the user does not click on it.
How can I apply this CSS class? It is not the border of the field but of a wrapper which wrap both field and picker.
(I have the same problem for datefield)
Ext applies special CSS classes when fields are focused, so that's rahter easy to do focus-dependent styling. Use dev tools to explore the markup and see what you need to change.
For example, for removing all visual clues that it is a field from a combo that is not focused, use this CSS (example fiddle):
.custom-combo .x-form-field:not(.x-field-form-focus) {
border: 1px solid transparent;
background: none;
}
.custom-combo .x-form-item-body:not(.x-form-trigger-wrap-focus) .x-form-trigger {
background: none;
border-bottom: 1px solid transparent;
}
I use border: 1px solid transparent instead of border: 0 to prevent a 1px offset when the combo get focused.

Define tabs background with stylesheets without changing QWidget?

I want to make a very basic GUI: tabs, text area.
But I want to color my tabs and make them always looking the same on MAC, Windows and Linux.
So, I tryed to use a stylesheet:
QTabWidget::pane
{
border-top: 2px solid #1B1B1B;
background-color: #262626;
}
QTabWidget::tab-bar
{
left: 5px;
alignment: left;
background: #3E3E3E;
}
QTabBar::tab
{
background: transparent;
color: #757575;
padding: 15px 5px 15px 5px;
}
QTabBar::tab:hover
{
text-decoration: underline;
}
QTabBar::tab:selected
{
color: #DEF600;
background: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #262626, stop: 1.0 #3D3D3D );
}
But even if the tabs looks well, there is a problem: The tab pane is still transparent...
I can force a background color by adding:
QWidget
{
background-color: #262626;
}
But as you know, this change the background color of ALL the widgets, even my QPlainTextEdit that I still want to have a white background. And more annoying, this reset the OS skin and display ugly scrollbars (I really want to keep them as they were).
Is there a way to change the tabs pane background without having to reskin all the components ?
I had the same problem. I could get it to work with this:
QTabWidget::pane > QWidget {
background-color: #262626;
}
Try this.
QTabWidget::pane {
background: red;
}
You can read this for details. And one more thing to comment. You can use QObject::objectName() as style sheet's id selector. for example,
QTabWidget#myTab { ... }
hope this helps.
It is possible simply by:
* {background: green;}
This style set background for this widget and all their childs so you need to know one important thing. The area you think is QTabWidget in fact is QWidget which is set inside of QTabWidget. You can easly check where QTabWidget is and where is their child by adding to your style
QTabWidget::pane {background: green; padding: 10px;}
green area is a QTabWidget, all inside is overlapped by QTabWidgets child (any QWidget added by addTab() function).
add style
"background-color:rgb(255,255,255)"
to each tab.
Refer this:
http://doc.qt.digia.com/qt/stylesheet-syntax.html
Read ID Selector under Selector Types. You can instruct a certain style to be applied only for a given object name. So you can use whatever the name you have given to your tabWidget.
Try enabling document mode with
myTab->setDocumentMode(true);
This has worked for me when everything else has failed. You can do it in code, or by twiddling the property in qtcreator.
You still might have to apply some styles to the pane like so:
QTabWidget:pane{
background: red;
}
Read more about this in the documentation.

Resources