Comments (5)
You can't use frameless window in designer
from pyqt-frameless-window.
Hello, appreciate your response! I'm looking to integrate the custom title bar developed in your code, not within the designer itself but in the main.py file, Can you assist me with this implementation?
class MainWindow(QMainWindow):
def init(self):
super().init()
# Initialize the UI
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
from pyqt-frameless-window.
@YouKnow-sys
I need you assistance please
from pyqt-frameless-window.
Please check this demo: https://pyqt-frameless-window.readthedocs.io/en/latest/usage.html#work-with-qt-designer
from pyqt-frameless-window.
Hello, appreciate your response! I'm looking to integrate the custom title bar developed in your code, not within the designer itself but in the main.py file, Can you assist me with this implementation?
class MainWindow(QMainWindow): def init(self): super().init()
# Initialize the UI self.ui = Ui_MainWindow() self.ui.setupUi(self)
- Create your UI inside a QWidget parent, not a QMainWindow parent. Compile the UI to .py.
- Create a new class that inherits from the FramelessWindow/AcrylicWindow class and the UI class.
from qframelesswindow import AcrylicWindow, TitleBar
from UI.DDCApp import Ui_DDCApp
class DDCApplication(Ui_DDCApp, AcrylicWindow):
themeChangedSignal = QtCore.Signal(str)
def __init__(self):
super().__init__()
self.setupUi(self)
- Create a custom titlebar inherited from the TitleBar class of qframelesswindow. Like I did here.
class CustomTitleBar(TitleBar):
""" Custom title bar """
def __init__(self, parent):
super().__init__(parent)
self.maxBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgb(0, 100, 182);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgb(54, 57, 65);
}
""")
self.minBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgb(0, 100, 182);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgb(54, 57, 65);
height: 4px;
}
""")
self.closeBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
}
""")
def dark(self):
self.maxBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgb(0, 100, 182);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgb(54, 57, 65);
}
""")
self.minBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgb(0, 100, 182);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgb(54, 57, 65);
height: 4px;
}
""")
self.closeBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(255, 255, 255, 255);
qproperty-normalBackgroundColor: transparent;
}
""")
def light(self):
self.maxBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(0, 0, 0, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgba(0, 0, 0, 128);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgba(0, 0, 0, 128);
}
""")
self.minBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(0, 0, 0, 255);
qproperty-normalBackgroundColor: transparent;
qproperty-hoverColor: white;
qproperty-hoverBackgroundColor: rgba(0, 0, 0, 128);
qproperty-pressedColor: white;
qproperty-pressedBackgroundColor: rgba(0, 0, 0, 128);
height: 4px;
}
""")
self.closeBtn.setStyleSheet("""
TitleBarButton {
qproperty-normalColor: rgba(0, 0, 0, 255);
qproperty-normalBackgroundColor: transparent;
}
""")
- Assign the titlebar to your main application class. You can add more widgets to it as well like I did.
class DDCApplication(Ui_DDCApp, AcrylicWindow):
themeChangedSignal = QtCore.Signal(str)
def __init__(self):
super().__init__()
self.setupUi(self)
self.setTitleBar(CustomTitleBar(self))
#self.windowEffect.setMicaEffect(self.winId(), isDarkMode=True, isAlt=False)
self.title = QLabel(self.titleBar)
self.title.setText(' DDC Desktop 2')
self.connectionStatusLabel = QPushButton(self.titleBar)
self.connectionStatusLabel.setText(' BLE not Connected')
self.connectionStatusLabel.setIcon(QPixmap('UI/resources/redlight.png'))
self.titleBar.layout().insertWidget(0, self.title, 0, QtCore.Qt.AlignLeft)
self.titleBar.layout().insertWidget(1, self.connectionStatusLabel, 4, QtCore.Qt.AlignCenter)
self.titleBar.layout().insertStretch(1, 1)
self.titleBar.raise_()
from pyqt-frameless-window.
Related Issues (20)
- Exception is thrown from __init__ of WindowsFramelessWindowsBase if multiple inheritance is used in a sub-class HOT 3
- [Bug]: Window cannot maximize as expected when system taskbar is not on the bottom. HOT 3
- 简中自述文件(已提交拉取请求无回应,先将中文文档贴在议题里) HOT 1
- 窗口关闭后显示在通知栏图标,然后再恢复窗口时,窗口边框消失,阴影消失,无法通过边框缩放窗口。 HOT 5
- 在窗口中嵌入QWebEngineView之后,窗口边框消失,阴影消失。 HOT 1
- 动态加载ui文件怎么使用无边框窗口 HOT 5
- 反馈一个小bug:始终在默认路径下建立存储文件。 HOT 3
- PySide2版本最右侧依然存在死区 HOT 5
- 希望窗口缩放区域判定和系统保持一致 HOT 2
- [Bug]: 在py312下,识别系统版本错误 HOT 1
- Rounded framless window with no shadow HOT 1
- QOpenGLWidget, QQuickWidget, QWebEngineView not working correctly HOT 1
- [Bug]: MacOS下启动FramelessWindow窗口后,首次单击标题栏会触发窗口最大化
- 采用pyside6-6.7.0版本后,windows下面会采用windows11的风格,菜单显示不全。 HOT 2
- [Bug]: 无边框对话框打开的一瞬间会显示最大,最小,关闭按钮 HOT 4
- Acrylic/Frameless Window on MAC does not update UI changes unless the window is resized
- [Bug]: Theme color display error
- pyqt5加载pyvistqt绘制图像,设置背景色不生效 HOT 1
- [Bug]: 从 Light 主题切换至 Dark 主题时窗口背景无法正常切换 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyqt-frameless-window.