PyQt5 , QT Designer про слои

Никак не могу понять работу слоёв, что и к чему. Вопрос следующий, прямо показать как сделать, то что я пытаюсь.

Что нужно ? Пытаюсь сделать окно регистрации например по след. скрину:

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

Что у меня получилось накидать:

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

Создал несколько кнопок, текст едита объединил в слои как пишет на всех форумах и тд.

  1. Но возникает два вопроса, какого я например не могу изменить положения Label, левее, праве и тд.
  2. После того как я пытаюсь сделать слой для всего окна, дабы после изменения размера моего окна менялись и виджеты!!! Но вот что я получаю:

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

Пытался искать более менее уроки - ничего не нашел.


Ответы (1 шт):

Автор решения: S. Nick

В интернете есть все. Как найти, то что вам надо - это другой вопрос. Я нашел для вас отличные вещи, которые позволят вам освоить интересующую вас тему. Приятного вам изучения.

Login.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>500</width>
    <height>790</height>
   </rect>
  </property>
  <property name="minimumSize">
   <size>
    <width>500</width>
    <height>700</height>
   </size>
  </property>
  <property name="font">
   <font>
    <family>Segoe UI</family>
    <pointsize>10</pointsize>
   </font>
  </property>
  <property name="windowTitle">
   <string>Login</string>
  </property>
  <property name="windowIcon">
   <iconset resource="file_rc.qrc">
    <normaloff>:/Icon/Images/Icon.ico</normaloff>:/Icon/Images/Icon.ico</iconset>
  </property>
  <property name="styleSheet">
   <string notr="true">color: rgb(200, 200, 200);
background-color: rgb(10, 10, 10);</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <layout class="QVBoxLayout" name="verticalLayout">
    <property name="spacing">
     <number>0</number>
    </property>
    <property name="leftMargin">
     <number>0</number>
    </property>
    <property name="topMargin">
     <number>0</number>
    </property>
    <property name="rightMargin">
     <number>0</number>
    </property>
    <property name="bottomMargin">
     <number>0</number>
    </property>
    <item>
     <widget class="QFrame" name="top_bar">
      <property name="maximumSize">
       <size>
        <width>16777215</width>
        <height>35</height>
       </size>
      </property>
      <property name="styleSheet">
       <string notr="true"/>
      </property>
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QHBoxLayout" name="horizontalLayout_2">
       <property name="spacing">
        <number>0</number>
       </property>
       <property name="leftMargin">
        <number>0</number>
       </property>
       <property name="topMargin">
        <number>5</number>
       </property>
       <property name="rightMargin">
        <number>0</number>
       </property>
       <property name="bottomMargin">
        <number>0</number>
       </property>
       <item>
        <widget class="QFrame" name="frame_error">
         <property name="maximumSize">
          <size>
           <width>450</width>
           <height>16777215</height>
          </size>
         </property>
         <property name="styleSheet">
          <string notr="true">background-color: rgb(255, 85, 127);
border-radius: 5px;</string>
         </property>
         <property name="frameShape">
          <enum>QFrame::StyledPanel</enum>
         </property>
         <property name="frameShadow">
          <enum>QFrame::Raised</enum>
         </property>
         <layout class="QHBoxLayout" name="horizontalLayout_3">
          <property name="leftMargin">
           <number>10</number>
          </property>
          <property name="topMargin">
           <number>3</number>
          </property>
          <property name="rightMargin">
           <number>10</number>
          </property>
          <property name="bottomMargin">
           <number>3</number>
          </property>
          <item>
           <widget class="QLabel" name="label_error">
            <property name="styleSheet">
             <string notr="true">color: rgb(35, 35, 35);</string>
            </property>
            <property name="text">
             <string>Error</string>
            </property>
            <property name="alignment">
             <set>Qt::AlignCenter</set>
            </property>
           </widget>
          </item>
          <item>
           <widget class="QPushButton" name="pushButton_close_pupup">
            <property name="maximumSize">
             <size>
              <width>20</width>
              <height>20</height>
             </size>
            </property>
            <property name="styleSheet">
             <string notr="true">QPushButton {
    border-radius: 5px; 
    background-image: url(:/Close_Image/Images/cil-x.png);
    background-position: center;    
    background-color: rgb(60, 60, 60);
}
QPushButton:hover {
    background-color: rgb(50, 50, 50);  
    color: rgb(200, 200, 200);
}
QPushButton:pressed {
    background-color: rgb(35, 35, 35);  
    color: rgb(200, 200, 200);
}</string>
            </property>
            <property name="text">
             <string/>
            </property>
           </widget>
          </item>
         </layout>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
    <item>
     <widget class="QFrame" name="content">
      <property name="styleSheet">
       <string notr="true"/>
      </property>
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QHBoxLayout" name="horizontalLayout">
       <item>
        <widget class="QFrame" name="login_area">
         <property name="maximumSize">
          <size>
           <width>450</width>
           <height>550</height>
          </size>
         </property>
         <property name="styleSheet">
          <string notr="true">border-radius: 10px;</string>
         </property>
         <property name="frameShape">
          <enum>QFrame::NoFrame</enum>
         </property>
         <property name="frameShadow">
          <enum>QFrame::Raised</enum>
         </property>
         <widget class="QFrame" name="logo">
          <property name="geometry">
           <rect>
            <x>45</x>
            <y>40</y>
            <width>360</width>
            <height>90</height>
           </rect>
          </property>
          <property name="styleSheet">
           <string notr="true">background-image: url(:/Logo/Images/logo_360x90.png);
