first off all; thanks for answers!
I created two different windows and two different Python file. i could connect them like this:
When I click to "New Project" button under the QlistWidget item then it opens.This is good but i have a problem. I want to connect QlineEdit (in QDialogWindow) to QlistWidget (in QMainWindow).
This is my MainWindow Codes:
from PySide.QtCore import *
from PySide.QtGui import *
import os, sys
import neworkdialog
class projectManager(QMainWindow, QObject):
def __init__(self):
super(projectManager, self).__init__()
self.managerUI()
def managerUI(self):
def generalClose():
sys.exit()
def itemListLabel():
itemChanged = self.workList.currentItem().text()
self.projectDescription.setText(itemChanged)
def newProject():
neworkdialog.start_nework()
self.menubar = QMenuBar()
self.fileMenu = self.menubar.addMenu("&File")
nw = self.fileMenu.addAction("New Work")
nw.setShortcut("ctrl+n")
nw.triggered.connect(newProject)
self.fileMenu.addAction("Delete Work")
self.fileMenu.addSeparator()
op = self.fileMenu.addAction("Open")
op.setShortcut("ctrl+o")
sv = self.fileMenu.addAction("Save")
sv.setShortcut("ctrl+s")
cs = self.fileMenu.addAction("Close")
cs.setShortcut("ctrl+q")
cs.triggered.connect(generalClose)
self.toolMenu = self.menubar.addMenu("&Tools")
self.toolMenu.addAction("Calculator")
self.toolMenu.addAction("Deadline(s)")
self.aboutMenu = self.menubar.addMenu("&Help")
self.aboutMenu.addAction("About")
self.aboutMenu.addAction("GameTime")
self.aboutMenu.addAction("Help")
self.setMenuBar(self.menubar)
self.workList = QListWidget()
# i = ["deneme1","bdeneme2","adeneme3"]
# self.workList.addItems(i)
self.workList.setMaximumWidth(275)
self.newProjectButton = QPushButton()
self.newProjectButton.setText("New Project")
self.newProjectButton.clicked.connect(newProject)
self.delProjectButton = QPushButton()
self.delProjectButton.setText("Delete Project")
self.projectDescription = QLabel()
self.projectDescription.setText("Project Title")
self.workList.itemClicked.connect(itemListLabel)
self.projectDescription.setStyleSheet("font: 22pt")
self.widgets = QWidget()
self.mainLayout = QHBoxLayout()
self.workListLayout = QVBoxLayout()
self.workListLayout.addWidget(self.workList)
self.projectDescriptionLayout = QHBoxLayout()
self.projectDescriptionLayout.addWidget(self.projectDescription)
self.workButtonLayout = QHBoxLayout()
self.workButtonLayout.addWidget(self.newProjectButton)
self.workButtonLayout.addWidget(self.delProjectButton)
self.workListLayout.addLayout(self.workButtonLayout)
self.mainLayout.addLayout(self.workListLayout)
self.mainLayout.addLayout(self.projectDescriptionLayout)
self.widgets.setLayout(self.mainLayout)
self.setCentralWidget(self.widgets)
def start():
app = QApplication(sys.argv)
ui = projectManager()
ui.setWindowTitle("Projects Manager v.01")
ui.setFixedSize(1280, 920)
ui.show()
sys.exit(app.exec_())
if __name__ == '__main__':
start()
And this is my Qdialog codes:
from PySide.QtCore import *
from PySide.QtGui import *
import os, sys
import _projectMainWindow
class neworkdialogs (QDialog, QObject):
def __init__(self):
super(neworkdialogs, self).__init__()
self.dialogBuildUI()
def dialogBuildUI(self):
print _projectMainWindow
def setProjectTitle():
setWindowText = self.projectName.text()
self.setWindowTitle(setWindowText)
def generalExit():
sys.exit()
self.projectName = QLineEdit()
self.projectName.setPlaceholderText("Set Project Name")
self.projectName.textChanged.connect(setProjectTitle)
self.projectPrice = QLineEdit()
self.projectPrice.setPlaceholderText("Set Money Count")
def addNewWrokToList():
ProjectNameOfText = self.projectName.text()
self.worklist.addItem(ProjectNameOfText)
priceItems = ["TL", "USD", "EUR"]
self.priceDoviz = QComboBox()
self.priceDoviz.addItems(priceItems)
self.AcceptButton = QPushButton("Create Work")
self.AcceptButton.clicked.connect(addNewWrokToList)
self.abondon = QPushButton("Abondon")
self.abondon.clicked.connect(generalExit)
self.dialogLayout = QVBoxLayout()
self.inputLayout = QHBoxLayout()
self.buttonLayout = QHBoxLayout()
self.inputLayout.addWidget(self.projectName)
self.inputLayout.addWidget(self.projectPrice)
self.inputLayout.addWidget(self.priceDoviz)
self.dialogLayout.addLayout(self.inputLayout)
self.dialogLayout.addLayout(self.buttonLayout)
self.buttonLayout.addWidget(self.AcceptButton)
self.buttonLayout.addWidget(self.abondon)
self.setLayout(self.dialogLayout)
def start_nework():
ui = neworkdialogs()
ui.setWindowTitle("Your job properties")
ui.show()
ui.exec_()
So, how can I connect different window and widgets? Thank you again :)