Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Titelbar of QDockWidgets #261

Open
sennah-github opened this issue Jul 21, 2024 · 0 comments
Open

Titelbar of QDockWidgets #261

sennah-github opened this issue Jul 21, 2024 · 0 comments

Comments

@sennah-github
Copy link

This stripped down code creates a QApplication containing a QDockWidget:

from PyQt6 import QtWidgets, QtGui
from PyQt6.QtWidgets import QApplication, QMainWindow, QDockWidget, QWidget, QVBoxLayout, QWidget, QPlainTextEdit
from PyQt6.QtCore import Qt, QSettings, QByteArray

class myQWidget(QWidget):
    def __init__(self, name = "Widget"):
        super().__init__()
        self.setObjectName (name)
        self.layout = QVBoxLayout()
        self.line_edit = QPlainTextEdit(name)
        ### INIT ###
        self.layout.addWidget(self.line_edit)
        self.setLayout(self.layout)

class myQDockWidget(QDockWidget):
    def __init__(self, title = "", name = "DockWidget"):
        super().__init__()
        self.setObjectName(name)
        self.widget = myQWidget(name)
        ### INIT ###
        self.setWindowTitle(title)
        self.setWidget(self.widget)

if __name__ == "__main__":
    class MainWindow(QMainWindow):
        def __init__(self):
            super().__init__()
            self.setObjectName("MyMainWindow")
            self.widget = myQWidget(name="My Widget")
            self.dock_widget = myQDockWidget(title= "My Dock Widget", name = "MyDockWidget")
            ### INIT ###
            self.setCentralWidget(self.widget)
            self.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self.dock_widget)
            self.dock_widget.setAllowedAreas(Qt.DockWidgetArea.RightDockWidgetArea|Qt.DockWidgetArea.LeftDockWidgetArea)
            self.setWindowTitle("My Main Window")

    import sys
    import qdarktheme
    app = QApplication(sys.argv)
    qdarktheme.setup_theme("auto")
    app.ObjectName = "My App"
    window = MainWindow()
    window.show()
    sys.exit(app.exec())

As you can see the title bar of the QDockWidget (Title: "My Dock Widget") is to big.
How can I make it thinner and the two icons smaller?

Here's a screen shot of the sample supplied with the PyQtDarktheme module and my small app on top:

Unbenannt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant