def resizeEvent(self, a0: QtGui.QResizeEvent): if a0.oldSize() != QtCore.QSize(-1,-1): width = a0.size().width() - a0.oldSize().width() height = a0.size().height() - a0.oldSize().height() # размеры представлений w = self.ui.context_view.width() h = self.ui.context_view.height() # изменение размеров представлений self.ui.context_view.resize(w + width/3, h + height) self.ui.message_view.setGeometry(w + width/3 + 50, 70, w + width/3, h + height) # кнопки для работы с представлениями self.ui.context_viewTools.setGeometry(w + width / 3, 70, 40, 170) self.ui.message_viewTools.setGeometry(2 * w + 2 *width / 3 + 50, 70, 40, 170) # окна редактирования сообщения w_boxes = self.ui.source_editBox.width() h_boxes = self.ui.source_editBox.height() self.ui.source_editBox.setGeometry(2*w + 100 + 2 * width/3, 60, w_boxes + width/3, h_boxes + height/3) w_editors = self.ui.sourceText.width() h_editors = self.ui.sourceText.height() self.ui.sourceText.resize(w_editors + width/3, h_editors + height / 3) self.ui.ru_transText.resize(w_editors + width/3, h_editors + height / 3) self.ui.en_transText.resize(w_editors + width/3, h_editors + height / 3) self.ui.btChange_source.setGeometry(w_boxes + width/3 - 120, h_boxes + height/3 - 40, 93, 28) self.ui.btChange_rus.setGeometry(w_boxes + width/3 - 120, h_boxes + height/3 - 40, 93, 28) self.ui.btChange_eng.setGeometry(w_boxes + width/3 - 120, h_boxes + height/3 - 40, 93, 28) self.ui.ru_transBox.setGeometry(2 * w + 100 + 2 * width / 3, 90 + h_boxes + height / 3, w_boxes + width / 3, h_boxes + height / 3) self.ui.en_transBox.setGeometry(2 * w + 100 + 2 * width / 3, 120 + h_boxes * 2 + height * 2 /3, w_boxes + width / 3, h_boxes + height / 3) # поиск сообщения self.ui.search_message.setGeometry(w + width/3 + 50, -1, 430, 51) self.ui.btLoad.setGeometry(a0.size().width() - 256, 20, 100, 30) self.ui.btSave.setGeometry(a0.size().width() - 136, 20, 100, 30) self.ui.line_2.resize(2 * w + 2 * width/3 + 101, 20) self.ui.line.setGeometry(2 * w + 2 * width / 3 + 82, 60, 20, h + height + 10)
def resizeEvent(self, event: QtGui.QResizeEvent) -> None: super().resizeEvent(event) self.update() x, y = self.manager.grid_manager.zero_point_dot.get_pos() x -= self.manager.grid_manager.zero_point_dot.get_zero()[0] y -= self.manager.grid_manager.zero_point_dot.get_zero()[1] new_x, new_y = event.size().width() // 2, event.size().height() // 2 [ widget.move_event( widget.x() + new_x - self.manager.grid_manager.zero_point_dot.get_zero()[0], widget.y() + new_y - self.manager.grid_manager.zero_point_dot.get_zero()[1], show_pos=False) for widget in self.manager.widget_manager.get_all_widgets() ] self.manager.grid_manager.set_new_zero_point_pos(new_x, new_y) self.manager.grid_manager.zero_point_dot.move_event( new_x + x, new_y + y) self.manager.grid_manager.grid.set_offset_by_zero_point() self.manager.grid_manager.grid.generate_grid() self.manager.grid_manager.grid.change_core_size( event.size().width(), event.size().height()) self.manager.settings_window.set_geometry() self.manager.settings_window.update_obj_settings(self) self.update()
def resizeEvent(self, a0: QtGui.QResizeEvent, min_size=512): super(cQLabel, self).resizeEvent(a0) stored_pixmap = self.stored_pixmap if stored_pixmap is not None: # avoiding image degradation stored_pixmap = stored_pixmap.copy() # defining increase dimension dw = a0.size().width() - a0.oldSize().width() dh = a0.size().height() - a0.oldSize().height() # choosing AspectRatio behaviour AspectRatioMode = QtCore.Qt.KeepAspectRatio if (dw > 0) or (dh > 0): AspectRatioMode = QtCore.Qt.KeepAspectRatioByExpanding # behaviour in case of image maximum extension if ((self.pixmap().width()+dw) >= self.width()-15) or ((self.pixmap().height()+dh) >= self.height()-15): dw = -1 dh = -1 # defining new width (nw) and new height (nh) nw = self.pixmap().width() + dw nh = self.pixmap().height() + dh # drawing image self.setPixmap(stored_pixmap.scaled(nw, nh, AspectRatioMode, QtCore.Qt.SmoothTransformation), False) # avoiding image smaller than min_size (according to orientation) if (self.pixmap().width() > self.pixmap().height()): if (self.pixmap().width() < min_size): AspectRatioMode = QtCore.Qt.KeepAspectRatioByExpanding nh = max(nh, 1) # avoiding zero height self.setPixmap(stored_pixmap.scaled(min_size, nh, AspectRatioMode, QtCore.Qt.SmoothTransformation), False) else: if (self.pixmap().height() < min_size): AspectRatioMode = QtCore.Qt.KeepAspectRatioByExpanding nw = max(nw, 1) # avoiding zero width self.setPixmap(stored_pixmap.scaled(nw, min_size, AspectRatioMode, QtCore.Qt.SmoothTransformation), False)
def resizeEvent(self, evt: QtGui.QResizeEvent) -> None: if self.__init_done and self.isVisible(): self.set_session_values({ 'w': evt.size().width(), 'h': evt.size().height() }) super().resizeEvent(evt)
def resizeEvent(self, event: QtGui.QResizeEvent): super().resizeEvent(event) width = event.size().width() height = event.size().height() oldWidth = event.oldSize().width() oldHeight = event.oldSize().height() if self.onResize: self.onResize(width, height, oldWidth, oldHeight)
def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: if not self.isPopout: self.setFixedWidth(a0.size().height()) self.chartWidth = a0.size().height() - 40 self.chartHeight = a0.size().height() - 40 else: min_dimension = min(a0.size().height(), a0.size().width()) self.chartWidth = self.chartHeight = min_dimension - 40 self.update()
def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: super().resizeEvent(a0) size = a0.size() old_size = a0.oldSize() if self.inited: self.settings.setValue(self.settings.SIZE, a0.size()) self.settings.setValue(self.settings.FULLSCREEN, self.isFullScreen()) Utils.print_debug(f"{size} {old_size}")
def resizeEvent(self, event: QtGui.QResizeEvent): # 重写resizeEvent, 使背景图案可以根据窗口大小改变 QtWidgets.QWidget.resizeEvent(self, event) palette = QtGui.QPalette() palette.setBrush(QtGui.QPalette.Window, QtGui.QBrush(self.background.scaled(event.size()))) self.setPalette(palette)
def resizeEvent(self, e: QResizeEvent): """ 窗口调整大小时 """ # 计算宽度的差值 deltaWidth = e.size().width() - e.oldSize().width() super().resizeEvent(e) self.__adjustLabelPos() self.__adjustButtonPos(deltaWidth >= 0)
def resizeEvent(self, e: QResizeEvent): # self.fitInView(QRectF(0, 0, e.size().height(), e.size().width()), Qt.IgnoreAspectRatio) os = e.oldSize() ns = e.size() if (os.height(), os.width()) == (-1, -1): os = ns self.scale(ns.width() / os.width(), ns.height() / os.height())
def event(self, event): if event.type() == QEvent.Resize: w = QResizeEvent.size(event) try: self.container.resize(w.width(), w.height()) except: pass return True
def resizeEvent(self, event: QResizeEvent): old_width, new_width = max(1, event.oldSize().width()), max(1, event.size().width()) super().resizeEvent(event) self.on_slider_y_scale_value_changed() # Force update of GVS, when size changed e.g. when Project Tree is opened if not self.spectrogram_is_active: self.ui.gvSignal.zoom(new_width / old_width, zoom_to_mouse_cursor=False)
def event(self, event): if event.type() == QEvent.Resize: w = QResizeEvent.size(event) try: self.container.resize(w.width(), w.height()) except: pass return True
def resizeEvent(self, event: QtGui.QResizeEvent): """An override for QMainWindow's default resizeEvent. This override is responsible for processing resize events and saving it to the settings file.""" size: QtCore.QSize = event.size() self.settings['system']['window']['width'].value = size.width() self.settings['system']['window']['height'].value = size.height()
def updateGlobalSize(self, newSize: QtGui.QResizeEvent): """update the size of the layout""" verticalMargins = self.contentsMargins().top() + self.contentsMargins( ).bottom() verticalSpan = int( (newSize.size().height() - (self.rowNumber - 1) * self.verticalSpacing() - verticalMargins) // self.rowNumber) horizontalMargins = self.contentsMargins().left( ) + self.contentsMargins().right() horizontalSpan = int( (newSize.size().width() - (self.columnNumber - 1) * self.horizontalSpacing() - horizontalMargins) // self.columnNumber) self.verticalSpan = max(verticalSpan, self.minVerticalSpan) self.horizontalSpan = max(horizontalSpan, self.minHorizontalSpan) self.__updateAllTiles()
def resize_event(self, event: QResizeEvent): """ resizeEvent of filesList, to change width of columns :param event: :return: """ old_w = event.oldSize().width() w = event.size().width() if not old_w == w: self.change_data_signal.emit('Resize columns')
def resizeEvent(self, event: QResizeEvent): if math.trunc(event.size().width() / float(rt(SEARCH_APP_WIDTH))) != self.items_per_row: col = 0 row = 0 self.items_per_row = math.trunc(self.dialog.size().width() / float(rt(SEARCH_APP_WIDTH))) for widget in self.apps: if col == self.items_per_row: col = 0 row += 1 widget.ui.parentWidget().layout().removeWidget(widget.ui) self.ui.search_result_area.layout().addWidget( widget.ui, row, col, 1, 1) col += 1 QDialog.resizeEvent(self.dialog, event)
def resizeEvent(self, evnt: QResizeEvent): new_width = evnt.size().width() if not self.isFullScreen(): self.resize(new_width, 30) big_font.setPointSize(new_width * 40 / 1920) small_font.setPointSize(new_width * 25 / 1920) global big_font_metrics global small_font_metrics big_font_metrics = QFontMetrics(big_font) small_font_metrics = QFontMetrics(small_font) for lbl in big_fonts: lbl.setFont(big_font) for lbl in small_fonts: lbl.setFont(small_font) for depw in self.departure_widgets: depw.recalc_widths() self.update()
def eventFilter(self, obj, event): # might be useful events to know # 103 window blocked by modal dialog # 99 activation changed # 25 deactivated # 24 activated #print event,'parent',self.parent #print event,'Event Type',self.event.type() if obj == self.parent: #Catches resize and child events from the parent widget if event.type() == QEvent.Resize: #print 'resize' self.resize(QResizeEvent.size(event)) #elif event.type() == QEvent.Move: #self.move(QMoveEvent.pos(event)) elif(event.type() == QEvent.ChildAdded): #print 'CHILD',QChildEvent.child(event) if not QChildEvent.child(event) is QDialog: self.raise_() if event.type() == QEvent.Close: self.hide() self.closeEvent(event) event.accept() return super(OverlayWidget, self).eventFilter(obj, event)
def eventFilter(self, obj, event): # might be useful events to know # 103 window blocked by modal dialog # 99 activation changed # 25 deactivated # 24 activated #print event,'parent',self.parent #print event,'Event Type',self.event.type() if obj == self.parent: #Catches resize and child events from the parent widget if event.type() == QEvent.Resize: #print 'resize' self.resize(QResizeEvent.size(event)) elif event.type() == QEvent.Move: self.move(QMoveEvent.pos(event)) elif(event.type() == QEvent.ChildAdded): #print 'CHILD',QChildEvent.child(event) if not QChildEvent.child(event) is QDialog: self.raise_() if event.type() == QEvent.Close: self.hide() self.closeEvent(event) event.accept() return super(OverlayWidget, self).eventFilter(obj, event)
def resizeEvent(self, a0: QtGui.QResizeEvent): #缩放窗口事件! new_width = max(int(a0.size().width() * 1 / 3), 150) # self.right_widget.setFixedWidth(new_width) self.plot_Track.setFixedWidth(new_width)
def resizeEvent(self, a0: QResizeEvent) -> None: self.resize.emit(a0.size())
def resizeEvent(self, event: QtGui.QResizeEvent): w, h = event.size().width(), event.size().height() self._resize(w, h)
def resize(self, event: QResizeEvent, window: QWidget) -> None: if window is self._current_window: self._size = event.size()
def resizeEvent(self, event: QResizeEvent) -> NoReturn: w_diff = event.size().width() - event.oldSize().width() h_diff = event.size().height() - event.oldSize().height() self.__h_scroll_bar.setValue(self.__h_scroll_bar.value() - w_diff / 2) self.__v_scroll_bar.setValue(self.__v_scroll_bar.value() - h_diff / 2)
def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: self.chartWidth = a0.size().width( ) - self.rightMargin - self.leftMargin self.chartHeight = a0.size().height( ) - self.bottomMargin - self.topMargin self.update()
def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: self.chartWidth = a0.size().width() - 20 - self.leftMargin self.chartHeight = min(a0.size().width() - 40, a0.size().height() - 40) self.update()
def resizeEvent(self, event: QtGui.QResizeEvent) -> None: super().resizeEvent(event) self.window_width = event.size().width() self.window_height = event.size().height()
def resizeEvent(self, event: QtGui.QResizeEvent) -> None: self.plot.resize(event.size())
def resizeEvent(self, event: QResizeEvent) -> None: super().resizeEvent(event) for win in self.children(): if win.objectName() == "GreyedDialog": win.resize(event.size()) win.move(0, 0)
def resizeEvent(self, ev: QResizeEvent): if ev is not None: size = ev.size() self.image_layout.setFixedHeight(min(size.height() * 0.7, self.ALLOWED_HEIGHT)) super().resizeEvent(ev)
def resizeEvent(self, event: QtGui.QResizeEvent): self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTH, event.size().width() - self.marginWidth(1)- self.marginWidth(0)) return super(Editor, self).resizeEvent(event)
def event(self, event): if event.type() == QEvent.Resize: w = QResizeEvent.size(event) self.gremlin.set_size_request( w.width(), w.height()) #self.resize(QResizeEvent.size(event)) return True
def resizeEvent(self, event: QtGui.QResizeEvent): delta: QSize = (event.size() - event.oldSize()) if hasattr(self, 'chart_item'): self.model.change_x_range(delta.width()) super().resizeEvent(event)
def canvasResizeEvent(self, ev : QResizeEvent): oldSize = ev.oldSize() newSize = ev.size() if oldSize.width() != newSize.width(): self.updateLayout(newSize.width())