1

введите сюда описание изображения

test.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <property name="styleSheet">
   <string notr="true">

    
QComboBox QListView {
   
    selection-background-color:white;
    
 }


}</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QComboBox" name="comboBox">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>110</y>
      <width>191</width>
      <height>41</height>
     </rect>
    </property>
    <property name="styleSheet">
     <string notr="true">QPushButton{
background-color: rgb(52, 58, 64);
color: rgb(255, 255, 255);
}
QPushButton::hover{
    /* background-color: rgb(90, 100, 111);*/
    background-color: rgb(79, 87, 97);
}

QComboBox{
background-color: rgb(52, 58, 64);
border:1px;
border-color:(170, 170, 255);
color: rgb(255, 255, 255);
}

QLabel{
background-color: rgb(108, 99, 118);
margin-top: 5px;
border-bottom: 2px solid  rgb(108, 99, 118);
border-top: 2px solid rgb(108, 99, 118);
}
QMainWindow{
background-color: rgb(244, 243, 248);
}
QComboBox::down-arrow
{   
    
    height: 15px;
    width: 20px;
    image: url(:/lol/arrow-up.png);
}
QWidget{
font: bold 15px;
font: Noto Sans;
color: rgb(255, 255, 255);
}
QCheckBox{
background-color: rgb(108, 99, 118);
margin-bottom: 5px;
}
QComboBox::drop-down {
   border:none;
}
QComboBox::hover{
background-color: rgb(90, 100, 111);
}
QComboBox QListView {
      background-color:rgb(52, 58, 64);
    selection-background-color:rgb(121, 121, 182);
    outline:none;
 }
/* этот код не работает*\
QComboBox QScrollBar::handle:vertical {
 background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0 rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155), stop:1 rgb(138, 147, 155));
 min-height: 0px
}
 QComboBox QScrollBar::add-line:vertical {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0 rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155),  stop:1 rgb(138, 147, 155));
height: 0px;
 subcontrol-position: bottom;
 subcontrol-origin: margin;
}
QComboBox QScrollBar::sub-line:vertical {
 background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0  rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155),  stop:1 rgb(138, 147, 155));
 height: 0 px;
subcontrol-position: top;
 subcontrol-origin: margin;
}
/*и так тоже не работает*\
QScrollBar::handle:vertical {
 background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0 rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155), stop:1 rgb(138, 147, 155));
 min-height: 0px
}
QScrollBar::add-line:vertical {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0 rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155),  stop:1 rgb(138, 147, 155));
height: 0px;
 subcontrol-position: bottom;
 subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
 background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
stop: 0  rgb(138, 147, 155), stop: 0.5 rgb(138, 147, 155),  stop:1 rgb(138, 147, 155));
 height: 0 px;
subcontrol-position: top;
 subcontrol-origin: margin;
}</string>
    </property>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>

1 ответ 1

1

Попробуйте так:

QMainWindow {
    background-color: rgb(244, 243, 248);
}

QPushButton {
    background-color: rgb(52, 58, 64);
    color: rgb(255, 255, 255);
}
QPushButton::hover {
    /* background-color: rgb(90, 100, 111);*/
    background-color: rgb(79, 87, 97);
}

QLabel {
    background-color: rgb(108, 99, 118);
    margin-top: 5px;
    border-bottom: 2px solid  rgb(108, 99, 118);
    border-top: 2px solid rgb(108, 99, 118);
}

QWidget {
    font: bold 15px;
    font: Noto Sans;
    color: rgb(255, 255, 255);
}
QCheckBox {
    background-color: rgb(108, 99, 118);
    margin-bottom: 5px;
}

QComboBox {
    background-color: rgb(52, 58, 64);
    border:1px;
    border-color:(170, 170, 255);
    color: rgb(255, 255, 255);
}

QComboBox::down-arrow {   
    height: 15px;
    width: 20px;
    image: url(:/lol/arrow-up.png);                   
}

QComboBox::drop-down {
   border: none;
}
QComboBox::hover {
    background-color: rgb(90, 100, 111);
}
QComboBox QListView {
    background-color: rgb(52, 58, 64);
    selection-background-color: rgb(121, 121, 182);
    outline: none;
 }
 
/* ===================== QScrollBar ======================= */
QScrollBar:vertical {
    background-color: #2A2929;
    width: 15px;
    margin: 15px 3px 15px 3px;
    border: 1px transparent #2A2929;
    border-radius: 4px;
}

QScrollBar::handle:vertical {
    background-color: red;         
    min-height: 5px;
    border-radius: 4px;
}

QScrollBar::sub-line:vertical {
    margin: 3px 0px 3px 0px;
    border-image: url(./images/up_arrow_disabled.png);        
    height: 10px;
    width: 10px;
    subcontrol-position: top;
    subcontrol-origin: margin;
}

QScrollBar::add-line:vertical {
    margin: 3px 0px 3px 0px;
    border-image: url(./images/down_arrow_disabled.png);       
    height: 10px;
    width: 10px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on {
    border-image: url(./images/up_arrow.png);                 
    height: 10px;
    width: 10px;
    subcontrol-position: top;
    subcontrol-origin: margin;
}

QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on {
    border-image: url(./images/down_arrow.png);                
    height: 10px;
    width: 10px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
    background: none;
}

QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
    background: none;
}

q1408879_test.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <property name="styleSheet">
   <string notr="true">   
QComboBox QListView {
   
    selection-background-color:white;
    
 }

</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QComboBox" name="comboBox">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>110</y>
      <width>191</width>
      <height>41</height>
     </rect>
    </property>
    <property name="styleSheet">
     <string notr="true">QMainWindow {
    background-color: rgb(244, 243, 248);
}

QPushButton {
    background-color: rgb(52, 58, 64);
    color: rgb(255, 255, 255);
}
QPushButton::hover {
    /* background-color: rgb(90, 100, 111);*/
    background-color: rgb(79, 87, 97);
}

QLabel {
    background-color: rgb(108, 99, 118);
    margin-top: 5px;
    border-bottom: 2px solid  rgb(108, 99, 118);
    border-top: 2px solid rgb(108, 99, 118);
}

QWidget {
    font: bold 15px;
    font: Noto Sans;
    color: rgb(255, 255, 255);
}
QCheckBox {
    background-color: rgb(108, 99, 118);
    margin-bottom: 5px;
}

QComboBox {
    background-color: rgb(52, 58, 64);
    border:1px;
    border-color:(170, 170, 255);
    color: rgb(255, 255, 255);
}

QComboBox::down-arrow {   
    height: 15px;
    width: 20px;
    image: url(:/lol/arrow-up.png);                   /* &lt;---- */  
}

QComboBox::drop-down {
   border: none;
}
QComboBox::hover {
    background-color: rgb(90, 100, 111);
}
QComboBox QListView {
    background-color: rgb(52, 58, 64);
    selection-background-color: rgb(121, 121, 182);
    outline: none;
 }
 
/* ===================== QScrollBar ======================= */
QScrollBar:vertical {
    background-color: #2A2929;
    width: 15px;
    margin: 15px 3px 15px 3px;
    border: 1px transparent #2A2929;
    border-radius: 4px;
}

QScrollBar::handle:vertical {
    background-color: red;         
    min-height: 5px;
    border-radius: 4px;
}

QScrollBar::sub-line:vertical {
    margin: 3px 0px 3px 0px;
    border-image: url(./images/up_arrow_disabled.png);        
    height: 10px;
    width: 10px;
    subcontrol-position: top;
    subcontrol-origin: margin;
}

QScrollBar::add-line:vertical {
    margin: 3px 0px 3px 0px;
    border-image: url(./images/down_arrow_disabled.png);       
    height: 10px;
    width: 10px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on {
    border-image: url(./images/up_arrow.png);                 
    height: 10px;
    width: 10px;
    subcontrol-position: top;
    subcontrol-origin: margin;
}

QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on {
    border-image: url(./images/down_arrow.png);                
    height: 10px;
    width: 10px;
    subcontrol-position: bottom;
    subcontrol-origin: margin;
}

QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
    background: none;
}

QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
    background: none;
}</string>
    </property>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
    <item>
     <property name="text">
      <string>New Item</string>
     </property>
    </item>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>

введите сюда описание изображения

2
  • Большое спасибо за ответ 11 мая 2022 в 20:15
  • @Михаил пожалуйста.
    – S. Nick
    11 мая 2022 в 20:18

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.