fixed resize event
parent
b7018e1a73
commit
0f3e9b0689
|
@ -1,4 +1,4 @@
|
||||||
from PySide6 import QtWidgets
|
from PySide6 import QtWidgets, QtCore, QtGui
|
||||||
import util
|
import util
|
||||||
|
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
|
@ -56,18 +56,26 @@ class Editor(Window):
|
||||||
def __init__(self, size=(640, 480)):
|
def __init__(self, size=(640, 480)):
|
||||||
super().__init__(size, "Editor")
|
super().__init__(size, "Editor")
|
||||||
|
|
||||||
|
#TODO: Figure out a way to do the fucking line numbers
|
||||||
|
|
||||||
#Text Editor
|
#Text Editor
|
||||||
self.text_edit = QtWidgets.QPlainTextEdit(self)
|
self.text_edit = QtWidgets.QPlainTextEdit(self)
|
||||||
self.text_edit.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
self.text_edit.setFrameStyle(QtWidgets.QFrame.NoFrame)
|
||||||
self.set_size(size[1], size[0])
|
|
||||||
|
self.set_size(size[0], size[1])
|
||||||
|
|
||||||
#layout
|
#layout
|
||||||
layout = QtWidgets.QHBoxLayout()
|
layout = QtWidgets.QHBoxLayout()
|
||||||
layout.addChildWidget(self.text_edit)
|
layout.addChildWidget(self.text_edit)
|
||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
def resizeEvent(self, event):
|
||||||
|
self.set_size(event.size().width(), event.size().height())
|
||||||
|
|
||||||
def set_size(self, size_x, size_y):
|
def set_size(self, size_x, size_y):
|
||||||
self.text_edit.resize(size_x, size_y)
|
self.text_edit.resize(size_x, size_y)
|
||||||
|
self.resize(size_x, size_y)
|
||||||
|
|
||||||
|
|
||||||
class Message(QtWidgets.QMessageBox):
|
class Message(QtWidgets.QMessageBox):
|
||||||
|
|
Reference in New Issue