1
0
Fork 0
mirror of synced 2024-06-26 10:11:19 +12:00

Improve the layout of PathEdit

This commit is contained in:
Stelios Tsampas 2021-04-29 14:20:20 +03:00
parent e5d01674dd
commit 115d142f94
3 changed files with 45 additions and 48 deletions

View file

@ -2,13 +2,12 @@ import os
from PyQt5.QtCore import Qt, QRect, QSize, QPoint, pyqtSignal
from PyQt5.QtGui import QMovie
from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QLineEdit, \
QPushButton, QStyleOptionTab, QStylePainter, QTabBar
from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QPushButton, \
QStyleOptionTab, QStylePainter, QTabBar
from qtawesome import icon
from rare import style_path
from .pathedit_ui import Ui_PathEdit
from rare.utils.pathedit_ui import Ui_PathEdit
class FlowLayout(QLayout):

View file

@ -14,22 +14,25 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_PathEdit(object):
def setupUi(self, PathEdit):
PathEdit.setObjectName("PathEdit")
PathEdit.resize(407, 182)
self.gridLayout = QtWidgets.QGridLayout(PathEdit)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.layout_pathedit = QtWidgets.QGridLayout(PathEdit)
self.layout_pathedit.setContentsMargins(0, 0, 0, 0)
self.layout_pathedit.setObjectName("layout_pathedit")
self.path_select = QtWidgets.QToolButton(PathEdit)
self.path_select.setText("...")
self.path_select.setObjectName("path_select")
self.gridLayout.addWidget(self.path_select, 1, 2, 1, 1)
self.layout_pathedit.addWidget(self.path_select, 0, 1, 1, 1)
self.text_edit = QtWidgets.QLineEdit(PathEdit)
self.text_edit.setObjectName("text_edit")
self.gridLayout.addWidget(self.text_edit, 1, 0, 1, 2)
self.layout_pathedit.addWidget(self.text_edit, 0, 0, 1, 1)
self.layout_pathedit_save = QtWidgets.QHBoxLayout()
self.layout_pathedit_save.setObjectName("layout_pathedit_save")
spacerItem = QtWidgets.QSpacerItem(40, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 2, 0, 1, 1)
self.layout_pathedit_save.addItem(spacerItem)
self.save_path_button = QtWidgets.QPushButton(PathEdit)
self.save_path_button.setEnabled(True)
self.save_path_button.setObjectName("save_path_button")
self.gridLayout.addWidget(self.save_path_button, 2, 1, 1, 2)
self.layout_pathedit_save.addWidget(self.save_path_button)
self.layout_pathedit.addLayout(self.layout_pathedit_save, 1, 0, 1, 2)
self.retranslateUi(PathEdit)
QtCore.QMetaObject.connectSlotsByName(PathEdit)
@ -37,7 +40,6 @@ class Ui_PathEdit(object):
def retranslateUi(self, PathEdit):
_translate = QtCore.QCoreApplication.translate
PathEdit.setWindowTitle(_translate("PathEdit", "PathEdit"))
self.path_select.setText(_translate("PathEdit", "..."))
self.save_path_button.setText(_translate("PathEdit", "Save"))

View file

@ -2,18 +2,10 @@
<ui version="4.0">
<class>PathEdit</class>
<widget class="QWidget" name="PathEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>407</width>
<height>182</height>
</rect>
</property>
<property name="windowTitle">
<string>PathEdit</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="layout_pathedit">
<property name="leftMargin">
<number>0</number>
</property>
@ -26,39 +18,43 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="4">
<item row="0" column="1">
<widget class="QToolButton" name="path_select">
<property name="text">
<string>...</string>
<string notr="true">...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<spacer name="hs_pathedit">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3" colspan="2">
<widget class="QPushButton" name="save_path_button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<item row="0" column="0">
<widget class="QLineEdit" name="text_edit"/>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="layout_pathedit_save">
<item>
<spacer name="hs_save">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="save_path_button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>