background-repeat: no-repeat;
background-position: center;</string>
          </property>
          <property name="frameShape">
           <enum>QFrame::StyledPanel</enum>
          </property>
          <property name="frameShadow">
           <enum>QFrame::Raised</enum>
          </property>
         </widget>
         <widget class="QFrame" name="avatar">
          <property name="geometry">
           <rect>
            <x>165</x>
            <y>150</y>
            <width>120</width>
            <height>120</height>
           </rect>
          </property>
          <property name="styleSheet">
           <string notr="true">QFrame {
    background-image: url(:/Avatar/Images/avatar.png);
    border-radius: 60px;
    border: 10px solid rgb(255, 207, 0);
    background-position: center;
}
QFrame:hover {
    border: 10px solid rgb(255, 225, 0);
}

</string>
          </property>
          <property name="frameShape">
           <enum>QFrame::StyledPanel</enum>
          </property>
          <property name="frameShadow">
           <enum>QFrame::Raised</enum>
          </property>
         </widget>
         <widget class="QLineEdit" name="lineEdit_user">
          <property name="geometry">
           <rect>
            <x>85</x>
            <y>288</y>
            <width>280</width>
            <height>50</height>
           </rect>
          </property>
          <property name="font">
           <font>
            <family>Segoe UI</family>
            <pointsize>10</pointsize>
           </font>
          </property>
          <property name="styleSheet">
           <string notr="true">QLineEdit {
    border: 2px solid rgb(45, 45, 45);
    border-radius: 5px;
    padding: 15px;
    background-color: rgb(30, 30, 30);  
    color: rgb(100, 100, 100);
}
QLineEdit:hover {
    border: 2px solid rgb(55, 55, 55);
}
QLineEdit:focus {
    border: 2px solid rgb(255, 207, 0); 
    color: rgb(200, 200, 200);
}</string>
          </property>
          <property name="maxLength">
           <number>32</number>
          </property>
          <property name="placeholderText">
           <string>USER</string>
          </property>
         </widget>
         <widget class="QLineEdit" name="lineEdit_password">
          <property name="geometry">
           <rect>
            <x>85</x>
            <y>340</y>
            <width>280</width>
            <height>50</height>
           </rect>
          </property>
          <property name="font">
           <font>
            <family>Segoe UI</family>
            <pointsize>10</pointsize>
           </font>
          </property>
          <property name="styleSheet">
           <string notr="true">QLineEdit {
    border: 2px solid rgb(45, 45, 45);
    border-radius: 5px;
    padding: 15px;
    background-color: rgb(30, 30, 30);  
    color: rgb(100, 100, 100);
}
QLineEdit:hover {
    border: 2px solid rgb(55, 55, 55);
}
QLineEdit:focus {
    border: 2px solid rgb(255, 207, 0); 
    color: rgb(200, 200, 200);
}</string>
          </property>
          <property name="maxLength">
           <number>16</number>
          </property>
          <property name="echoMode">
           <enum>QLineEdit::Password</enum>
          </property>
          <property name="placeholderText">
           <string>PASSWORD</string>
          </property>
         </widget>
         <widget class="QCheckBox" name="checkBox_save_user">
          <property name="geometry">
           <rect>
            <x>85</x>
            <y>395</y>
            <width>281</width>
            <height>22</height>
           </rect>
          </property>
          <property name="font">
           <font>
            <family>Segoe UI</family>
            <pointsize>10</pointsize>
           </font>
          </property>
          <property name="styleSheet">
           <string notr="true">QCheckBox::indicator {
    border: 3px solid rgb(100, 100, 100);
    width: 15px;
    height: 15px;
    border-radius: 10px;    
    background-color: rgb(135, 135, 135);
}
QCheckBox::indicator:checked {
    border: 3px solid rgb(255, 205, 0);
    background-color: rgb(255, 255, 0);
}</string>
          </property>
          <property name="text">
           <string>SAVE USER</string>
          </property>
         </widget>
         <widget class="QPushButton" name="pushButton_login">
          <property name="geometry">
           <rect>
            <x>85</x>
            <y>425</y>
            <width>280</width>
            <height>50</height>
           </rect>
          </property>
          <property name="styleSheet">
           <string notr="true">QPushButton {    
    background-color: rgb(50, 50, 50);
    border: 2px solid rgb(60, 60, 60);
    border-radius: 5px;
}
QPushButton:hover { 
    background-color: rgb(60, 60, 60);
    border: 2px solid rgb(70, 70, 70);
}
QPushButton:pressed {   
    background-color: rgb(250, 230, 0);
    border: 2px solid rgb(255, 165, 24);    
    color: rgb(35, 35, 35);
}</string>
          </property>
          <property name="text">
           <string>CONNECT TO CYBERPUNK</string>
          </property>
         </widget>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
    <item>
     <widget class="QFrame" name="bottom">
      <property name="maximumSize">
       <size>
        <width>16777215</width>
        <height>35</height>
       </size>
      </property>
      <property name="styleSheet">
       <string notr="true">background-color: rgb(15, 15, 15)</string>
      </property>
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
      </property>
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <item>
        <widget class="QLabel" name="label_credits">
         <property name="font">
          <font>
           <family>Segoe UI</family>
          </font>
         </property>
         <property name="styleSheet">
          <string notr="true">color: rgb(75, 75, 75);</string>
         </property>
         <property name="text">
          <string>Created by: Wanderson M. Pimenta</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>500</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
 </widget>
 <resources>
  <include location="file_rc.qrc"/>
 </resources>
 <connections/>
</ui>

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

Больше: https://www.youtube.com/watch?v=8V0l-Ds7VXY&ab_channel=Wanderson

https://github.com/Wanderson-Magalhaes/Login_PyQt5

→ Ссылка