Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. how to make background image not overlapped in other frames?
Forum Updated to NodeBB v4.3 + New Features

how to make background image not overlapped in other frames?

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 355 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kzya
    wrote on last edited by
    #1

    0

    im making an ui using qtdesigner. im put one background image and put another frame on it expecting the frame to be transparent but it rather has the same background image as the other frame. since stackoverflow imagelink doesnt work im leaving link here. image (https://i.imgur.com/4AmqsM2.png). i want the frame in the red square to be transparent. so how do i do that?

    # -*- coding: utf-8 -*-
    
    ################################################################################
    ## Form generated from reading UI file 'testVQBnYA.ui'
    ##
    ## Created by: Qt User Interface Compiler version 5.15.2
    ##
    ## WARNING! All changes made in this file will be lost when recompiling UI file!
    ################################################################################
    
    from PySide2.QtCore import *
    from PySide2.QtGui import *
    from PySide2.QtWidgets import *
    
    import df_rc
    
    class Ui_MainWindow(object):
        def setupUi(self, MainWindow):
            if not MainWindow.objectName():
                MainWindow.setObjectName(u"MainWindow")
            MainWindow.resize(607, 534)
            MainWindow.setStyleSheet(u"")
            self.centralwidget = QWidget(MainWindow)
            self.centralwidget.setObjectName(u"centralwidget")
            self.centralwidget.setStyleSheet(u"\n"
    "background-image:  url(:/newPrefix/\ubc30\uacbd.jpg); \n"
    "background-repeat: no-repeat;\n"
    "")
            self.widget_1 = QWidget(self.centralwidget)
            self.widget_1.setObjectName(u"widget_1")
            self.widget_1.setGeometry(QRect(120, 90, 181, 231))
            self.widget_1.setStyleSheet(u"background-color: rgb(255, 255, 255);")
            MainWindow.setCentralWidget(self.centralwidget)
    
            self.retranslateUi(MainWindow)
    
            QMetaObject.connectSlotsByName(MainWindow)
        # setupUi
    
        def retranslateUi(self, MainWindow):
            MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
        # retranslateUi
    
    1 Reply Last reply
    0
    • I Offline
      I Offline
      IvanIsLearning
      wrote on last edited by
      #2

      Don't know qtdesigner, but this may give you a clue:

      self.setWindowFlag(Qt.FramelessWindowHint)
      self.setAttribute(Qt.WA_TranslucentBackground, True)
      

      This is how I make my widget's background transparent in PySide6.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved