Skip to content

Instantly share code, notes, and snippets.

@namuan
Created March 12, 2023 18:27
Show Gist options
  • Save namuan/e3b94a3dba2be1ce833363b55366cec3 to your computer and use it in GitHub Desktop.
Save namuan/e3b94a3dba2be1ce833363b55366cec3 to your computer and use it in GitHub Desktop.
PyQt5 -> PyQt6
./venv/bin/pyuic5 -> ./venv/bin/pyuic6
search_replace "PyQt5==5.12.3" "PyQt6==6.4.2"
search_replace "\.exec_ " ".exec"
search_replace "QStandardPaths.DocumentsLocation" "QStandardPaths.StandardLocation.DocumentsLocation"
search_replace "qApp." "QApplication.instance()."
search_replace "qApp" "QApplication"
search_replace "QStandardPaths.AppConfigLocation" "QStandardPaths.StandardLocation.AppConfigLocation"
search_replace "QSettings.IniFormat" "QSettings.Format.IniFormat"
search_replace "QtCore.QEvent.FocusOut" "QtCore.QEvent.Type.FocusOut"
search_replace "Qt.CustomContextMenu" "Qt.ContextMenuPolicy.CustomContextMenu"
search_replace "Qt.white" "Qt.GlobalColor.white"
search_replace "Qt.black" "Qt.GlobalColor.black"
search_replace "Qt.AlignLeft" "Qt.AlignmentFlag.AlignLeft"
search_replace "Qt.AlignTop" "Qt.AlignmentFlag.AlignTop"
search_replace "QStyle.State_Selected" "QStyle.StateFlag.State_Selected"
search_replace "QPainter.Antialiasing" "QPainter.RenderHint.Antialiasing"
search_replace "Qt.ElideRight" "Qt.TextElideMode.ElideRight"
search_replace "Qt.TextWordWrap" "Qt.TextFlag.TextWordWrap"
search_replace "Qt.ElideMiddle" "Qt.TextElideMode.ElideMiddle"
search_replace "QFile.ReadOnly" "QFile.OpenModeFlag.ReadOnly"
search_replace "QFile.Text" "QFile.OpenModeFlag.Text"
search_replace "Qt.TopToolBarArea" "Qt.ToolBarArea.TopToolBarArea"
search_replace "QSizePolicy.MinimumExpanding" "QSizePolicy.Policy.MinimumExpanding"
search_replace "QSizePolicy.Expanding" "QSizePolicy.Policy.Expanding"
search_replace "QItemSelectionModel.Select" "QItemSelectionModel.SelectionFlag.Select"
search_replace "QItemSelectionModel.Deselect" "QItemSelectionModel.SelectionFlag.Deselect"
search_replace "QtCore.Qt.LeftButton" "QtCore.Qt.MouseButton.LeftButton"
search_replace "QDialogButtonBox.Ok" "QDialogButtonBox.StandardButton.Ok"
search_replace "QDialogButtonBox.Cancel" "QDialogButtonBox.StandardButton.Cancel"
search_replace "Qt.Key_Escape" "Qt.Key.Key_Escape"
search_replace "Qt.UserRole" "Qt.ItemDataRole.UserRole"
search_replace "Qt.Dialog" "QtCore.Qt.WindowType.Dialog"
search_replace "Qt.WindowCloseButtonHint" "QtCore.Qt.WindowType.WindowCloseButtonHint"
Qt.UserRole -> Qt.ItemDataRole.UserRole
Qt.AlignHCenter -> Qt.AlignmentFlag.AlignHCenter
QHeaderView.Stretch -> QHeaderView.ResizeMode.Stretch
Qt.AlignCenter -> Qt.AlignmentFlag.AlignCenter
Qt.AlignVCenter -> Qt.AlignmentFlag.AlignVCenter
QHeaderView.Stretch -> QHeaderView.ResizeMode.Stretch
QHeaderView.ResizeToContents -> QHeaderView.ResizeMode.ResizeToContents
QHeaderView.Fixed -> QHeaderView.ResizeMode.Fixed
Qt.DisplayRole -> Qt.ItemDataRole.DisplayRole
Qt.ItemIsEditable -> Qt.ItemFlag.ItemIsEditable
Qt.CaseInsensitive -> Qt.CaseSensitivity.CaseInsensitive
Qt.MatchContains -> Qt.MatchFlag.MatchContains
QCompleter.PopupCompletion -> QCompleter.CompletionMode.PopupCompletion
QLineEdit.PasswordEchoOnEdit -> QLineEdit.EchoMode.PasswordEchoOnEdit
QDialog.Accepted -> QDialog.DialogCode.Accepted
Qt.OtherFocusReason -> Qt.FocusReason.OtherFocusReason
Qt.Key_Dollar -> Qt.Key.Key_Dollar
QLineEdit.Normal -> QLineEdit.EchoMode.Normal
QTextCursor.KeepAnchor -> QTextCursor.MoveOperation.KeepAnchor
Qt.Key_Dollar -> Qt.Key.Key_Dollar
Qt.Popup -> QtCore.Qt.WindowType.Popup
Qt.FramelessWindowHint -> QtCore.Qt.WindowType.FramelessWindowHint
QtCore.Qt.ItemIsEditable -> QtCore.Qt.ItemFlag.ItemIsEditable
QTextCursor.Start -> QTextCursor.MoveOperation.Start
QSizePolicy.Preferred -> QSizePolicy.Policy.Preferred
QSizePolicy.Fixed -> QSizePolicy.Policy.Fixed
QFileDialog.DontUseNativeDialog -> QFileDialog.Option.DontUseNativeDialog
QSizePolicy.Minimum -> QSizePolicy.Policy.Minimum
QtCore.Qt.IBeamCursor -> QtCore.Qt.CursorShape.IBeamCursor
font_db = QFontDatabase()
font_db.addApplicationFont(":/fonts/JetBrainsMono-Regular.ttf")
-> QFontDatabase.addApplicationFont((":/fonts/JetBrainsMono-Regular.ttf"))
Qt.Dialog -> QtCore.Qt.WindowType.Dialog
Qt.WindowCloseButtonHint -> QtCore.Qt.WindowType.WindowCloseButtonHint
QNetworkReply.NoError -> QNetworkReply.NetworkError.NoError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment