[main] Initial code
This commit is contained in:
		
							parent
							
								
									87893febac
								
							
						
					
					
						commit
						8588eda3ce
					
				
							
								
								
									
										0
									
								
								src/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										14
									
								
								src/app.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/app.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | import sys | ||||||
|  | from PySide6.QtGui import QGuiApplication | ||||||
|  | from PySide6.QtQml import QQmlApplicationEngine | ||||||
|  | 
 | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     app = QGuiApplication(sys.argv) | ||||||
|  |     engine = QQmlApplicationEngine() | ||||||
|  |     engine.addImportPath(sys.path[0]) | ||||||
|  |     engine.loadFromModule("ui", "Main") | ||||||
|  |     if not engine.rootObjects(): | ||||||
|  |         sys.exit(-1) | ||||||
|  |     exit_code = app.exec() | ||||||
|  |     del engine | ||||||
|  |     sys.exit(exit_code) | ||||||
							
								
								
									
										0
									
								
								src/models/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/models/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										12
									
								
								src/models/author.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/models/author.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | from sqlalchemy import Column, Integer, VARCHAR | ||||||
|  | from sqlalchemy.orm import relationship | ||||||
|  | from sqlalchemy.ext.declarative import declarative_base | ||||||
|  | 
 | ||||||
|  | Base = declarative_base() | ||||||
|  | 
 | ||||||
|  | class Author(Base): | ||||||
|  |     __tablename__ = "author" | ||||||
|  | 
 | ||||||
|  |     id = Column(Integer, primary_key=True) | ||||||
|  |     first_name = Column(VARCHAR(length=50)) | ||||||
|  |     last_name = Column(VARCHAR(length=50)) | ||||||
							
								
								
									
										32
									
								
								src/ui/Main.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/ui/Main.qml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | import QtQuick | ||||||
|  | import QtQuick.Controls | ||||||
|  | import QtQuick.Layouts | ||||||
|  | 
 | ||||||
|  | Window { | ||||||
|  |     width: 300 | ||||||
|  |     height: 200 | ||||||
|  |     visible: true | ||||||
|  |     title: "Hello World" | ||||||
|  | 
 | ||||||
|  |     readonly property list<string> texts: ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"] | ||||||
|  | 
 | ||||||
|  |     function setText() { | ||||||
|  |         var i = Math.round(Math.random() * 3); | ||||||
|  |         text.text = texts[i]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     ColumnLayout { | ||||||
|  |         anchors.fill: parent | ||||||
|  | 
 | ||||||
|  |         Text { | ||||||
|  |             id: text | ||||||
|  |             text: "Hello World" | ||||||
|  |             Layout.alignment: Qt.AlignHCenter | ||||||
|  |         } | ||||||
|  |         Button { | ||||||
|  |             text: "Click me" | ||||||
|  |             Layout.alignment: Qt.AlignHCenter | ||||||
|  |             onClicked: setText() | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								src/ui/qmldir
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/ui/qmldir
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | module Example | ||||||
|  | Main 254.0 Main.qml | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user