def event(self, QEvent): if QEvent.type() == QtCore.QEvent.Enter: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setColor(QtGui.QColor('#6cccfc')) effect.setBlurRadius(20) effect.setOffset(0) self.setGraphicsEffect(effect) if QEvent.type() == QtCore.QEvent.Leave: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(10) effect.setOffset(0) self.setGraphicsEffect(effect) if QEvent.type() == QtCore.QEvent.MouseButtonDblClick: self.fullscreenNoteAction.emit(self.entity) if QEvent.type() == QtCore.QEvent.MouseButtonRelease: self.editNoteAction.emit(self.entity) effect = QtWidgets.QGraphicsDropShadowEffect() effect.setColor(QtGui.QColor('#6cccfc')) effect.setBlurRadius(20) effect.setOffset(0) return super(NotePreviewDescription, self).event(QEvent)
def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) #Se mueve la ventana a esas coordenadas self.move(150, 0) #Se establece un ancho y alto de la ventana definitivo self.setFixedSize(700, 500) #Conectamos el evento de los botones a las dos funciones de abajo self.inicio.clicked.connect(self.notes) self.opciones.clicked.connect(self.show_opciones) #Creamos las clases de las dos ventanas #Estas se abriran al presionar un boton self.notes = VentanaNotes() self.opciones_menu = Ventana_Opciones() #Sombre de el boton de inicio self.shadow_inicio = QtWidgets.QGraphicsDropShadowEffect() self.shadow_inicio.setBlurRadius(15) #Sombre de el boton de opciones self.shadow_opciones = QtWidgets.QGraphicsDropShadowEffect() self.shadow_opciones.setBlurRadius(15) #Agregamos las dos sombras a sus botones self.inicio.setGraphicsEffect(self.shadow_inicio) self.opciones.setGraphicsEffect(self.shadow_opciones)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(248, 90) self.disctop = QtWidgets.QApplication.desktop() Form.move(int(self.disctop.width() - 260), 380) Form.setAttribute(QtCore.Qt.WA_TranslucentBackground) Form.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(10, 10, 71, 71)) self.shadow = QtWidgets.QGraphicsDropShadowEffect() self.shadow.setBlurRadius(2) self.shadow.setColor(QtGui.QColor(0, 0, 0)) self.shadow.setOffset(5) self.pushButton.setGraphicsEffect(self.shadow) self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/Icons/Rests.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setIconSize(QtCore.QSize(80, 80)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtWidgets.QPushButton(Form) self.pushButton_2.setGeometry(QtCore.QRect(90, 10, 71, 71)) self.shadow_2 = QtWidgets.QGraphicsDropShadowEffect() self.shadow_2.setBlurRadius(2) self.shadow_2.setColor(QtGui.QColor(0, 0, 0)) self.shadow_2.setOffset(5) self.pushButton_2.setGraphicsEffect(self.shadow_2) self.pushButton_2.setCursor(QtGui.QCursor( QtCore.Qt.PointingHandCursor)) self.pushButton_2.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/Icons/sleep.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_2.setIcon(icon1) self.pushButton_2.setIconSize(QtCore.QSize(80, 80)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(Form) self.pushButton_3.setGeometry(QtCore.QRect(170, 10, 71, 71)) self.shadow_3 = QtWidgets.QGraphicsDropShadowEffect() self.shadow_3.setBlurRadius(2) self.shadow_3.setColor(QtGui.QColor(0, 0, 0)) self.shadow_3.setOffset(5) self.pushButton_3.setGraphicsEffect(self.shadow_3) self.pushButton_3.setCursor(QtGui.QCursor( QtCore.Qt.PointingHandCursor)) self.pushButton_3.setText("") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/Icons/Shuts.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_3.setIcon(icon2) self.pushButton_3.setIconSize(QtCore.QSize(80, 80)) self.pushButton_3.setObjectName("pushButton_3") self.retranslateUi(Form) self.pushButton.clicked.connect(self.rest_) self.pushButton_2.clicked.connect(self.Sleep_) self.pushButton_3.clicked.connect(self.Shuts_) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self): super(LoginLineEdit, self).__init__() # NOTE: # class configurations self.setStyleSheet('QLineEdit {\n' ' background: rgb(73, 73, 73);\n' ' color: white;\n' ' border: 0px solid white;\n' ' padding: 5px 10px;\n' ' margin: 10px 0px 0px 0px;\n' '}\n' 'QLineEdit:focus {\n' ' border: 0px solid white;\n' '}\n') self.setFont(QtGui.QFont('Arial', 12, 800)) # NOTE: # setting drop shadow effect self.shadow = QtWidgets.QGraphicsDropShadowEffect() self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QtGui.QColor(20, 20, 20)) self.setGraphicsEffect(self.shadow) # NOTE: # setting sizing self.setFixedWidth(400) self.setFixedHeight(55)
def __init__(self): super(Main, self).__init__() # Build the ui from ui converted file self.ui = Ui_Dialog() self.ui.setupUi(self) self.shadow = QtWidgets.QGraphicsDropShadowEffect() self.shadow.setBlurRadius(8) self.shadow.setColor(QtGui.QColor(0, 0, 0, 180)) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.setGraphicsEffect(self.shadow) self.create_user_widget = create_user_widget.Main() self.create_project_widget = create_project_widget.Main() self.server_info_widget = server_info_widget.Main() self.ui.welcome_main_widget_layout.addWidget(self.server_info_widget) self.server_info_widget.hide() self.server_info_widget.ui.ok_pushButton.clicked.connect(self.reject) self.ui.welcome_main_widget_layout.addWidget( self.create_project_widget) self.create_project_widget.project_openned.connect( self.add_server_info_widget) self.create_project_widget.hide() self.ui.welcome_main_widget_layout.addWidget(self.create_user_widget) self.create_user_widget.user_created.connect(self.add_project_widget) self.create_user_widget.hide() self.add_logos() self.need = 1 self.init_prefs()
def initUI(self): self.setWindowTitle(self.title) screenShape = QtWidgets.QDesktopWidget().screenGeometry() self.resize(screenShape.width(), screenShape.height()) widget = QtWidgets.QWidget() self.setCentralWidget(widget) self._title_label = QtWidgets.QLabel(self) self._title_label.setWordWrap(True) self._title_label.setStyleSheet("QLabel { color : white;}") self._title_label.setFont( QtGui.QFont("Sans Serif", self._title_font_size, QtGui.QFont.Bold)) drop_shadow = QtWidgets.QGraphicsDropShadowEffect() drop_shadow.setBlurRadius(20) drop_shadow.setColor(QtGui.QColor("#000000")) drop_shadow.setOffset(5, 5) self._title_label.setGraphicsEffect(drop_shadow) self._media_label = QtWidgets.QLabel(widget) self._media_label.setAlignment(QtCore.Qt.AlignCenter) self._media_label.resize(screenShape.width(), screenShape.height()) self._media_label.setStyleSheet("background-color:black;") main_layout = QtWidgets.QHBoxLayout(widget) main_layout.setContentsMargins(0, 0, 0, 0) main_layout.addWidget(self._title_label) main_layout.setAlignment(QtCore.Qt.AlignTop) self._media_label.showFullScreen() self.showFullScreen()
def __init__(self, parent): self.empty = True self.height = 16 self.value = (None, None, None) self.time = QtWidgets.QLabel() self.time.setStyleSheet('color: #999') self.user = QtWidgets.QLabel() self.message = QtWidgets.QLabel() self.message.setStyleSheet('color: white') self.message.setWordWrap(True) # This is telling it that the label can use the extra horizontal space, and can exand vertically as well self.message.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)) font = parent.font() for item in {self.time, self.user, self.message}: shadow = QtWidgets.QGraphicsDropShadowEffect() shadow.setBlurRadius(3) shadow.setOffset(1) shadow.setColor(QtGui.QColor(0, 0, 0)) item.setGraphicsEffect(shadow) item.setFont(font) item.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
def __init__(self, name_button=None, central=None, ud=None): self.name_button = name_button self.central = central self.ud = ud self.button_name = str(self.name_button.replace( ' ', '_').lower()) + "_button" self.button_basic = QtWidgets.QPushButton(self.central) self.button_basic.setGeometry(QtCore.QRect(140, 150, 91, 36)) font = QtGui.QFont() self.button_basic.setFont(font) self.button_basic.setStyleSheet( "QPushButton {\n" " border-radius: 4px;\n" " background-color: #ff4081;\n" " color: #ffffff;\n" " font-size: 14px;\n" " font-weight: 500;\n" " font-family: Roboto,Helvetica Neue,sans-serif;\n" "}") self.button_basic.setObjectName(self.button_name) self.button_basic.setText(self.name_button) self.shadow = QtWidgets.QGraphicsDropShadowEffect(self.central) self.shadow.setBlurRadius(10) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QtGui.QColor('black')) self.button_basic.setGraphicsEffect(self.shadow) self.button_basic.pressed.connect(lambda: self.pressButton()) self.button_basic.clicked.connect(lambda: self.clickButton())
def _flipAnimationClicked(self, event): self._flipCard() shadow = QtWidgets.QGraphicsDropShadowEffect(blurRadius=5, xOffset=0, yOffset=0) shadow.setColor(QtGui.QColor(211, 211, 211)) self._card_with_img.setGraphicsEffect(shadow)
def eventFilter(self, source, event): if (event.type() == QEvent.Enter): shadow = QtWidgets.QGraphicsDropShadowEffect(self, blurRadius=9.0, color=QtGui.QColor( 14, 168, 240,140), offset=QtCore.QPointF( 3.0, 3.0), ) if source==self.gui.startGameButton: self.gui.startGameButton.setGraphicsEffect(shadow) if (event.type() == QEvent.Leave): if source==self.gui.startGameButton: self.gui.startGameButton.setGraphicsEffect(None) if source==self.gui.hueslider or source==self.gui.satslider or source==self.gui.valueslider : self.gui.hsv_text.setText("H : "+str(self.gui.hueslider.value())+" , S: "+str(self.gui.satslider.value())+", V: "+str(self.gui.valueslider.value())) return QMainWindow.eventFilter(self, source, event)
def __init__(self, parent=None): super(Node, self).__init__(parent) self.title = "Node" self.width = 0 self.height = 0 self.x = 0 self.y = 0 self.inputPinData = [] self.outputPinData = [] self.inputWidgetData = [] self.inputWidgets = [] self.inputNodes = [] self.outputNodes = [] self.setAcceptHoverEvents(True) self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable) self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable) self.isBeingDragged = False self.previousMousePosition = QtCore.QPointF() self.dropShadow = QtWidgets.QGraphicsDropShadowEffect() self.dropShadow.setOffset(0,0) self.dropShadow.setColor(QtGui.QColor(0,0,0,180)) self.dropShadow.setBlurRadius(30) self.setGraphicsEffect(self.dropShadow) self.dropShadow.setEnabled(True)
def _initUI(self): # config layout layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout) layout.addSpacerItem(QtWidgets.QSpacerItem(100, 45)) # create displayer self._displayer = CalculatorDisplayer(parent=self) self._displayer.setObjectName("CalculatorDisplayer") self._displayer.setPrimaryContent(self._runtimeBasic.model.input) layout.addWidget(self._displayer) # create basic keyboard self._keyboardBasic = CalculatorKeyboard(parent=self) self._keyboardBasic.setObjectName("CalculatorKeyboardBasic") self._configKeyboard(self._runtimeBasic.getKeyboard(), self._keyboardBasic) layout.addWidget(self._keyboardBasic, 10) # create pro keyboard self._keyboardPro = CalculatorKeyboard(parent=self) self._keyboardBasic.setObjectName("CalculatorKeyboardPro") self._configKeyboard(self._runtimePro.getKeyboard(), self._keyboardPro) layout.addWidget(self._keyboardPro, 10) self._keyboardPro.hide() # config dropshadow dropshadowEffect = QtWidgets.QGraphicsDropShadowEffect(parent=self) dropshadowEffect.setOffset(0, 0) dropshadowEffect.setBlurRadius(config.WINDOW_DROPSHADOW_RADIUS) dropshadowEffect.setColor(config.WINDOW_DROPSHADOW_COLOR) self.setGraphicsEffect(dropshadowEffect)
def _get_highlight_effect(self): highlight_effect = QtWidgets.QGraphicsDropShadowEffect() highlight_effect.setColor(QtGui.QColor("white")) highlight_effect.setOffset(0) highlight_effect.setBlurRadius(200) self.highlight_effect = highlight_effect
def event(self, QEvent): if QEvent.type() == QtCore.QEvent.Enter: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setColor(QtGui.QColor('#6cccfc')) effect.setBlurRadius(10) effect.setOffset(0) self.setGraphicsEffect(effect) if QEvent.type() == QtCore.QEvent.Leave: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(5) effect.setOffset(0) self.setGraphicsEffect(effect) return super(SearchField, self).event(QEvent)
def enableShadow(self, offset = 3, radius = 9, color = 'black'): # Enable shadow for mainwidget with given features self.__effect = QtWidgets.QGraphicsDropShadowEffect(self) self.__effect.setBlurRadius(radius) self.__effect.setOffset(offset) self.__effect.setColor(QtGui.QColor(color)) self.setGraphicsEffect(self.__effect)
def __init__(self, entity): super(NotePreviewDescription, self).__init__() self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.setContentsMargins(0, 0, 0, 0) self.setFixedHeight(120) self.layout = QtWidgets.QGridLayout() self.layout.setAlignment(Qt.AlignTop) title = Title(entity.name) self.layout.addWidget(title, 0, 0, 1, 30) self.description = Description(entity.content) self.layout.addWidget(self.description, 1, 0, 2, 30) self.buttonClone = PictureButtonFlat(QtGui.QIcon("icons/copy")) self.buttonClone.clicked.connect(lambda x: self.cloneNoteAction.emit(entity)) self.layout.addWidget(self.buttonClone, 1, 30) self.buttonDelete = PictureButtonFlat(QtGui.QIcon("icons/trash")) self.buttonDelete.clicked.connect(lambda x: self.removeNoteAction.emit(entity)) self.layout.addWidget(self.buttonDelete, 2, 30) self.setLayout(self.layout) effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(10) effect.setOffset(0) self.setGraphicsEffect(effect) self.entity = entity
def __init__(self, name_field=None, central=None, ud=None): self.name_field = name_field self.central = central self.ud = ud self.button_name = str(self.name_field.replace( ' ', '_').lower()) + "_button" self.fabButton = QtWidgets.QPushButton(self.central) self.fabButton.setEnabled(True) self.fabButton.setGeometry(QtCore.QRect(140, 280, 56, 56)) self.fabButton.setStyleSheet( "QPushButton {\n" "background: #FF8A80; border-radius: 28; border: 0; outline:0;\n" "}") self.fabButton.setText("") self.icon_eye = QIconMaterial("visibility-24px.svg").iconSVG() self.fabButton.setIcon(self.icon_eye) self.fabButton.setIconSize(QtCore.QSize(24, 24)) self.fabButton.setObjectName(self.button_name) self.shadow = QtWidgets.QGraphicsDropShadowEffect(self.central) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QtGui.QColor('black')) self.fabButton.setGraphicsEffect(self.shadow) self.fabButton.pressed.connect(lambda: self.pressButton()) self.fabButton.clicked.connect(lambda: self.clickButton())
def launch_position_frameless_ontop_as_child(widget, title='Wizard'): widget.setWindowTitle(title) widget.setStyleSheet(load_stylesheet()) widget.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) widget.setAttribute(QtCore.Qt.WA_TranslucentBackground) win_size = (widget.frameSize().width(), widget.frameSize().height()) posx = QtGui.QCursor.pos().x() - 20 posy = int(QtGui.QCursor.pos().y()) - win_size[1] + 20 rect = QtWidgets.QDesktopWidget().screenGeometry() screen_1_h_bounds = [rect.x(), rect.x() + rect.width()] screen_1_v_bounds = [rect.y(), rect.y() + rect.height()] if posx + win_size[0] + 20 >= screen_1_h_bounds[-1]: posx = posx - win_size[0] + 40 if posy - 20 <= screen_1_v_bounds[0]: posy = posy + win_size[1] - 40 shadow = QtWidgets.QGraphicsDropShadowEffect() shadow.setBlurRadius(8) shadow.setColor(QtGui.QColor(0, 0, 0, 180)) shadow.setXOffset(0) shadow.setYOffset(0) widget.setGraphicsEffect(shadow) widget.show() widget.move(posx, posy)
def __init__(self, parent, width=300, height=170): super().__init__(parent) self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint) parent.installEventFilter(self) # Fancy design code self.setAutoFillBackground(True) self.setFrameStyle(QtWidgets.QFrame.Box | QtWidgets.QFrame.Plain) self.setLineWidth(1) p = self.palette() p.setColor(QtGui.QPalette.Window, p.window().color().lighter(105)) # Unbelievably this is used for the border... p.setColor(QtGui.QPalette.WindowText, Qt.darkGray) self.setPalette(p) effect = QtWidgets.QGraphicsDropShadowEffect() effect.setOffset(0, 0) effect.setBlurRadius(20) self.setGraphicsEffect(effect) # Resize and move to the correct position self.resize(width, height) pos = parent.mapToGlobal(QtCore.QPoint(0, self.parent().height())) self.move(pos) self._moveToScreen()
def hintEvent(hintButton, window): global _hintButtonBool effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(0) if not _hintButtonBool: effect.setColor(QtGui.QColor(0, 0, 0, 120)) effect.setOffset(-7, -7) hintButton.setGraphicsEffect(effect) hintButton.setGeometry(40, 770, 180, 45) _hintButtonBool = True if window.gameManager and window.gameManager.gameRuning is True: if window.gameManager.isPlayer1Turn: color = window.gameManager.player1.color else: color = window.gameManager.player2.color x, y = window.algoPointer( window.gameManager.gameBoard.grid, color, True, window.gameManager.player1.stoneRemovedCount, window.gameManager.player2.stoneRemovedCount) window.gameManager.gameBoard.dropHint(x, y, color) else: effect.setColor(QtGui.QColor(0, 0, 0, 90)) effect.setOffset(-10, -10) hintButton.setGraphicsEffect(effect) hintButton.setGeometry(40, 770, 200, 50) _hintButtonBool = False if window.gameManager: window.gameManager.gameBoard.clearHint() if window.gameManager is not None: window.gameManager.hintButtonBool = _hintButtonBool
def __init__(self, book=None, reader=None): super(PreviewWidget, self).__init__() self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.setContentsMargins(0, 0, 0, 0) self.setMinimumHeight(200) layout = QtWidgets.QVBoxLayout() layout.setAlignment(Qt.AlignTop) self.setLayout(layout) pixmap = QtGui.QPixmap('preview/preview.jpg') title = book.get_title() if title is not None and len(title): title = title if len(title) < self.limit else \ "{}...".format(title[0:self.limit]) title_label = QtWidgets.QLabel(title) self.layout().addWidget(title_label) cover = book.get_cover_image_content() if cover is not None: pixmap.loadFromData(cover) label = PreviewLabel(self, pixmap) label.clicked.connect(lambda x: self.book.emit(book)) self.layout().addWidget(label) effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(15) effect.setOffset(0) self.setGraphicsEffect(effect)
def getShadowEffect(): shadow = QtWidgets.QGraphicsDropShadowEffect() shadow.setBlurRadius(5) shadow.setColor(QColor(0, 0, 0, 64)) shadow.setOffset(0, 5) return shadow
def initUi(self): ''' :return: ''' self.setFixedHeight(100) self.setObjectName("Outer") self.setStyleSheet(""" QFrame {background-color: whitesmoke;} QFrame#Outer {border: 2px solid lightgray; border-radius: 8px;} """) # rgba(64, 64, 64, 1) effect = QtWidgets.QGraphicsDropShadowEffect() effect.setOffset(2, 2) effect.setBlurRadius(15) effect.setColor(QtGui.QColor("black")) self.setGraphicsEffect(effect) self.textArea = QtWidgets.QTextEdit() self.setLayout(QtWidgets.QVBoxLayout()) self.layout().addWidget(self.textArea) self.textArea.setStyleSheet(""" background-color: transparent; """)
def __init__(self, parent=None): QtWidgets.QMainWindow.__init__(self, parent) self.setupUi(self) ################### START BUTTON ################### self.startButton_2.clicked.connect(self.start_clicked) self.startShadow = QtWidgets.QGraphicsDropShadowEffect(self) self.startShadow.setColor(QtGui.QColor(0, 0, 0, 60)) self.startShadow.setXOffset(0) self.startShadow.setYOffset(2) self.startShadow.setBlurRadius(12) self.startButton_2.setGraphicsEffect(self.startShadow) self.window_width = self.ImgWidget.frameSize().width() self.window_height = self.ImgWidget.frameSize().height() self.ImgWidget = OwnImageWidget(self.ImgWidget) self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.update_frame) self.timer.start() # self.show = QtCore.QTimer(self) # self.show.timeout.connect(self.showAccelero) # self.show.start() if self.startButton_2.isDown() == False: self.KONDISI.setVisible(False)
def add_shadow(self): # 添加阴影 self.effect_shadow = QtWidgets.QGraphicsDropShadowEffect(self) self.effect_shadow.setOffset(0, 0) # 偏移 self.effect_shadow.setBlurRadius(20) # 阴影半径 self.effect_shadow.setColor(QtCore.Qt.darkGray) # 阴影颜色 self.main_widget.setGraphicsEffect( self.effect_shadow) # 将设置套用到widget窗口中
def enable_drop_shadow(self): """Enables dropshadows to every suitable QWidget""" for widget in self.centralwidget.findChildren(QtWidgets.QWidget): effect = QtWidgets.QGraphicsDropShadowEffect() effect.setBlurRadius(0) effect.setColor(QtGui.QColor(0, 0, 0, 64)) effect.setOffset(1.5, 1.5) widget.setGraphicsEffect(effect)
def __init__(self, parent): super(RentPage, self).__init__() self.parent = parent self.current_theme = self.parent.current_theme self.current_font = self.parent.current_font self.current_sf = self.parent.current_sf self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.setWidgetResizable(True) self.fileName = None self.current_theme = self.parent.current_theme self.current_font = self.parent.current_font self.current_sf = self.parent.current_sf self.shadow = QtWidgets.QGraphicsDropShadowEffect() self.shadow.setBlurRadius(30) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QtGui.QColor(20, 20, 20)) self.uploadPage = UploadPage(self) self.rentalTypePage = RentalTypePage(self) self.leasersListPage = LeasersListPage(self) self.success = SuccessfulRequest(self) # self.uploadPage.hide() self.rentalTypePage.hide() self.leasersListPage.hide() self.success.hide() self.widget = QWidget(self) self.widget.setContentsMargins(0, 0, 0, 0) layout = QVBoxLayout() layout.addWidget(self.uploadPage) layout.addWidget(self.rentalTypePage) layout.addWidget(self.leasersListPage) layout.addWidget(self.success) layout.setContentsMargins(0, 0, 0, 0) layout.setAlignment(QtCore.Qt.AlignTop) layout.setSpacing(30) self.widget.setLayout(layout) self.widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.setWidget(self.widget) self.setContentsMargins(0, 0, 0, 0) self.setStyleSheet( 'background: transparent;\n' 'border: 0px solid white;\n') if (self.current_theme == 'Dark'): self.darkTheme() elif (self.current_theme == 'Light'): self.lightTheme() else: self.classicTheme()
def __init__(self, parent): super(EmptyRequest, self).__init__() self.parent = parent self.current_theme = self.parent.current_theme self.current_font = self.parent.current_font self.current_sf = self.parent.current_sf self.setStyleSheet('background: rgb(70, 70, 70);\n' 'color: white;\n' 'border: 0px solid rgb(100, 100, 100);\n') self.setFixedHeight(200) self.requestLabel = QLabel(self) self.requestLabel.setText('You have no new requests') self.requestLabel.setFont( QtGui.QFont(self.current_font, int(self.current_sf * 24), 800)) self.requestLabel.adjustSize() self.requestLabel.setStyleSheet('background: transparent;\n' 'color: white;\n' 'font-weight: bold;\n' 'border: 0px solid white;\n') self.requestLabel.setAlignment(QtCore.Qt.AlignCenter) self.shadow = QtWidgets.QGraphicsDropShadowEffect() self.shadow.setBlurRadius(30) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QtGui.QColor(30, 30, 30)) layout = QHBoxLayout() layout.addWidget(self.requestLabel, alignment=QtCore.Qt.AlignHCenter) layout.setAlignment(QtCore.Qt.AlignVCenter) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.widget = QWidget(self) self.widget.setLayout(layout) self.widget.setContentsMargins(0, 0, 0, 0) self.widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.layout = QVBoxLayout() self.layout.addWidget(self.widget) self.layout.setAlignment(QtCore.Qt.AlignTop) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self.setContentsMargins(0, 0, 0, 0) self.setGraphicsEffect(self.shadow) if (self.current_theme == 'Dark'): self.darkTheme() elif (self.current_theme == 'Light'): self.lightTheme() else: self.classicTheme()
def text_add_shadow(self): share_url_shadow = QtWidgets.QGraphicsDropShadowEffect() share_url_shadow.setBlurRadius(4) share_url_shadow.setColor(QtGui.QColor('red')) share_url_shadow.setOffset(0) self.label_share_url.setGraphicsEffect(share_url_shadow) dl_path_shadow = QtWidgets.QGraphicsDropShadowEffect() dl_path_shadow.setBlurRadius(4) dl_path_shadow.setColor(QtGui.QColor('green')) dl_path_shadow.setOffset(0) self.label_dl_path.setGraphicsEffect(dl_path_shadow) disk_loc_shadow = QtWidgets.QGraphicsDropShadowEffect() disk_loc_shadow.setBlurRadius(5) disk_loc_shadow.setColor(QtGui.QColor('white')) disk_loc_shadow.setOffset(0) self.label_disk_loc.setGraphicsEffect(disk_loc_shadow)
def event(self, QEvent): if QEvent.type() == QtCore.QEvent.Enter: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setColor(QtGui.QColor('#6cccfc')) effect.setBlurRadius(20) effect.setOffset(0) self.setGraphicsEffect(effect) if QEvent.type() == QtCore.QEvent.Leave: self.setGraphicsEffect(None) if QEvent.type() == QtCore.QEvent.MouseButtonRelease: effect = QtWidgets.QGraphicsDropShadowEffect() effect.setColor(QtGui.QColor('#6cccfc')) effect.setBlurRadius(20) effect.setOffset(0) return super(PictureButton, self).event(QEvent)